From 775c8e43f9c5e577f9d26962030137e0ba96275c Mon Sep 17 00:00:00 2001 From: Danny McGee Date: Thu, 28 Sep 2023 15:07:06 -0400 Subject: [PATCH] Tweak world-grid plane shader --- hello-world/assets/shaders/procedural_grid.wgsl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hello-world/assets/shaders/procedural_grid.wgsl b/hello-world/assets/shaders/procedural_grid.wgsl index 3d4b7a6..a24e116 100644 --- a/hello-world/assets/shaders/procedural_grid.wgsl +++ b/hello-world/assets/shaders/procedural_grid.wgsl @@ -28,8 +28,8 @@ fn grid_lines(pos: vec4, depth: f32, scale: f32, depth_min: f32, depth_max: let thickness = (0.0333 * scale) / (depth * 100.0); - var x = smoothstep(0.0, thickness, fracs.x); - var z = smoothstep(0.0, thickness, fracs.z); + let x = smoothstep(0.0, thickness, fracs.x); + let z = smoothstep(0.0, thickness, fracs.z); let value = 1.0 - saturate(x * z); let mask = inv_lerp(depth_min, depth_max, depth); @@ -45,5 +45,5 @@ fn fragment(in: MeshVertexOutput) -> @location(0) vec4 { let dense = grid_lines(pos, depth, 1.0, 0.0001, 0.01); let sparse = grid_lines(pos, depth, 0.1, 0.00005, 0.005); - return vec4(1.0, 1.0, 1.0, 1.0) * 0.5 * saturate(dense + sparse); + return vec4(0.5, 0.5, 0.5, 0.5) * min(0.5, saturate(dense + sparse)); }