UnityRef is currently in early development. Some features may be incomplete and/or not functioning.

UNITYREF

Your Pit Stop For Solving ANYTHING in Unity

graphics

[Rendering] Shadow Cascades: Fix Inaccurate Split Distances

Under Audit

lightinggraphics

Unity 2022.3.x - Unity 6.0.x

Published 18 days ago

The calculation of shadow cascades split distances, especially in Stable Fit mode, does not solely rely on a percentage of the maximum shadow distance. It incorporates factors like camera field of view and direction, leading to non-uniform split positions.

Issue

 The calculation of shadow cascades split distances, particularly when using the Stable Fit mode, does not directly correspond to a simple percentage-based spherical distance from the Camera. For example, if the maximum shadow distance is set to 100 units and a shadow cascades split is configured at 10%, the resulting split line may not occur precisely at 10 meters from the Camera's position. The underlying system appears to incorporate additional factors, such as the Camera's field of view (FOV) and its current direction, to determine the actual shadow cascades split positions. This complex calculation results in shadow cascades boundaries that do not necessarily have their centers aligned directly with the Camera's position and may not precisely match the expected percentage-based distances, as visually demonstrated when comparing configured split percentages to actual in-scene distances.

Experimental Fixes
  • Verify the Shadow Projection setting within Project Settings > Quality > Shadows. While Stable Fit is designed to reduce shadow swimming, Close Fit might offer a more uniform distribution of shadow map texels across the frustum, potentially making split distances appear more consistent.
  • Adjust the Shadow Distance value in Project Settings > Quality to observe its direct impact on the overall range covered by the shadow cascades. This setting defines the maximum distance at which shadows are rendered.
  • Review the Cascade Split settings under Project Settings > Quality > Shadow Cascades to ensure the percentages are correctly configured and understood in the context of Stable Fit’s projection method.

Editor's Note:

The above fixes have not been verified by our audit team yet. They are provided exclusively for your own technical research. We recommend creating a backup of your project before proceeding with any attempts. Utilize at your own discretion!

Related Posts Haven't quite found a solution to your problem? We think these posts might help you.

Content inspired by a Unity discussion post.