summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
diff options
context:
space:
mode:
authorGraham Madarasz <graham@lindenlab.com>2013-06-09 20:55:02 -0700
committerGraham Madarasz <graham@lindenlab.com>2013-06-09 20:55:02 -0700
commit33a2608da5a85b01acbfcced10128a2c42760928 (patch)
tree5df902a8125c730f4f970eefb1ceedc7a7c5f853 /indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
parent75c4b50f88ead9f9a40e4154a9cf75621b6a1002 (diff)
NORSPEC-246 fix issues with normal encoding on precision-deprived hardware and remove haxors
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl')
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl16
1 files changed, 6 insertions, 10 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
index e8279241d1..d071801e2d 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
@@ -67,20 +67,16 @@ vec4 getPosition(vec2 pos_screen)
#ifdef SINGLE_FP_ONLY
vec2 encode_normal(vec3 n)
{
- float f = sqrt(2 * n.z + 2);
- return (n.xy / vec2(f)) + vec2(0.5f);
+ vec2 sn;
+ sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f);
}
vec3 decode_normal (vec2 enc)
{
- vec2 fenc = enc - 0.5f;
- float f = dot(fenc,fenc);
- f = clamp(f,0.0f,1.0f);
- float g = sqrt(1-f);
- vec3 n;
- n.xy = fenc*g;
- n.z = 1.0f - (f * 0.5f);
- return normalize(n);
+ vec3 n;
+ n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f);
+ n.z = sqrt(1.0f - dot(n.xy,n.xy));
+ return n;
}
#else
vec2 encode_normal(vec3 n)