Skip to content

Jitter shadow map dithering pattern across frames when TAA is enabled#97428

Merged
akien-mga merged 1 commit into
godotengine:masterfrom
clayjohn:shadow-filter-jitter-rebase
Sep 26, 2024
Merged

Jitter shadow map dithering pattern across frames when TAA is enabled#97428
akien-mga merged 1 commit into
godotengine:masterfrom
clayjohn:shadow-filter-jitter-rebase

Conversation

@clayjohn

Copy link
Copy Markdown
Member

Supersedes: #61834
This closes godotengine/godot-proposals#4179 and closes #53534.

Credit to @Calinou who did most of the work. I just did some final cleanup to improve the quality before it was ready to merge

I ended up rebasing while working on the improvements described in #61834 (comment) so I figured it was less work overall for us to open a new PR.

This PR builds on the current state of #61834, see that PR for a full description/history

This improves shadow quality by reducing the visibility of the noisy
pattern caused by dithering.

This jittering also applies when FSR2 is enabled, as it provides its own
form of temporal antialiasing.

Co-authored-by: Clay John <claynjohn@gmail.com>
@hsvfan-jan

Copy link
Copy Markdown

Will the improved documentation of this comment of yours in #61834

We need to document that FSR2.2 at 1.0 scale is more sensitive to high contrast areas than TAA or FSR2.2 at lower scales as this will impact many users.

be included in another PR? I think it wouldn't be obvious why these artifacts will be found in various strengths in different locations in a level so documenting it would be great.

@akien-mga akien-mga left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is co-authored by Clay and Hugo so it's pretty much peer reviewed already. Seems simple enough for me to approve for merge.

@clayjohn

Copy link
Copy Markdown
Member Author

Will the improved documentation of this comment of yours in #61834

We need to document that FSR2.2 at 1.0 scale is more sensitive to high contrast areas than TAA or FSR2.2 at lower scales as this will impact many users.

be included in another PR? I think it wouldn't be obvious why these artifacts will be found in various strengths in different locations in a level so documenting it would be great.

Yes, the docs are hosted in a separate repository. So the documentation update will necessarily be in another PR

@akien-mga akien-mga merged commit bfe74ec into godotengine:master Sep 26, 2024
@akien-mga

Copy link
Copy Markdown
Member

Thanks!

mat2 disk_rotation;
{
float r = quick_hash(gl_FragCoord.xy) * 2.0 * M_PI;
float r = quick_hash(gl_FragCoord.xy + vec2(taa_frame_count * 5.588238)) * 2.0 * M_PI;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Was there a specific reason we went for 5.588238? I can't find this value anywhere else in the codebase. For context, I'm asking because of #101961.

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.

It's the value suggested by the author of IGN. There is a nice explanation here: https://blog.demofox.org/2022/01/01/interleaved-gradient-noise-a-different-kind-of-low-discrepancy-sequence/

@clayjohn clayjohn deleted the shadow-filter-jitter-rebase branch January 24, 2025 17:40
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.

Add an option to jitter the shadow dithering pattern every frame Vulkan: soft shadows appear grainy, even on "Ultra" quality setting

4 participants