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

Temporal Antialiasing and Screenspace Ambient Occlusion #7070

Closed
wants to merge 248 commits into from

Conversation

JMS55
Copy link
Contributor

@JMS55 JMS55 commented Jan 2, 2023

sponza_ao_only
(somewhat outdated screenshot of Sponza SSAO texture - the quality has improved since taking this)

Objective

  • Add temporal antialiasing - a method of antialiasing, like MSAA or FXAA.
    • Scales with screen resolution, and not triangle count.
    • Reduces more forms of aliasing than MSAA.
    • Reduces noise in other rendering effects (SSAO, eventually SSR/PCF/RT/etc).
    • Con: chance of "ghosting", often need game-specific tunable heuristics.
    • Closes Temporal Anti-Aliasing #3663.
  • Add screen space ambient occlusion.
    • Darkens creases between objects and other occluded areas, creating shadows in areas that should have less indirect light in them due to other geometry occluding light.
    • Closes Screen Space Ambient Occlusion #3632.

These two features are being implemented together as TAA greatly increases the quality of SSAO, and I developed them together in parallel, tweaking one or the other. I would split TAA into it's own PR first, but I don't currently have time to do so, and multiple-dependent PRs (depth prepass -> TAA -> SSAO) is tricky (especially when it comes to rebasing), hence why this is a single PR marked as draft.

Remaining Work

  • Double check depth preprocessing for SSAO is correct with bevy's coordinate systems (reverse z)
  • More TAA disocclusion heuristics (stencil, velocity, depth?), and make them tunable (maybe future PR)
  • Documentation
  • Better TAA example
  • TAA orthographic projection support (maybe future PR)
  • SSAO MSAA support?
  • TAA mip bias for sharper textures
  • Optimizations (future PR)
    • Faster coordinate space conversions (don't do full matrix multiples, precalculate some converted textures)
    • SSAO spatial denoise 2 pixels per thread, instead of 1 (XeGTAO says this is faster, need to benchmark)
    • F16 math (missing support in wgpu afaik)

Blockers

Solution


Changelog

  • TODO

Migration Guide

  • TODO

Credits

Huge thanks to robswain, Danciel C, IceSentry, Griffin, cryscan, and others for various help with this PR. Thanks to Intel for XeGTAO, which is a great reference for implementing and optimizing GTAO.

@alice-i-cecile
Copy link
Member

For the folks who aren't rendering experts, can you edit your PR description to explain what these are, and why they're being implemented together?

@alice-i-cecile alice-i-cecile added C-Enhancement A new feature A-Rendering Drawing game state to the screen labels Jan 3, 2023
@JMS55
Copy link
Contributor Author

JMS55 commented Jan 5, 2023

For the folks who aren't rendering experts, can you edit your PR description to explain what these are, and why they're being implemented together?

I edited my PR to have a brief description. See the linked issues for further explanations. Let me know if it's not detailed enough, still.

@JMS55
Copy link
Contributor Author

JMS55 commented Jan 20, 2023

Now that the prepass has been merged, I'm splitting up this PR and opening it as separate PRs.

@JMS55 JMS55 closed this Jan 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Enhancement A new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Temporal Anti-Aliasing Screen Space Ambient Occlusion
3 participants