Fixed the bug that alpha clip does not working properly;

This commit is contained in:
2025-03-24 21:41:58 +09:00
parent 410af63578
commit abdf6196ed
8 changed files with 73 additions and 64 deletions

View File

@@ -82,12 +82,7 @@ void Frag(PackedVaryingsToPS packedInput,
discard;
}
#endif
#ifdef _IS_CLIPPING_MATTE
if (_ClippingMatteMode != 0)
{
discard;
}
#endif // _IS_CLIPPING_MATTE
#if defined(UTS_DEBUG_SHADOWMAP_NO_OUTLINE)
discard;
#endif

View File

@@ -146,26 +146,23 @@ void Frag(PackedVaryingsToPS packedInput,
// Initialize the contactShadow and contactShadowFade fields
InitContactShadow(posInput, context);
float channelAlpha = 0.0f;
LightLoopOutput lightLoopOutput;
ZERO_INITIALIZE(LightLoopOutput, lightLoopOutput);
UtsLightLoop(input, posInput, bsdfData, builtinData, V, featureFlags, lightLoopOutput);
float3 finalColor = lightLoopOutput.diffuseLighting + lightLoopOutput.specularLighting;
#ifdef _IS_TRANSCLIPPING_OFF
outColor = float4(finalColor, 1 * ApplyChannelAlpha(channelAlpha));
#elif _IS_TRANSCLIPPING_ON
float Set_Opacity = saturate((inverseClipping + _Tweak_transparency));
outColor = EvaluateAtmosphericScattering(posInput, V, float4(finalColor, 1));
outColor = float4(outColor.rgb, Set_Opacity * ApplyChannelAlpha(channelAlpha));
#endif
// #if _SURFACE_TYPE_TRANSPARENT
// float alpha = channelAlpha;
// outColor = EvaluateAtmosphericScattering(posInput, V, float4(finalColor, 1));
// #else
// float alpha = lerp(1.0, channelAlpha, _AlphaCutoffEnable);
// #endif
//
// alpha = lerp(alpha, step(_AlphaCutoff, alpha), _AlphaCutoffEnable);
outColor = float4(finalColor, 1.0);
#if _MATERIAL_TYPE_FRONTHAIR && ENABLE_UTS_HAIR_BLENDING
float2 screenUV = posInput.positionNDC * _HairBlendingRTHandleScale.xy;
@@ -196,4 +193,4 @@ void Frag(PackedVaryingsToPS packedInput,
outVTFeedback = builtinData.vtPackedFeedback;
#endif
}
}