summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1/deferred
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2013-02-04 09:38:06 -0500
committerOz Linden <oz@lindenlab.com>2013-02-04 09:38:06 -0500
commit68ec77127b158f0abffb6160eb7d870c85b278ad (patch)
treead43a05bb4a45449d27f4c077ef8ca653f35d7b9 /indra/newview/app_settings/shaders/class1/deferred
parent19233999edfd143d0e7f8e3743dc07455d206172 (diff)
parent7cc7ae873c5aeca9b5939176fb70677365e25395 (diff)
merge tonyas loop fixes
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl21
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl6
2 files changed, 16 insertions, 11 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);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
index 87cdf1026f..2ec3fe4a52 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -280,8 +280,8 @@ void main()
vec2 tc = vary_fragcoord.xy;
float depth = texture2DRect(depthMap, tc.xy).r;
vec3 pos = getPosition_d(tc, depth).xyz;
- vec3 norm = texture2DRect(normalMap, tc).xyz;
- norm = (norm.xyz-0.5)*2.0; // unpack norm
+ vec4 norm = texture2DRect(normalMap, tc);
+ norm.xyz = (norm.xyz-0.5)*2.0; // unpack norm
float da = max(dot(norm.xyz, sun_dir.xyz), 0.0);
@@ -315,7 +315,7 @@ void main()
//add environmentmap
vec3 env_vec = env_mat * refnormpersp;
col = mix(col.rgb, samplesRGB(textureCube(environmentMap, env_vec).rgb) * 2.2,
- max(spec.a-diffuse.a*2.0, 0.0));
+ max(norm.a-diffuse.a*2.0, 0.0));
}
col = atmosLighting(col);