From f04542ac02f4772df262e378f8869118a1d71480 Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Mon, 6 May 2024 15:52:59 +0200 Subject: [PATCH] discard fully transparent --- kubi/shaders/world.wgsl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/kubi/shaders/world.wgsl b/kubi/shaders/world.wgsl index 7cf22b5..2577187 100644 --- a/kubi/shaders/world.wgsl +++ b/kubi/shaders/world.wgsl @@ -16,7 +16,7 @@ struct VertexOutput { @builtin(position) clip_position: vec4, @location(0) uv: vec2, @location(1) normal: vec3, - @location(2) @interpolate(flat) tex_index: u32, + @location(2) @interpolate(flat)tex_index: u32, }; @vertex @@ -28,7 +28,7 @@ fn vs_main( out.normal = in.normal; out.tex_index = in.tex_index; out.clip_position = camera.view_proj * vec4(in.position, 1.0); - return out; + out } @group(0) @binding(0) @@ -39,5 +39,9 @@ var s_diffuse: sampler; @fragment fn fs_main(in: VertexOutput) -> @location(0) vec4 { - return textureSample(t_diffuse, s_diffuse, in.uv, in.tex_index); + let color: vec4 = textureSample(t_diffuse, s_diffuse, in.uv, in.tex_index); + if (color.a == 0.) { + discard + } + color }