Skip to content

Commit 055cc35

Browse files
committed
fix red lighting with PVL in mac-os
1 parent 1f724cc commit 055cc35

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

files/shaders/compatibility/objects.frag

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ uniform float distortionStrength;
7272

7373
#if !PER_PIXEL_LIGHTING
7474
centroid varying vec3 passLighting;
75+
centroid varying vec3 passDiffuseLighting;
7576
centroid varying vec3 passSpecular;
7677
centroid varying vec3 shadowDiffuseLighting;
7778
centroid varying vec3 shadowSpecularLighting;
@@ -220,7 +221,9 @@ vec2 screenCoords = gl_FragCoord.xy / screenRes;
220221
float shadowing = unshadowedLightRatio(-passViewPos.z);
221222
vec3 lighting, specular;
222223
#if !PER_PIXEL_LIGHTING
223-
lighting = passLighting + shadowDiffuseLighting * shadowing;
224+
lighting = passDiffuseLighting * diffuseColor.xyz + passLighting;
225+
clampLightingResult(lighting);
226+
lighting += shadowDiffuseLighting * diffuseColor.xyz * shadowing;
224227
specular = passSpecular + shadowSpecularLighting * shadowing;
225228
#else
226229
#if @specularMap

files/shaders/compatibility/objects.vert

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ varying vec2 glossMapUV;
5353

5454
#if !PER_PIXEL_LIGHTING
5555
centroid varying vec3 passLighting;
56+
centroid varying vec3 passDiffuseLighting;
5657
centroid varying vec3 passSpecular;
5758
centroid varying vec3 shadowDiffuseLighting;
5859
centroid varying vec3 shadowSpecularLighting;
@@ -150,10 +151,11 @@ void main(void)
150151
#if !PER_PIXEL_LIGHTING
151152
vec3 diffuseLight, ambientLight, specularLight;
152153
doLighting(viewPos.xyz, viewNormal, gl_FrontMaterial.shininess, diffuseLight, ambientLight, specularLight, shadowDiffuseLighting, shadowSpecularLighting);
153-
passLighting = getDiffuseColor().xyz * diffuseLight + getAmbientColor().xyz * ambientLight + getEmissionColor().xyz * emissiveMult;
154+
passLighting = getAmbientColor().xyz * ambientLight + getEmissionColor().xyz * emissiveMult;
155+
passDiffuseLighting = diffuseLight;
154156
passSpecular = getSpecularColor().xyz * specularLight * specStrength;
155157
clampLightingResult(passLighting);
156-
shadowDiffuseLighting *= getDiffuseColor().xyz;
158+
clampLightingResult(passDiffuseLighting);
157159
shadowSpecularLighting *= getSpecularColor().xyz * specStrength;
158160
#endif
159161

0 commit comments

Comments
 (0)