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 (TAA) #7291

Merged
merged 392 commits into from
Mar 27, 2023
Merged

Temporal Antialiasing (TAA) #7291

merged 392 commits into from
Mar 27, 2023

Conversation

JMS55
Copy link
Contributor

@JMS55 JMS55 commented Jan 20, 2023

image

Objective

  • Implement an alternative antialias technique
  • TAA scales based off of view resolution, not geometry complexity
  • TAA filters textures, firefly pixels, and other aliasing not covered by MSAA
  • TAA additionally will reduce noise / increase quality in future stochastic rendering techniques
  • Closes Temporal Anti-Aliasing #3663

Solution

  • Add a temporal jitter component
  • Add a motion vector prepass
  • Add a TemporalAntialias component and plugin
  • Combine existing MSAA and FXAA examples and add TAA

Followup Work

  • Prepass motion vector support for skinned meshes
    • Move uniforms needed for motion vectors into a separate bind group, instead of using different bind group layouts
  • Reuse previous frame's GPU view buffer for motion vectors, instead of recomputing
  • Mip biasing for sharper textures, and or unjitter texture UVs Mipmap Biasing #7323
  • Compute shader for better performance
  • Investigate FSR techniques
    • Historical depth based disocclusion tests, for geometry disocclusion
    • Historical luminance/hue based tests, for shading disocclusion
    • Pixel "locks" to reduce blending rate / revamp history confidence mechanism
  • Orthographic camera support for TemporalJitter
  • Figure out COD's 1-tap bicubic filter

Changelog

  • Added MotionVectorPrepass and TemporalJitter
  • Added TemporalAntialiasPlugin, TemporalAntialiasBundle, and TemporalAntialiasSettings

@JMS55 JMS55 requested review from robtfm and superdump March 20, 2023 16:54
crates/bevy_core_pipeline/src/bloom/mod.rs Show resolved Hide resolved
HandleUntyped::weak_from_u64(Shader::TYPE_UUID, 656865235226276);

/// Plugin for temporal antialiasing. Disables multisample antialiasing (MSAA).
pub struct TemporalAntialiasPlugin;
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with others here, it should be TemporalAntiAlias.

crates/bevy_core_pipeline/src/taa/mod.rs Outdated Show resolved Hide resolved
crates/bevy_core_pipeline/src/taa/mod.rs Show resolved Hide resolved
crates/bevy_core_pipeline/src/taa/mod.rs Show resolved Hide resolved
crates/bevy_pbr/src/render/pbr_prepass.wgsl Outdated Show resolved Hide resolved
crates/bevy_render/src/camera/camera.rs Show resolved Hide resolved
Comment on lines 7 to 8
const HISTORY_BLEND_RATE: f32 = 0.1;
const MIN_HISTORY_BLEND_RATE: f32 = 0.015;
Copy link
Contributor

Choose a reason for hiding this comment

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

From where do these come? And what do they mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made it up, and decided on these values through trial and error. I'll add some docs.

Copy link
Contributor

Choose a reason for hiding this comment

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

I did see mention of 90% / 10% somewhere, but the MIN_HISTORY_BLEND_RATE value I don't know.

crates/bevy_core_pipeline/src/taa/taa.wgsl Show resolved Hide resolved
crates/bevy_core_pipeline/src/taa/taa.wgsl Show resolved Hide resolved
JMS55 and others added 4 commits March 26, 2023 18:22
Co-authored-by: Robert Swain <robert.swain@gmail.com>
Co-authored-by: Robert Swain <robert.swain@gmail.com>
Copy link
Contributor

@superdump superdump left a comment

Choose a reason for hiding this comment

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

I think this meets the bar. Thanks for implementing this in the first place, and for your patience waiting for review. :)

@superdump superdump added this pull request to the merge queue Mar 27, 2023
Merged via the queue into bevyengine:main with commit 53667de Mar 27, 2023
@JMS55 JMS55 mentioned this pull request Apr 17, 2023
15 tasks
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-Feature A new feature, making something new possible D-Complex Quite challenging from either a design or technical perspective. Ask for help!
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Temporal Anti-Aliasing
10 participants