diff --git a/Effects/lightmap.eff b/Effects/lightmap.eff index cc0cd277b..43e510c91 100644 --- a/Effects/lightmap.eff +++ b/Effects/lightmap.eff @@ -9,7 +9,8 @@ 1 - /sim/rendering/shader-effects + /sim/rendering/shader-effects + 1 @@ -104,6 +105,11 @@ float condition + + lightmap_factor + float + factor + diff --git a/Shaders/lightmap.frag b/Shaders/lightmap.frag index 838a01f03..1204134b7 100644 --- a/Shaders/lightmap.frag +++ b/Shaders/lightmap.frag @@ -9,10 +9,11 @@ varying vec4 diffuse_term; varying vec3 normal; varying float fogCoord; -// The conditional, to enable lightmapping -uniform float condition; - uniform sampler2D texture; + +// lightmap options +uniform float condition; +uniform float lightmap_factor; uniform sampler2D lightmap_texture; float luminance(vec3 color) @@ -52,10 +53,13 @@ void main() color = clamp(color, 0.0, 1.0); texel = texture2D(texture, gl_TexCoord[0].st); fragColor = color * texel + specular; + + // The lightmap function if ( condition >= 1 ) { - vec3 lightmapTexel = texture2D(lightmap_texture, gl_TexCoord[0].st).rgb; + vec3 lightmapTexel = texture2D(lightmap_texture, gl_TexCoord[0].st).rgb * lightmap_factor; fragColor.rgb = max(fragColor.rgb, lightmapTexel * gl_FrontMaterial.diffuse.rgb * texel.rgb); } + fogFactor = exp(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord); gl_FragColor = mix(gl_Fog.color, fragColor, fogFactor); } \ No newline at end of file