@@ -206,12 +206,15 @@ int EvalShadow_GetSplitIndex(HDShadowContext shadowContext, int index, float3 po
206206
207207 // The above code will generate transitions on the whole cascade sphere boundary.
208208 // It means that depending on the light and camera direction, sometimes the transition appears on the wrong side of the cascade
209- // To avoid that we attenuate the effect (lerp to 0.0) when view direction and cascade center to pixel vector face opposite directions.
209+ // To avoid that we attenuate the effect (lerp very sharply to 0.0) when view direction and cascade center to pixel vector face opposite directions.
210210 // This way you only get fade out on the right side of the cascade.
211211 float3 viewDir = GetWorldSpaceViewDir (positionWS);
212- float cascDot = dot (viewDir, wposDir);
213- alpha = lerp (alpha, 0.0 , saturate (cascDot * 4.0 ));
214212
213+ float cascDot = dot (viewDir, wposDir);
214+ // At high border sizes the sharp lerp is noticeable, hence we need to lerp how sharpenss factor
215+ // if we are below 80% we keep the very sharp transition.
216+ float lerpSharpness = 8.0f + 512.0f * smoothstep (1.0f , 0.7f , border );// lerp(1024.0f, 8.0f, saturate(border - 0.8) / 0.2f);
217+ alpha = lerp (alpha, 0.0 , saturate (cascDot * lerpSharpness));
215218 return shadowSplitIndex;
216219}
217220
@@ -298,7 +301,7 @@ float EvalShadow_CascadedDepth_Dither_SplitIndex(HDShadowContext shadowContext,
298301
299302 /* We select what split we need to sample from */
300303 float nextSplit = min (shadowSplitIndex + 1 , cascadeCount - 1 );
301- bool evalNextCascade = nextSplit != shadowSplitIndex && step (InterleavedGradientNoise (positionSS.xy, _TaaFrameInfo.z), alpha);
304+ bool evalNextCascade = nextSplit != shadowSplitIndex && alpha > 0 && step (InterleavedGradientNoise (positionSS.xy, _TaaFrameInfo.z), alpha);
302305
303306 if (evalNextCascade)
304307 {
0 commit comments