summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
diff options
context:
space:
mode:
authorGilbert Gonzales <gilbert@lindenlab.com>2013-06-20 16:40:43 -0700
committerGilbert Gonzales <gilbert@lindenlab.com>2013-06-20 16:40:43 -0700
commit988eae369882f57eeb4bca893dcc2c46eb773ec7 (patch)
tree8518e405fceeff8a0593329c1a0d335a30b79031 /indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
parent50bb863be1c0e3528fd850aac812fc6196a7c4fc (diff)
parent7da4c651911743707c0cc7cd4bebdcefb52eb379 (diff)
merge
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred/waterF.glsl')
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/waterF.glsl8
1 files changed, 7 insertions, 1 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
index 1ae006bc8a..daa2fb390a 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
@@ -67,6 +67,12 @@ VARYING vec4 littleWave;
VARYING vec4 view;
VARYING vec4 vary_position;
+vec2 encode_normal(vec3 n)
+{
+ float f = sqrt(8 * n.z + 8);
+ return n.xy / f + 0.5;
+}
+
void main()
{
vec4 color;
@@ -161,5 +167,5 @@ void main()
frag_data[0] = vec4(color.rgb, 0.5); // diffuse
frag_data[1] = vec4(0.5,0.5,0.5, 0.95); // speccolor*spec, spec
- frag_data[2] = vec4(screenspacewavef.xyz*0.5+0.5, screenspacewavef.z*0.5); // normalxyz, displace
+ frag_data[2] = vec4(encode_normal(screenspacewavef), 0.0, 0.0); // normalxyz, displace
}