mirror of
https://github.com/bevyengine/bevy
synced 2025-01-05 17:58:54 +00:00
53667dea56
![image](https://user-images.githubusercontent.com/47158642/214374911-412f0986-3927-4f7a-9a6c-413bdee6b389.png) # 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 https://github.com/bevyengine/bevy/issues/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 https://github.com/bevyengine/bevy/issues/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 --------- Co-authored-by: IceSentry <c.giguere42@gmail.com> Co-authored-by: IceSentry <IceSentry@users.noreply.github.com> Co-authored-by: Robert Swain <robert.swain@gmail.com> Co-authored-by: Daniel Chia <danstryder@gmail.com> Co-authored-by: robtfm <50659922+robtfm@users.noreply.github.com> Co-authored-by: Brandon Dyer <brandondyer64@gmail.com> Co-authored-by: Edgar Geier <geieredgar@gmail.com>
33 lines
1,007 B
WebGPU Shading Language
33 lines
1,007 B
WebGPU Shading Language
#import bevy_pbr::mesh_types
|
|
#import bevy_pbr::mesh_view_bindings
|
|
#import bevy_pbr::prepass_utils
|
|
|
|
struct ShowPrepassSettings {
|
|
show_depth: u32,
|
|
show_normals: u32,
|
|
show_motion_vectors: u32,
|
|
padding_1: u32,
|
|
padding_2: u32,
|
|
}
|
|
@group(1) @binding(0)
|
|
var<uniform> settings: ShowPrepassSettings;
|
|
|
|
@fragment
|
|
fn fragment(
|
|
@builtin(position) frag_coord: vec4<f32>,
|
|
@builtin(sample_index) sample_index: u32,
|
|
#import bevy_pbr::mesh_vertex_output
|
|
) -> @location(0) vec4<f32> {
|
|
if settings.show_depth == 1u {
|
|
let depth = prepass_depth(frag_coord, sample_index);
|
|
return vec4(depth, depth, depth, 1.0);
|
|
} else if settings.show_normals == 1u {
|
|
let normal = prepass_normal(frag_coord, sample_index);
|
|
return vec4(normal, 1.0);
|
|
} else if settings.show_motion_vectors == 1u {
|
|
let motion_vector = prepass_motion_vector(frag_coord, sample_index);
|
|
return vec4(motion_vector / globals.delta_time, 0.0, 1.0);
|
|
}
|
|
|
|
return vec4(0.0);
|
|
}
|