Fix midtextures being opaque

This commit is contained in:
Magnus Norddahl 2024-03-04 21:40:11 +01:00
commit b99cf589e7
2 changed files with 9 additions and 5 deletions

View file

@ -70,8 +70,8 @@ vec4 TracePointLightRay(vec3 origin, vec3 lightpos, float tmin, vec4 rayColor)
// Blend with surface texture
rayColor = BlendTexture(surface, GetSurfaceUV(result.primitiveIndex, result.primitiveWeights), rayColor);
// Stop if it isn't a portal, or there is no light left
if (surface.PortalIndex == 0 || rayColor.r + rayColor.g + rayColor.b <= 0.0)
// Stop if there is no light left
if (rayColor.r + rayColor.g + rayColor.b <= 0.0)
return vec4(0.0);
// Move to surface hit point

View file

@ -53,12 +53,16 @@ vec4 TraceSunRay(vec3 origin, float tmin, vec3 dir, float tmax, vec4 rayColor)
SurfaceInfo surface = GetSurface(result.primitiveIndex);
// Stop if we hit the sky.
if (surface.Sky > 0.0)
return rayColor;
// Blend with surface texture
rayColor = BlendTexture(surface, GetSurfaceUV(result.primitiveIndex, result.primitiveWeights), rayColor);
// Stop if it isn't a portal, or there is no light left
if (surface.PortalIndex == 0 || rayColor.r + rayColor.g + rayColor.b <= 0.0)
return rayColor * surface.Sky;
// Stop if there is no light left
if (rayColor.r + rayColor.g + rayColor.b <= 0.0)
return vec4(0.0);
// Move to surface hit point
origin += dir * result.t;