diff --git a/files/shaders/compatibility/objects.frag b/files/shaders/compatibility/objects.frag index ad6d262f6d..13c311611b 100644 --- a/files/shaders/compatibility/objects.frag +++ b/files/shaders/compatibility/objects.frag @@ -72,6 +72,7 @@ uniform float distortionStrength; #if !PER_PIXEL_LIGHTING centroid varying vec3 passLighting; +centroid varying vec3 passDiffuseLighting; centroid varying vec3 passSpecular; centroid varying vec3 shadowDiffuseLighting; centroid varying vec3 shadowSpecularLighting; @@ -220,7 +221,9 @@ vec2 screenCoords = gl_FragCoord.xy / screenRes; float shadowing = unshadowedLightRatio(-passViewPos.z); vec3 lighting, specular; #if !PER_PIXEL_LIGHTING - lighting = passLighting + shadowDiffuseLighting * shadowing; + lighting = passDiffuseLighting * diffuseColor.xyz + passLighting; + clampLightingResult(lighting); + lighting += shadowDiffuseLighting * diffuseColor.xyz * shadowing; specular = passSpecular + shadowSpecularLighting * shadowing; #else #if @specularMap diff --git a/files/shaders/compatibility/objects.vert b/files/shaders/compatibility/objects.vert index 081ff909cf..93df612ace 100644 --- a/files/shaders/compatibility/objects.vert +++ b/files/shaders/compatibility/objects.vert @@ -53,6 +53,7 @@ varying vec2 glossMapUV; #if !PER_PIXEL_LIGHTING centroid varying vec3 passLighting; +centroid varying vec3 passDiffuseLighting; centroid varying vec3 passSpecular; centroid varying vec3 shadowDiffuseLighting; centroid varying vec3 shadowSpecularLighting; @@ -150,10 +151,11 @@ void main(void) #if !PER_PIXEL_LIGHTING vec3 diffuseLight, ambientLight, specularLight; doLighting(viewPos.xyz, viewNormal, gl_FrontMaterial.shininess, diffuseLight, ambientLight, specularLight, shadowDiffuseLighting, shadowSpecularLighting); - passLighting = getDiffuseColor().xyz * diffuseLight + getAmbientColor().xyz * ambientLight + getEmissionColor().xyz * emissiveMult; + passLighting = getAmbientColor().xyz * ambientLight + getEmissionColor().xyz * emissiveMult; + passDiffuseLighting = diffuseLight; passSpecular = getSpecularColor().xyz * specularLight * specStrength; clampLightingResult(passLighting); - shadowDiffuseLighting *= getDiffuseColor().xyz; + clampLightingResult(passDiffuseLighting); shadowSpecularLighting *= getSpecularColor().xyz * specStrength; #endif