summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
diff options
context:
space:
mode:
authorgraham linden <graham@lindenlab.com>2013-04-09 12:18:05 -0700
committergraham linden <graham@lindenlab.com>2013-04-09 12:18:05 -0700
commit76f36001e2e09a0a017bffedfe140b181677f590 (patch)
tree6f91d6fd81064cf6a840f46209c4aa1789d89aaf /indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
parent74712b47dfec67e014a4f7e0aca1bebcd15ea4e7 (diff)
parent2a220ca9eb22f953073c6396167dbd48648fe5f9 (diff)
Merged lindenlab/viewer-development-materials into default
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl13
1 files changed, 12 insertions, 1 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
index 09d23db096..9746218ea6 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
@@ -67,6 +67,17 @@ uniform vec2 screen_res;
uniform mat4 inv_proj;
+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;
+}
+
vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
{
vec4 ret = texture2DLod(projectionMap, tc, lod);
@@ -143,7 +154,7 @@ void main()
}
vec3 norm = texture2DRect(normalMap, frag.xy).xyz;
- norm = norm = (norm.xyz-0.5)*2.0;
+ norm = decode_normal(norm.xy);
norm = normalize(norm);
float l_dist = -dot(lv, proj_n);