Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scale light shadow bias by soft_shadow_scale to reduce shadow acne #68339

Merged
merged 1 commit into from
Nov 14, 2022

Conversation

clayjohn
Copy link
Member

@clayjohn clayjohn commented Nov 6, 2022

Fixes: #54523

Supercedes: #55758 and partially supercedes #55757 (this does not affect normal bias)

This PR increases the amount of bias used proportional to the radius of the PCF shadow filter. When using a larger filter radius, we need to use a greater bias. This reduces the shadow acne visible for all quality settings (because soft_shadow_scale is greater than 1 for all quality settings above hard shadows.

The unfortunate side effect of this change is an increase in peter-panning at high quality levels, but that is a necessary consequence to avoid shadow acne. I.e. without this PR if you tweak shadow_bias to the point of removing shadow acne you get about the same amount of peter-panning.

Before: Low Quality (default)
Screenshot from 2022-11-06 10-52-04

After: Low Quality
Screenshot from 2022-11-06 10-54-00

Before: Ultra Quality
Screenshot from 2022-11-06 10-52-17

After: Ultra Quality
Screenshot from 2022-11-06 10-53-52

@clayjohn clayjohn added this to the 4.0 milestone Nov 6, 2022
@clayjohn clayjohn requested a review from Calinou November 6, 2022 19:12
@clayjohn clayjohn requested a review from a team as a code owner November 6, 2022 19:12
@Calinou
Copy link
Member

Calinou commented Nov 6, 2022

The unfortunate side effect of this change is an increase in peter-panning at high quality levels, but that is a necessary consequence to avoid shadow acne.

#55757 might help here, if we also decrease the default DirectionalLight3D shadow bias in exchange (but keep the doubled shadow normal bias from that PR).

@clayjohn
Copy link
Member Author

clayjohn commented Nov 6, 2022

The unfortunate side effect of this change is an increase in peter-panning at high quality levels, but that is a necessary consequence to avoid shadow acne.

#55757 might help here, if we also decrease the default DirectionalLight3D shadow bias in exchange (but keep the doubled shadow normal bias from that PR).

It is definitely worth looking into. I tried out a few variations of increased normal/decrease bias and wasn't able to reduce peter-panning much, but I think a closer look would be valuable.

@akien-mga akien-mga merged commit 7a9a173 into godotengine:master Nov 14, 2022
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants