1
0
Fork 0

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.
This commit is contained in:
Tomash Brechko 2013-11-27 17:21:09 +04:00 committed by Vivian Meazza
parent f92a3cd08e
commit e5d8163d64
2 changed files with 2 additions and 6 deletions

View file

@ -253,7 +253,6 @@ void main (void)
vec4 Specular = gl_FrontMaterial.specular * light_diffuse * pf; vec4 Specular = gl_FrontMaterial.specular * light_diffuse * pf;
vec4 color = gl_Color + Diffuse * gl_FrontMaterial.diffuse; vec4 color = gl_Color + Diffuse * gl_FrontMaterial.diffuse;
color += Specular * gl_FrontMaterial.specular * nmap.a;
color = clamp( color, 0.0, 1.0 ); color = clamp( color, 0.0, 1.0 );
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -278,11 +277,10 @@ void main (void)
// add fringing fresnel and rainbow effects and modulate by reflection // add fringing fresnel and rainbow effects and modulate by reflection
vec4 reflcolor = mix(reflection, rainbow, refl_rainbow * v); vec4 reflcolor = mix(reflection, rainbow, refl_rainbow * v);
//vec4 reflcolor = reflection; //vec4 reflcolor = reflection;
reflcolor += Specular * nmap.a;
vec4 reflfrescolor = mix(reflcolor, fresnel, refl_fresnel * v); vec4 reflfrescolor = mix(reflcolor, fresnel, refl_fresnel * v);
vec4 noisecolor = mix(reflfrescolor, noisevec, refl_noise); vec4 noisecolor = mix(reflfrescolor, noisevec, refl_noise);
vec4 raincolor = vec4(noisecolor.rgb * reflFactor, 1.0); vec4 raincolor = vec4(noisecolor.rgb * reflFactor, 1.0);
raincolor += Specular * nmap.a; raincolor += Specular;
raincolor *= light_diffuse; raincolor *= light_diffuse;
mixedcolor = mix(texel, raincolor, reflFactor).rgb; mixedcolor = mix(texel, raincolor, reflFactor).rgb;
} else { } else {

View file

@ -106,7 +106,6 @@ void main (void)
vec4 Specular = gl_FrontMaterial.specular * gl_LightSource[0].diffuse * pf; vec4 Specular = gl_FrontMaterial.specular * gl_LightSource[0].diffuse * pf;
vec4 color = gl_Color + Diffuse * gl_FrontMaterial.diffuse; vec4 color = gl_Color + Diffuse * gl_FrontMaterial.diffuse;
color += Specular * gl_FrontMaterial.specular * nmap.a;
color = clamp( color, 0.0, 1.0 ); color = clamp( color, 0.0, 1.0 );
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -130,11 +129,10 @@ void main (void)
// add fringing fresnel and rainbow effects and modulate by reflection // add fringing fresnel and rainbow effects and modulate by reflection
vec4 reflcolor = mix(reflection, rainbow, refl_rainbow * v); vec4 reflcolor = mix(reflection, rainbow, refl_rainbow * v);
reflcolor += Specular * nmap.a;
vec4 reflfrescolor = mix(reflcolor, fresnel, refl_fresnel * v); vec4 reflfrescolor = mix(reflcolor, fresnel, refl_fresnel * v);
vec4 noisecolor = mix(reflfrescolor, noisevec, refl_noise); vec4 noisecolor = mix(reflfrescolor, noisevec, refl_noise);
vec4 raincolor = vec4(noisecolor.rgb * reflFactor, 1.0); vec4 raincolor = vec4(noisecolor.rgb * reflFactor, 1.0);
raincolor += Specular * nmap.a; raincolor += Specular;
raincolor *= gl_LightSource[0].diffuse; raincolor *= gl_LightSource[0].diffuse;
mixedcolor = mix(texel, raincolor, reflFactor).rgb; mixedcolor = mix(texel, raincolor, reflFactor).rgb;
} else { } else {