11
2+ #include "../../Shaders/URP/ToonShading.hlsl"
3+
24void ToonShading (
35 const float4 firstShadePosTex, const float4 secondShadePosTex, const float3 highlightTex,
46 const float3 highlightMaskTex,
@@ -23,14 +25,21 @@ void ToonShading(
2325 float halfLambert = 0.5 * dot (lerp (vertexNormalWS, perturbedNormalWS, _Is_NormalMapToBase), lightDirection) + 0.5 ;
2426
2527 //[TODO-sin: 2026-1-27] It looks like we only need one channel of firstShadePosTex
26- float Set_FinalShadowMask = saturate (
27- 1.0 + (lerp (halfLambert, halfLambert * saturate (tweakShadows), _Set_SystemShadowsToBase)
28- - baseStepMinusFeather) * ((1.0 - firstShadePosTex.rgb).r - 1.0 ) / (baseColorStep - baseStepMinusFeather));
29- //
30- //Composition: 3 Basic Colors as Set_FinalBaseColor
31- float3 finalColor = lerp (Set_BaseColor, lerp (Set_1st_ShadeColor, Set_2nd_ShadeColor,
32- saturate (( 1.0 + (halfLambert - firstStepMinusFeather) * ((1.0 - secondShadePosTex.rgb).r - 1.0 )
33- / (shadeColorStep - firstStepMinusFeather)))), Set_FinalShadowMask);
28+ // float Set_FinalShadowMask = saturate(
29+ // 1.0 + (lerp(halfLambert, halfLambert * saturate(tweakShadows), _Set_SystemShadowsToBase)
30+ // - baseStepMinusFeather) * ((1.0 - firstShadePosTex.rgb).r - 1.0) / (baseColorStep - baseStepMinusFeather));
31+
32+
33+ const float dotNL = dot ( perturbedNormalWS, lightDirection);
34+ const float dotNL_01 = 0.5 * dotNL + 0.5 ;
35+ float shadowFactor = lerp (1 ,tweakShadows,saturate (dotNL));
36+
37+ float3 finalColor = ThreeColorsLinearShading (Set_BaseColor, Set_1st_ShadeColor, Set_2nd_ShadeColor,
38+ baseColorStep, _BaseShade_Feather, shadeColorStep,
39+ _1st2nd_Shades_Feather, dotNL_01 * shadowFactor);
40+
41+ float Set_FinalShadowMask = dotNL_01 * shadowFactor * firstShadePosTex.r;
42+ ///
3443
3544 float specular = 0.5 * dot (halfDirection, lerp (vertexNormalWS, perturbedNormalWS, _Is_NormalMapToHighColor)) + 0.5 ;
3645
0 commit comments