This commit is contained in:
commit
f29712d158
259 files changed
+52069
No files matched your search
@@ -0,0 +1,7 @@
|
||||
(
|
||||
label: "Chromatic Aberration",
|
||||
kind: ChromaticAberration,
|
||||
shader: "post_fx/chromatic_aberration.wgsl",
|
||||
intensity: 0.8,
|
||||
radius: 0.5,
|
||||
)
|
||||
@@ -0,0 +1,20 @@
|
||||
#import bevy_core_pipeline::fullscreen_vertex_shader::FullscreenVertexOutput
|
||||
|
||||
struct ChromaticSettings {
|
||||
intensity: f32,
|
||||
radius: f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var<uniform> settings: ChromaticSettings;
|
||||
@group(0) @binding(0) var screen_texture: texture_2d<f32>;
|
||||
@group(0) @binding(1) var texture_sampler: sampler;
|
||||
|
||||
@fragment
|
||||
fn fragment(in: FullscreenVertexOutput) -> @location(0) vec4<f32> {
|
||||
let offset = settings.intensity * 0.004;
|
||||
let r = textureSample(screen_texture, texture_sampler, in.uv + vec2<f32>(offset, 0.0)).r;
|
||||
let g = textureSample(screen_texture, texture_sampler, in.uv).g;
|
||||
let b = textureSample(screen_texture, texture_sampler, in.uv - vec2<f32>(offset, 0.0)).b;
|
||||
let a = textureSample(screen_texture, texture_sampler, in.uv).a;
|
||||
return vec4<f32>(r, g, b, a);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
(
|
||||
label: "Vignette",
|
||||
kind: Vignette,
|
||||
shader: "post_fx/vignette.wgsl",
|
||||
intensity: 0.65,
|
||||
radius: 0.75,
|
||||
)
|
||||
@@ -0,0 +1,19 @@
|
||||
#import bevy_core_pipeline::fullscreen_vertex_shader::FullscreenVertexOutput
|
||||
|
||||
struct VignetteSettings {
|
||||
intensity: f32,
|
||||
radius: f32,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var<uniform> settings: VignetteSettings;
|
||||
@group(0) @binding(0) var screen_texture: texture_2d<f32>;
|
||||
@group(0) @binding(1) var texture_sampler: sampler;
|
||||
|
||||
@fragment
|
||||
fn fragment(in: FullscreenVertexOutput) -> @location(0) vec4<f32> {
|
||||
let color = textureSample(screen_texture, texture_sampler, in.uv);
|
||||
let dist = distance(in.uv, vec2<f32>(0.5, 0.5));
|
||||
let vignette = smoothstep(settings.radius, settings.radius - 0.35, dist);
|
||||
let strength = mix(1.0, vignette, settings.intensity);
|
||||
return vec4<f32>(color.rgb * strength, color.a);
|
||||
}
|
||||
Reference in new issue
Block a user