[Rendering] Shadow Cascades: Fix Inaccurate Split Distances
Under Audit
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.
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.
- Verify the
Shadow Projectionsetting withinProject Settings>Quality>Shadows. WhileStable Fitis designed to reduce shadow swimming,Close Fitmight offer a more uniform distribution of shadow map texels across the frustum, potentially making split distances appear more consistent. - Adjust the
Shadow Distancevalue inProject Settings>Qualityto 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 Splitsettings underProject Settings>Quality>Shadow Cascadesto ensure the percentages are correctly configured and understood in the context ofStable Fit’s projection method.
Editor's Note:
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.