moria/assets/shaders/post-processing.wgsl

25 lines
582 B
Plaintext
Raw Normal View History

#import bevy_pbr::mesh_view_bindings
@group(1) @binding(0)
var texture: texture_2d<f32>;
@group(1) @binding(1)
var our_sampler: sampler;
@group(1) @binding(2)
var noise: texture_2d<f32>;
@group(1) @binding(3)
var noise_sampler: sampler;
@fragment
fn fragment(
@builtin(position) position: vec4<f32>,
#import bevy_sprite::mesh2d_vertex_output
) -> @location(0) vec4<f32> {
let uv = position.xy / vec2<f32>(view.width, view.height);
let uv = floor(uv * 400.0) / 400.0;
2022-08-13 11:34:51 +00:00
let col = textureSample(texture, our_sampler, uv);
return round(col * 50.0) / 50.0;
}