From f9fb9056f654a834f601df501e1212bff3504253 Mon Sep 17 00:00:00 2001 From: RaveYard <29225776+MrRaveYard@users.noreply.github.com> Date: Wed, 20 Sep 2023 20:45:15 +0200 Subject: [PATCH] Add alpha testing for TraceFirstHitTriangle --- wadsrc/static/shaders/lightmap/frag_raytrace.glsl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wadsrc/static/shaders/lightmap/frag_raytrace.glsl b/wadsrc/static/shaders/lightmap/frag_raytrace.glsl index b15b3f2ee2..1f74a437b7 100644 --- a/wadsrc/static/shaders/lightmap/frag_raytrace.glsl +++ b/wadsrc/static/shaders/lightmap/frag_raytrace.glsl @@ -521,7 +521,13 @@ int TraceFirstHitTriangleT(vec3 origin, float tmin, vec3 dir, float tmax, out fl if(surface.PortalIndex == 0) { - break; + int index = primitiveID * 3; + vec2 uv = vertices[elements[index + 0]].uv * primitiveWeights.x + vertices[elements[index + 1]].uv * primitiveWeights.y + vertices[elements[index + 2]].uv * primitiveWeights.z; + + if (texture(textures[surface.TextureIndex], uv).w > 0.9) + { + break; + } } // Portal was hit: Apply transformation onto the ray