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 <noreply@anthropic.com>
This commit is contained in:
ramox81andClaude Opus 5.5 committed 2026-09-28 13:17:31 +03:00
1 parent e9e05d89f3
commit 5de0ce069f
1 file changed
+5
+5
View File
@@ -64,5 +64,10 @@ fn vs_main(in: VertIn) -> VertOut {
fn fs_main(in: VertOut) -> @location(0) vec4<f32> {
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<f32>(col.rgb, alpha * img_params.opacity);
}