Automatically adjust Light3D shadow bias to account for resolution #57638
+29
−11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Follow-up to #55758.
Higher shadowmap resolutions make it possible to use lower bias values without exhibiting shadow acne. On the other hand, shadow bias should be increased when using lower shadowmap resolutions (but not as much, to avoid peter-panning).
The formula was determined empirically and is subject to changes. Nonetheless, I think it's a good start to make graphics settings adjustments easier for users to manage.
The bias values are unchanged at the default shadow size on desktop platforms (
4096
).Testing project: test_shadow_bias_auto_resolution.zip
Preview
Each video starts at the highest shadow resolution and progressively decreases to the lowest shadow resolution.
It's recommended to view each video in fullscreen.
Before
Directional shadows
Visible acne at low shadow resolutions, even up close on the cubes. The distant shadow splits in particular are full of acne.
simplescreenrecorder-2022-02-04_19.49.04.mp4
Point light shadows
Visible acne at low shadow resolutions.
simplescreenrecorder-2022-02-04_19.48.38.mp4
After
Directional shadows
No more acne at low shadow resolutions. Shadow resolutions above the default value also have less visible peter-panning.
simplescreenrecorder-2022-02-04_19.45.50.mp4
Point light shadows
No more acne at low shadow resolutions. Shadow resolutions above the default value also have less visible peter-panning.
simplescreenrecorder-2022-02-04_19.46.21.mp4