diff options
author | Silas Bartha <[email protected]> | 2024-06-03 21:10:39 -0400 |
---|---|---|
committer | Silas Bartha <[email protected]> | 2024-06-03 21:10:39 -0400 |
commit | 369cac3c3245214ebf9d03e33e98fb68acb96c10 (patch) | |
tree | 27c0455b7510bd20fef702410e870ce05759f836 /assets/shaders/dither_post_process.wgsl | |
parent | 6dec61d81f0475560f336f17ab1243796d585317 (diff) |
Renamed + Added docs
Diffstat (limited to 'assets/shaders/dither_post_process.wgsl')
-rw-r--r-- | assets/shaders/dither_post_process.wgsl | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/assets/shaders/dither_post_process.wgsl b/assets/shaders/dither_post_process.wgsl index 37c25fc..6440d0d 100644 --- a/assets/shaders/dither_post_process.wgsl +++ b/assets/shaders/dither_post_process.wgsl @@ -9,16 +9,16 @@ fn fragment( in: FullscreenVertexOutput ) -> @location(0) vec4<f32> { - let screen_size = vec2f(textureDimensions(screen_texture)); - let threshold_map_size = vec2f(textureDimensions(threshold_map_texture)); - let pixel_position = floor(in.uv * screen_size); - let map_position = (pixel_position % threshold_map_size) / threshold_map_size; + let screen_size = vec2i(textureDimensions(screen_texture)); + let threshold_map_size = vec2i(textureDimensions(threshold_map_texture)); + let pixel_position = vec2i(floor(in.uv * vec2f(screen_size))); + let map_position = vec2f(pixel_position % threshold_map_size) / vec2f(threshold_map_size); let threshold = textureSample(threshold_map_texture, threshold_map_sampler, map_position).r; let base_color = textureSample(screen_texture, screen_sampler, in.uv); let luma = (0.2126 * base_color.r + 0.7152 * base_color.g + 0.0722 * base_color.b); - let value = f32(luma > threshold); + let value = f32(luma >= threshold); return vec4f(value, value, value, 1.0); } |