1
0
Fork 0

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

This commit is contained in:
Thorsten Renk 2017-05-09 18:19:23 +03:00
parent d5b8ae9ccf
commit d7df75bff2

View file

@ -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 );
@ -584,11 +586,14 @@ void main (void)
vec3 pLMColor = streetlight_color;//vec3 (0.941, 0.682, 0.086);
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;
}