summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2013-06-05 12:31:55 -0500
committerDave Parks <davep@lindenlab.com>2013-06-05 12:31:55 -0500
commite454c3d48cbefd37de0564a5ba85e0d127850456 (patch)
tree1948302aa86998a398e5c0f10d20960693e8f972
parentda294b79c052ff503b66a3383693beb8a3dc2173 (diff)
NORSPEC-238, NORSPEC-225 Fix for specular map alpha channel being improperly used and glossiness bludgeoning environment intensity.
Reviewed/written by Graham.
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialF.glsl9
1 files changed, 5 insertions, 4 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
index bb8d26c9dc..9c79f3a51f 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
@@ -419,7 +419,7 @@ VARYING vec2 vary_texcoord2;
#endif
uniform float env_intensity;
-uniform vec4 specular_color;
+uniform vec4 specular_color; // specular color RGB and specular exponent (glossiness) in alpha
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_MASK)
uniform float minimum_alpha;
@@ -461,9 +461,10 @@ void main()
#endif
#if HAS_SPECULAR_MAP
- vec4 spec = texture2D(specularMap, vary_texcoord2.xy)*specular_color;
+ vec4 spec = texture2D(specularMap, vary_texcoord2.xy);
+ spec.rgb *= specular_color.rgb;
#else
- vec4 spec = specular_color;
+ vec4 spec = vec4(specular_color.rgb, 1.0);
#endif
#if HAS_NORMAL_MAP
@@ -495,7 +496,7 @@ void main()
//final_color.rgb *= 1 - spec.a * env_intensity;
//final_specular.rgb *= specular_color.rgb;
- vec4 final_normal = vec4(encode_normal(normalize(tnorm)), env_intensity, 0.0);
+ vec4 final_normal = vec4(encode_normal(normalize(tnorm)), env_intensity * spec.a, 0.0);
final_specular.a = specular_color.a * norm.a;
#else
vec4 final_normal = vec4(encode_normal(normalize(tnorm)), env_intensity, 0.0);