From 5de0ce069fe17e53d09de73eb668397c6264f343 Mon Sep 17 00:00:00 2001 From: ramox81 <184937705+ramox81@users.noreply.github.com> Date: Mon, 28 Sep 2026 13:17:31 +0300 Subject: [PATCH] Image shader: fully transparent pixels are discarded A transparent pixel wrote depth, hiding lines and objects under the image that were drawn after it. Co-Authored-By: Claude Opus 5.5 --- src/shaders/image.wgsl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/shaders/image.wgsl b/src/shaders/image.wgsl index 5bab2a647..b8af298c4 100644 --- a/src/shaders/image.wgsl +++ b/src/shaders/image.wgsl @@ -64,5 +64,10 @@ fn vs_main(in: VertIn) -> VertOut { fn fs_main(in: VertOut) -> @location(0) vec4 { let col = textureSample(img_texture, img_sampler, in.uv); let alpha = select(1.0, col.a, img_params.use_alpha > 0.5); + // A fully transparent pixel leaves no depth behind, so what lies under + // the image (drawn before or after it) shows through. + if (alpha * img_params.opacity <= 0.0) { + discard; + } return vec4(col.rgb, alpha * img_params.opacity); }