Fixed the bug that alpha clip does not working properly;
This commit is contained in:
@@ -124,11 +124,11 @@ UTSSurfaceData GetUTSSurfaceData(FragInputs input, float3 V)
|
||||
|
||||
float4 normalLocal = float4(0, 0, 1.0, 1.0);
|
||||
#if _NORMALMAP
|
||||
if (_Use_SSSLut)
|
||||
{
|
||||
normalLocal = SAMPLE_TEXTURE2D_LOD(_NormalMap, sampler_NormalMap, TRANSFORM_TEX(input.texCoord0, _BaseColorMap), _SSSIntensity);
|
||||
}
|
||||
else
|
||||
// if (_Use_SSSLut)
|
||||
// {
|
||||
// normalLocal = SAMPLE_TEXTURE2D_LOD(_NormalMap, sampler_NormalMap, TRANSFORM_TEX(input.texCoord0, _BaseColorMap), _SSSIntensity);
|
||||
// }
|
||||
// else
|
||||
{
|
||||
normalLocal = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, TRANSFORM_TEX(input.texCoord0, _BaseColorMap));
|
||||
normalLocal.rgb = UnpackNormalScale(normalLocal, _NormalScale);
|
||||
@@ -190,7 +190,8 @@ UTSSurfaceData GetUTSSurfaceData(FragInputs input, float3 V)
|
||||
output.geomNormalWS = input.tangentToWorld[2];
|
||||
output.tangentWS = Orthonormalize(input.tangentToWorld[0].rgb, normalWS);
|
||||
|
||||
output.subsurfaceColor = SAMPLE_TEXTURE2D(_SSSLutMap, s_linear_clamp_sampler, TRANSFORM_TEX(input.texCoord0, _BaseColorMap)) * _SSSIntensity;
|
||||
// output.subsurfaceColor = SAMPLE_TEXTURE2D(_SSSLutMap, s_linear_clamp_sampler, TRANSFORM_TEX(input.texCoord0, _BaseColorMap)) * _SSSIntensity;
|
||||
output.subsurfaceColor = 0.0;
|
||||
|
||||
output.anisotropy = anisotropy;
|
||||
|
||||
@@ -583,4 +584,4 @@ float3 SampleBakedGI_UTS_OutLine(float3 positionRWS, float3 normalWS, float2 uvS
|
||||
}
|
||||
|
||||
|
||||
#endif //#ifndef UCTS_HDRP_INCLUDED
|
||||
#endif //#ifndef UCTS_HDRP_INCLUDED
|
||||
|
||||
@@ -391,4 +391,4 @@ void UtsGetSurfaceAndBuiltinData(FragInputs input, float3 V, inout PositionInput
|
||||
RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -11,13 +11,6 @@ void UTS_OtherLights(LightLoopContext lightLoopContext, FragInputs input, UTSLig
|
||||
|
||||
// We dont have to calculate lighting here if we are using sdf shadow
|
||||
#ifndef _SDFShadow
|
||||
#ifdef _IS_CLIPPING_MATTE
|
||||
if (_ClippingMatteMode != 0)
|
||||
{
|
||||
|
||||
return float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
#endif // _IS_CLIPPING_MATTE
|
||||
|
||||
uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize();
|
||||
// input.positionSS is SV_Position
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
// Surface Option
|
||||
float _SurfaceFeatures;
|
||||
half _AlphaCutoffEnable;
|
||||
float _AlphaCutoff;
|
||||
|
||||
// Shading Color
|
||||
float4 _BaseColor;
|
||||
@@ -58,8 +60,8 @@ float _ToonSpecularFeather;
|
||||
float _BSDFContribution;
|
||||
float _EnergyConservingSpecularColor;
|
||||
|
||||
float _SSSIntensity;
|
||||
int _Use_SSSLut;
|
||||
// float _SSSIntensity;
|
||||
// int _Use_SSSLut;
|
||||
|
||||
float3 _EmissiveColor;
|
||||
half _AlbedoAffectEmissive;
|
||||
@@ -118,11 +120,12 @@ float _LightIntensityMultiplier;
|
||||
// Light Loop
|
||||
float3 _ObjectCenterPositionWS;
|
||||
|
||||
|
||||
// NOTE: Not sure what these are for
|
||||
// float _FirstShadeOverridden;
|
||||
// float _SecondShadeOverridden;
|
||||
|
||||
float _UseShadowThreshold;
|
||||
float _AlphaCutoffShadow;
|
||||
float _ComposerMaskMode;
|
||||
|
||||
#if defined(_UTS_TOON_EV_PER_MODEL)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user