From 77bc80730534d6a61838dc6c4880381b71b95038 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 17 Oct 2016 15:01:10 +0200 Subject: [PATCH] Attenuate the light ambient in lighting.glsl (Fixes #3597) --- files/shaders/lighting.glsl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/files/shaders/lighting.glsl b/files/shaders/lighting.glsl index 08b369b5b..d62b61b52 100644 --- a/files/shaders/lighting.glsl +++ b/files/shaders/lighting.glsl @@ -20,9 +20,7 @@ vec4 doLighting(vec3 viewPos, vec3 viewNormal, vec4 vertexColor) d = length(lightDir); lightDir = normalize(lightDir); - lightResult.xyz += ambient * gl_LightSource[i].ambient.xyz; - lightResult.xyz += diffuse.xyz * gl_LightSource[i].diffuse.xyz * clamp(1.0 / (gl_LightSource[i].constantAttenuation + gl_LightSource[i].linearAttenuation * d + gl_LightSource[i].quadraticAttenuation * d * d), 0.0, 1.0) - * max(dot(viewNormal.xyz, lightDir), 0.0); + lightResult.xyz += (ambient * gl_LightSource[i].ambient.xyz + diffuse.xyz * gl_LightSource[i].diffuse.xyz * max(dot(viewNormal.xyz, lightDir), 0.0)) * clamp(1.0 / (gl_LightSource[i].constantAttenuation + gl_LightSource[i].linearAttenuation * d + gl_LightSource[i].quadraticAttenuation * d * d), 0.0, 1.0); } lightResult.xyz += gl_LightModel.ambient.xyz * ambient;