summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorgraham linden <graham@lindenlab.com>2013-05-08 09:16:19 -0700
committergraham linden <graham@lindenlab.com>2013-05-08 09:16:19 -0700
commit7b1acb186a7025b0464c21c88c0956439c98f3d2 (patch)
treeb01a9c0c617104e4b69a7f5334377cd62d47fc4b /indra
parent19c755b8512bb2e7ce36924b30c1ed380397a8f4 (diff)
parent21ba1e9c1e8afeb1b3cf67462f6e16ff8f6ae91a (diff)
Merged lindenlab/viewer-development-materials into default
Diffstat (limited to 'indra')
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl14
-rwxr-xr-xindra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl13
-rwxr-xr-xindra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl13
3 files changed, 23 insertions, 17 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
index f400eb7a5b..c030c23515 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
@@ -64,11 +64,23 @@ vec4 getPosition(vec2 pos_screen)
return pos;
}
+vec3 decode_normal (vec2 enc)
+{
+ vec2 fenc = enc*4-2;
+ float f = dot(fenc,fenc);
+ float g = sqrt(1-f/4);
+ vec3 n;
+ n.xy = fenc*g;
+ n.z = 1-f/2;
+ return n;
+}
+
void main()
{
vec2 tc = vary_fragcoord.xy;
vec3 norm = texture2DRect(normalMap, tc).xyz;
- norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
+ norm = decode_normal(norm.xy); // unpack norm
+
vec3 pos = getPosition(tc).xyz;
vec4 ccol = texture2DRect(lightMap, tc).rgba;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
index 1e835ae49e..fa2f415e15 100755
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
@@ -136,11 +136,9 @@ void main()
vec4 pos = getPosition(pos_screen);
- vec4 nmap4 = texture2DRect(normalMap, pos_screen);
- nmap4 = vec4(decode_normal(nmap4.xy),nmap4.w); // unpack norm
- float displace = nmap4.w;
- vec3 norm = nmap4.xyz;
-
+ vec3 norm = texture2DRect(normalMap, pos_screen).xyz;
+ norm = decode_normal(norm.xy); // unpack norm
+
/*if (pos.z == 0.0) // do nothing for sky *FIX: REMOVE THIS IF/WHEN THE POSITION MAP IS BEING USED AS A STENCIL
{
frag_color = vec4(0.0); // doesn't matter
@@ -149,9 +147,8 @@ void main()
float shadow = 0.0;
float dp_directional_light = max(0.0, dot(norm, sun_dir.xyz));
- dp_directional_light = pow(dp_directional_light, 0.7);
-
- vec3 shadow_pos = pos.xyz + displace*norm;
+
+ vec3 shadow_pos = pos.xyz;
vec3 offset = sun_dir.xyz * (1.0-dp_directional_light);
vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
index a995e9cba1..847fea6c08 100755
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
@@ -197,11 +197,9 @@ void main()
vec4 pos = getPosition(pos_screen);
- vec4 nmap4 = texture2DRect(normalMap, pos_screen);
- nmap4 = vec4(decode_normal(nmap4.xy),nmap4.w); // unpack norm
- float displace = nmap4.w;
- vec3 norm = nmap4.xyz;
-
+ vec3 norm = texture2DRect(normalMap, pos_screen).xyz;
+ norm = decode_normal(norm.xy); // unpack norm
+
/*if (pos.z == 0.0) // do nothing for sky *FIX: REMOVE THIS IF/WHEN THE POSITION MAP IS BEING USED AS A STENCIL
{
frag_color = vec4(0.0); // doesn't matter
@@ -210,9 +208,8 @@ void main()
float shadow = 0.0;
float dp_directional_light = max(0.0, dot(norm, sun_dir.xyz));
- dp_directional_light = pow(dp_directional_light, 0.7);
-
- vec3 shadow_pos = pos.xyz + displace*norm;
+
+ vec3 shadow_pos = pos.xyz;
vec3 offset = sun_dir.xyz * (1.0-dp_directional_light);
vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0);