From e5d8163d643a47daba1f39cc208beac2fe541a3c Mon Sep 17 00:00:00 2001 From: Tomash Brechko Date: Wed, 27 Nov 2013 17:21:09 +0400 Subject: [PATCH] Ubershader: account for specular light component only once. Both files have "fragColor += Specular * nmap.a;" later in the source. The patch is suggested by Emilian Huminiuc. --- Shaders/ubershader-lightfield.frag | 4 +--- Shaders/ubershader.frag | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Shaders/ubershader-lightfield.frag b/Shaders/ubershader-lightfield.frag index 4646e430d..5a5d5ac12 100644 --- a/Shaders/ubershader-lightfield.frag +++ b/Shaders/ubershader-lightfield.frag @@ -253,7 +253,6 @@ void main (void) vec4 Specular = gl_FrontMaterial.specular * light_diffuse * pf; vec4 color = gl_Color + Diffuse * gl_FrontMaterial.diffuse; - color += Specular * gl_FrontMaterial.specular * nmap.a; color = clamp( color, 0.0, 1.0 ); //////////////////////////////////////////////////////////////////// @@ -278,11 +277,10 @@ void main (void) // add fringing fresnel and rainbow effects and modulate by reflection vec4 reflcolor = mix(reflection, rainbow, refl_rainbow * v); //vec4 reflcolor = reflection; - reflcolor += Specular * nmap.a; vec4 reflfrescolor = mix(reflcolor, fresnel, refl_fresnel * v); vec4 noisecolor = mix(reflfrescolor, noisevec, refl_noise); vec4 raincolor = vec4(noisecolor.rgb * reflFactor, 1.0); - raincolor += Specular * nmap.a; + raincolor += Specular; raincolor *= light_diffuse; mixedcolor = mix(texel, raincolor, reflFactor).rgb; } else { diff --git a/Shaders/ubershader.frag b/Shaders/ubershader.frag index 3a8beebae..1875d8f56 100644 --- a/Shaders/ubershader.frag +++ b/Shaders/ubershader.frag @@ -106,7 +106,6 @@ void main (void) vec4 Specular = gl_FrontMaterial.specular * gl_LightSource[0].diffuse * pf; vec4 color = gl_Color + Diffuse * gl_FrontMaterial.diffuse; - color += Specular * gl_FrontMaterial.specular * nmap.a; color = clamp( color, 0.0, 1.0 ); //////////////////////////////////////////////////////////////////// @@ -130,11 +129,10 @@ void main (void) // add fringing fresnel and rainbow effects and modulate by reflection vec4 reflcolor = mix(reflection, rainbow, refl_rainbow * v); - reflcolor += Specular * nmap.a; vec4 reflfrescolor = mix(reflcolor, fresnel, refl_fresnel * v); vec4 noisecolor = mix(reflfrescolor, noisevec, refl_noise); vec4 raincolor = vec4(noisecolor.rgb * reflFactor, 1.0); - raincolor += Specular * nmap.a; + raincolor += Specular; raincolor *= gl_LightSource[0].diffuse; mixedcolor = mix(texel, raincolor, reflFactor).rgb; } else {