Added SurfaceFeatureFlags;

Added OutlineScope;
Added AngelRingScope;

Change up Outline pass
This commit is contained in:
Misaki
2025-01-29 21:54:17 +09:00
parent 018300e046
commit d8b12a0ca9
18 changed files with 249 additions and 248 deletions

View File

@@ -128,27 +128,11 @@ void Frag(PackedVaryingsToPS packedInput,
#if defined(UTS_DEBUG_SHADOWMAP_NO_OUTLINE)
discard;
#endif
//v.2.0.5
if (_ZOverDrawMode > 0.99f)
{
#ifdef _DEPTHOFFSET_ON
outputDepth = posInput.deviceDepth;
#endif
#ifdef UNITY_VIRTUAL_TEXTURING
outVTFeedback = builtinData.vtPackedFeedback;
#endif
outColor = float4(1.0f, 1.0f, 1.0f, 1.0f); // but nothing should be drawn except Z value as colormask is set to 0
return;
}
_Color = _BaseColor;
float4 objPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1));
float4 Set_UV0 = input.texCoord0;
float4 uv0 = input.texCoord0;
// The following temporary definition of unity_AmbientEquator is for HDRP only.
// The following temporary definition of unity_AmbientEquator is for HDRP only.
//float4 unity_AmbientEquator = float4(0.05, 0.05, 0.05, 1.0); //Todo.
//v.2.0.9
//float3 envLightSource_GradientEquator = unity_AmbientEquator.rgb > 0.05 ? unity_AmbientEquator.rgb : half3(0.05, 0.05, 0.05);
@@ -160,25 +144,15 @@ void Frag(PackedVaryingsToPS packedInput,
float3 ambientSkyColor = envLightSource_SkyboxIntensity.rgb > 0.0 ? envLightSource_SkyboxIntensity : envLightSource_GradientEquator;
ambientSkyColor *= GetCurrentExposureMultiplier() * 5.0f;
float4 _MainTex_var = SAMPLE_TEXTURE2D(_BaseColorMap, sampler_BaseColorMap, TRANSFORM_TEX(Set_UV0, _MainTex));
float3 Set_BaseColor = _BaseColor.rgb*_MainTex_var.rgb;
float3 _Is_BlendBaseColor_var = lerp(_Outline_Color.rgb * ambientSkyColor, (_Outline_Color.rgb * ambientSkyColor * Set_BaseColor * Set_BaseColor), _Is_BlendBaseColor);
//
float3 _OutlineTex_var = tex2D(_OutlineTex,TRANSFORM_TEX(Set_UV0, _OutlineTex)).xyz;
float4 overridingColor = lerp(_OutlineMaskColor, float4(_OutlineMaskColor.w, _OutlineMaskColor.w, _OutlineMaskColor.w, 1.0f), _ComposerMaskMode);
float maskEnabled = max(_OutlineOverridden, _ComposerMaskMode);
//v.2.0.7.5
#ifdef _IS_OUTLINE_CLIPPING_NO
float3 Set_Outline_Color = lerp(_Is_BlendBaseColor_var, _OutlineTex_var.rgb*_Outline_Color.rgb * ambientSkyColor, _Is_OutlineTex );
if (_OutlineVisible < 0.1)
{
// Todo.
// without this, something is drawn even if _OutlineVisible = 0, in AngelRing(HDRP)
discard;
}
Set_Outline_Color = lerp(Set_Outline_Color, overridingColor.xyz, maskEnabled);
float3 baseColor = SAMPLE_TEXTURE2D(_BaseColorMap, sampler_BaseColorMap, TRANSFORM_TEX(uv0, _BaseColorMap)).rgb;
baseColor *= _BaseColor.rgb;
float4 outlineColor = _OutlineColor;
#if _OUTLINE_COLOR_MAP
outlineColor *= SAMPLE_TEXTURE2D(_OutlineColorMap, sampler_OutlineColorMap, TRANSFORM_TEX(uv0, _BaseColorMap)).rgb;
#endif
outlineColor.rgb = lerp(outlineColor.rgb * ambientSkyColor, outlineColor.rgb * ambientSkyColor * baseColor, _AlbedoAffectOutline);
float3 volColor, volOpacity;
uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize();
@@ -187,32 +161,9 @@ void Frag(PackedVaryingsToPS packedInput,
float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS);
EvaluateAtmosphericScattering(posInput, V, volColor, volOpacity); // Premultiplied alpha
Set_Outline_Color.xyz = Set_Outline_Color.xyz * (1 - volOpacity) + volColor * _OutlineVisible;
outColor =float4(Set_Outline_Color, _OutlineVisible );
outlineColor.rgb = outlineColor.rgb * (1 - volOpacity) + volColor;
outColor = outlineColor;
#elif _IS_OUTLINE_CLIPPING_YES
float4 _ClippingMask_var = SAMPLE_TEXTURE2D(_ClippingMask, sampler_MainTex, TRANSFORM_TEX(Set_UV0, _ClippingMask));
float Set_MainTexAlpha = _MainTex_var.a;
float _IsBaseMapAlphaAsClippingMask_var = lerp( _ClippingMask_var.r, Set_MainTexAlpha, _IsBaseMapAlphaAsClippingMask );
float _Inverse_Clipping_var = lerp( _IsBaseMapAlphaAsClippingMask_var, (1.0 - _IsBaseMapAlphaAsClippingMask_var), _Inverse_Clipping );
float Set_Clipping = saturate((_Inverse_Clipping_var+_Clipping_Level));
clip(Set_Clipping - 0.5);
float4 Set_Outline_Color = lerp( float4(_Is_BlendBaseColor_var, Set_Clipping), float4((_OutlineTex_var.rgb * _Outline_Color.rgb * ambientSkyColor),Set_Clipping), _Is_OutlineTex );
Set_Outline_Color = lerp(Set_Outline_Color, overridingColor, maskEnabled);
Set_Outline_Color.w *= _OutlineVisible;
uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize();
// input.positionSS is SV_Position
PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz, tileIndex);
float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS);
float3 volColor, volOpacity;
EvaluateAtmosphericScattering(posInput, V, volColor, volOpacity); // Premultiplied alpha
Set_Outline_Color.xyz = Set_Outline_Color.xyz * (1 - volOpacity.x) + volColor * Set_Outline_Color.w;
outColor = Set_Outline_Color;
#endif
//outColor.rgb = ambientSkyColor;
#ifdef _DEPTHOFFSET_ON
outputDepth = posInput.deviceDepth;
#endif