diff --git a/wadsrc/static/shaders/scene/lightmode.glsl b/wadsrc/static/shaders/scene/lightmode.glsl index 924243f4f..fe033c6c6 100644 --- a/wadsrc/static/shaders/scene/lightmode.glsl +++ b/wadsrc/static/shaders/scene/lightmode.glsl @@ -63,7 +63,7 @@ vec4 getLightColor(Material material) // if (vLightmap.z >= 0.0) { - color.rgb += texture(LightMap, vLightmap).rgb; + color.rgb += texture(LightMap, vec3(material.LightmapCoord.xy, vLightmap.z)).rgb; } // diff --git a/wadsrc/static/shaders/scene/material.glsl b/wadsrc/static/shaders/scene/material.glsl index 1a94fceee..dd541450b 100644 --- a/wadsrc/static/shaders/scene/material.glsl +++ b/wadsrc/static/shaders/scene/material.glsl @@ -14,6 +14,7 @@ struct Material float Metallic; float Roughness; float AO; + vec2 LightmapCoord; }; vec4 Process(vec4 color); @@ -51,6 +52,8 @@ void SetMaterialProps(inout Material material, vec2 texCoord) material.Base = getTexel(texCoord.st); material.Normal = ApplyNormalMap(texCoord.st); + material.LightmapCoord = vLightmap.xy; + // OpenGL doesn't care, but Vulkan pukes all over the place if these texture samplings are included in no-texture shaders, even though never called. #ifndef NO_LAYERS #if defined(TEXF_Brightmap)