diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl index 23c4ea2fff..6e5cc69e39 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl @@ -31,6 +31,9 @@ out vec4 frag_data[3]; uniform sampler2D diffuseMap; uniform sampler2D bumpMap; +uniform sampler2D specularMap; +uniform float env_intensity; +uniform vec4 specular_color; VARYING vec3 vary_mat0; VARYING vec3 vary_mat1; @@ -42,15 +45,17 @@ VARYING vec2 vary_texcoord0; void main() { vec3 col = vertex_color.rgb * texture2D(diffuseMap, vary_texcoord0.xy).rgb; - vec3 norm = texture2D(bumpMap, vary_texcoord0.xy).rgb * 2.0 - 1.0; + vec4 spec = texture2D(specularMap, vary_texcoord0.xy); + vec4 norm = texture2D(bumpMap, vary_texcoord0.xy); + norm.xyz = norm.xyz * 2 - 1; - vec3 tnorm = vec3(dot(norm,vary_mat0), - dot(norm,vary_mat1), - dot(norm,vary_mat2)); - - frag_data[0] = vec4(col, 0.0); - frag_data[1] = vertex_color.aaaa; // spec + vec3 tnorm = vec3(dot(norm.xyz,vary_mat0), + dot(norm.xyz,vary_mat1), + dot(norm.xyz,vary_mat2)); + + frag_data[0] = vec4(col * (1 - spec.a * env_intensity), 0); + frag_data[1] = vec4(spec.xyz * specular_color.xyz, specular_color.a * norm.a); // spec //frag_data[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested vec3 nvn = normalize(tnorm); - frag_data[2] = vec4(nvn.xyz * 0.5 + 0.5, 0.0); + frag_data[2] = vec4(nvn.xyz * 0.5 + 0.5, spec.a * env_intensity); } |