-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
690 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#import bevy_pbr::utils | ||
#import bevy_core_pipeline::fullscreen_vertex_shader FullscreenVertexOutput | ||
|
||
@group(0) @binding(0) var screen_texture: texture_2d<f32>; | ||
@group(0) @binding(1) var texture_sampler: sampler; | ||
struct ChromaticAberrationSettings { | ||
intensity: f32, | ||
#ifdef SIXTEEN_BYTE_ALIGNMENT | ||
// WebGL2 structs must be 16 byte aligned. | ||
_webgl2_padding: vec3<f32> | ||
#endif | ||
} | ||
@group(0) @binding(2) var<uniform> settings: ChromaticAberrationSettings; | ||
|
||
@fragment | ||
fn fragment(in: FullscreenVertexOutput) -> @location(0) vec4<f32> { | ||
// Chromatic aberration strength | ||
let offset_strength = settings.intensity; | ||
|
||
// Sample each color channel with an arbitrary shift | ||
return vec4<f32>( | ||
textureSample(screen_texture, texture_sampler, in.uv + vec2<f32>(offset_strength, -offset_strength)).r, | ||
textureSample(screen_texture, texture_sampler, in.uv + vec2<f32>(-offset_strength, 0.0)).g, | ||
textureSample(screen_texture, texture_sampler, in.uv + vec2<f32>(0.0, offset_strength)).b, | ||
1.0 | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.