From d7df75bff2ff9037b1713cc9cfe1170c8c2c0425 Mon Sep 17 00:00:00 2001 From: Thorsten Renk Date: Tue, 9 May 2017 18:19:23 +0300 Subject: [PATCH] ALS road shader renders no lightmap when diffuse material red is zero, apply color correction for car headlights to avoid blending with base lightmap color --- Shaders/road-ALS-ultra.frag | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Shaders/road-ALS-ultra.frag b/Shaders/road-ALS-ultra.frag index b907818c8..bc36bd6c6 100644 --- a/Shaders/road-ALS-ultra.frag +++ b/Shaders/road-ALS-ultra.frag @@ -457,7 +457,9 @@ void main (void) Specular+= gl_FrontMaterial.specular * pow(max(0.0,-dot(N,normalize(vertVec))),gl_FrontMaterial.shininess) * vec4(secondary_light,1.0); //vec4 color = gl_Color + Diffuse * gl_FrontMaterial.diffuse; - vec4 color = Diffuse * gl_FrontMaterial.diffuse; + vec4 color = Diffuse;// * gl_FrontMaterial.diffuse; + + color = clamp( color, 0.0, 1.0 ); @@ -580,6 +582,7 @@ void main (void) + @@ -589,6 +592,8 @@ void main (void) float pLMIntensity = smoothstep(0.0, 0.4, roadCoords.s) * (1.0 - smoothstep(0.6, 1.0, roadCoords.s)); pLMIntensity = 0.5 * rtype_base_illumination + 0.1 * max(0.0,sin(4.0 * roadCoords.t)) * streetlight_factor; + if (gl_FrontMaterial.diffuse.r == 0.0) {pLMIntensity =0.0;} + pLMColor *= pLMIntensity; if (road_traffic_enabled == 1) @@ -604,10 +609,12 @@ void main (void) pCLColor = pCLColor *= pCLIntensity; - pLMColor = pLMColor + pCLColor; + pLMColor = max(pLMColor,pCLColor); } - fragColor.rgb = max(fragColor.rgb, pLMColor * gl_FrontMaterial.diffuse.rgb * smoothstep(0.0, 1.0, mixedcolor*.5 + pLMColor*.5)); + //fragColor.rgb = max(fragColor.rgb, pLMColor * gl_FrontMaterial.diffuse.rgb * smoothstep(0.0, 1.0, mixedcolor*.5 + pLMColor*.5)); + + fragColor.rgb = max(fragColor.rgb, pLMColor * smoothstep(0.0, 1.0, mixedcolor*.5 + pLMColor*.5)); @@ -760,5 +767,12 @@ void main (void) fragColor.rgb = filter_combined(fragColor.rgb); //gl_FragColor = vec4 (1.0, 0.0, 0.0,1.0); + + + + + + gl_FragColor = fragColor; + }