diff --git a/files/shaders/lighting.glsl b/files/shaders/lighting.glsl index 782d17d4e..67308379f 100644 --- a/files/shaders/lighting.glsl +++ b/files/shaders/lighting.glsl @@ -63,7 +63,7 @@ vec4 doLighting(vec3 viewPos, vec3 viewNormal, vec4 vertexColor, out vec3 shadow lightResult.xyz += gl_FrontMaterial.emission.xyz; #if @clamp - lightResult = clamp(lightResult, vec4(0.0, 0.0, 0.0, 0.0), vec4(1.0, 1.0, 1.0, 1.0)); + lightResult = clamp(lightResult, vec4(0.0), vec4(1.0)); #else lightResult = max(lightResult, 0.0); #endif diff --git a/files/shaders/objects_fragment.glsl b/files/shaders/objects_fragment.glsl index f9fc75237..ad2837b88 100644 --- a/files/shaders/objects_fragment.glsl +++ b/files/shaders/objects_fragment.glsl @@ -98,7 +98,7 @@ void main() #if @diffuseMap gl_FragData[0] = texture2D(diffuseMap, adjustedDiffuseUV); #else - gl_FragData[0] = vec4(1.0, 1.0, 1.0, 1.0); + gl_FragData[0] = vec4(1.0); #endif #if @detailMap @@ -117,7 +117,13 @@ void main() float shadowing = unshadowedLightRatio(); #if !PER_PIXEL_LIGHTING + +#if @clamp + gl_FragData[0] *= clamp(lighting + vec4(shadowDiffuseLighting * shadowing, 0), vec4(0.0), vec4(1.0)); +#else gl_FragData[0] *= lighting + vec4(shadowDiffuseLighting * shadowing, 0); +#endif + #else gl_FragData[0] *= doLighting(passViewPos, normalize(viewNormal), passColor, shadowing); #endif diff --git a/files/shaders/terrain_fragment.glsl b/files/shaders/terrain_fragment.glsl index c946777bb..10b268c9c 100644 --- a/files/shaders/terrain_fragment.glsl +++ b/files/shaders/terrain_fragment.glsl @@ -69,7 +69,13 @@ void main() float shadowing = unshadowedLightRatio(); #if !PER_PIXEL_LIGHTING + +#if @clamp + gl_FragData[0] *= clamp(lighting + vec4(shadowDiffuseLighting * shadowing, 0), vec4(0.0), vec4(1.0)); +#else gl_FragData[0] *= lighting + vec4(shadowDiffuseLighting * shadowing, 0); +#endif + #else gl_FragData[0] *= doLighting(passViewPos, normalize(viewNormal), passColor, shadowing); #endif diff --git a/files/shaders/water_fragment.glsl b/files/shaders/water_fragment.glsl index 9e6d5573f..b50e26869 100644 --- a/files/shaders/water_fragment.glsl +++ b/files/shaders/water_fragment.glsl @@ -170,7 +170,7 @@ void main(void) vec2 screenCoords = screenCoordsPassthrough.xy / screenCoordsPassthrough.z; screenCoords.y = (1.0-screenCoords.y); - vec2 nCoord = vec2(0.0,0.0); + vec2 nCoord = vec2(0.0); #define waterTimer osg_SimulationTime @@ -186,7 +186,7 @@ void main(void) if (rainIntensity > 0.01) rainRipple = rainCombined(position.xy / 1000.0,waterTimer) * clamp(rainIntensity,0.0,1.0); else - rainRipple = vec4(0.0,0.0,0.0,0.0); + rainRipple = vec4(0.0); vec3 rippleAdd = rainRipple.xyz * rainRipple.w * 10.0;