summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class2
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-03-07 11:34:31 +0000
committerTofu Linden <tofu.linden@lindenlab.com>2010-03-07 11:34:31 +0000
commit18432d1bc5bdab244b6054af73c5e4cf3d855164 (patch)
tree5149c4c6be95cf60e1db2feae57d630441a99894 /indra/newview/app_settings/shaders/class2
parent44289977dc36f0a83dd5734d506240b278774efc (diff)
Add a touch of fakey ripple to shadows on the surface of water, as if the water has depth. Using 4th component of the normal map to encode a position displacement (along the normal) in the class2 shadow lookup.
Diffstat (limited to 'indra/newview/app_settings/shaders/class2')
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl8
1 files changed, 5 insertions, 3 deletions
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
index 74a948f584..50502dbdad 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
@@ -159,7 +159,9 @@ void main()
vec4 pos = getPosition(pos_screen);
- vec3 norm = texture2DRect(normalMap, pos_screen).xyz*2.0-1.0;
+ vec4 nmap4 = texture2DRect(normalMap, pos_screen);
+ float displace = nmap4.w;
+ vec3 norm = nmap4.xyz*2.0-1.0;
/*if (pos.z == 0.0) // do nothing for sky *FIX: REMOVE THIS IF/WHEN THE POSITION MAP IS BEING USED AS A STENCIL
{
@@ -168,9 +170,9 @@ void main()
}*/
float shadow = 1.0;
- float dp_directional_light = max(0.0, dot(norm, vary_light.xyz));
+ float dp_directional_light = max(0.0, dot(norm, vary_light.xyz));
- vec4 spos = vec4(pos.xyz + vary_light.xyz * (1.0-dp_directional_light)*shadow_offset, 1.0);
+ vec4 spos = vec4(pos.xyz + displace*norm + vary_light.xyz * (1.0-dp_directional_light)*shadow_offset, 1.0);
if (spos.z > -shadow_clip.w)
{