Skip to content

Fix directional shadow bias#51025

Merged
akien-mga merged 1 commit intogodotengine:masterfrom
reduz:fix-directional-shadow-bias
Aug 13, 2021
Merged

Fix directional shadow bias#51025
akien-mga merged 1 commit intogodotengine:masterfrom
reduz:fix-directional-shadow-bias

Conversation

@reduz
Copy link
Copy Markdown
Member

@reduz reduz commented Jul 29, 2021

  • Simplified code a lot, bias based on normalized cascade size.
  • Lets scale cascades, max distance, etc. without creating acne.
  • Fixed normal biasing in directional shadows.

I removed normal biasing in both omni and spot shadows, since the technique can't be easily implemented there.
Will need to be replaced by something else.

Bugsquad edit: This closes #45115.

* Simplified code a lot, bias based on normalized cascade size.
* Lets scale cascades, max distance, etc. without creating acne.
* Fixed normal biasing in directional shadows.

I removed normal biasing in both omni and spot shadows, since the technique can't be easily implemented there.
Will need to be replaced by something else.
@reduz reduz force-pushed the fix-directional-shadow-bias branch from 81c7b8d to 55d357b Compare July 29, 2021 16:51
@reduz reduz requested a review from a team as a code owner July 29, 2021 16:51
light_data.shadow_split_offsets[j] = split;
float bias_scale = li->shadow_transform[j].bias_scale;
light_data.shadow_bias[j] = storage->light_get_param(base, RS::LIGHT_PARAM_SHADOW_BIAS) * bias_scale;
light_data.shadow_bias[j] = storage->light_get_param(base, RS::LIGHT_PARAM_SHADOW_BIAS) / 100.0 * bias_scale;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used 100 to avoid integer units for the normalized bias. Could be 1000 I don know.

Copy link
Copy Markdown
Contributor

@JFonS JFonS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, tested during my work on #51335.

@akien-mga akien-mga merged commit e499758 into godotengine:master Aug 13, 2021
@akien-mga
Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vulkan: Directional light shadow rendering is broken on some splits after culling changes

4 participants