diff options
author | graham linden <graham@lindenlab.com> | 2013-04-09 12:18:05 -0700 |
---|---|---|
committer | graham linden <graham@lindenlab.com> | 2013-04-09 12:18:05 -0700 |
commit | 76f36001e2e09a0a017bffedfe140b181677f590 (patch) | |
tree | 6f91d6fd81064cf6a840f46209c4aa1789d89aaf /indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl | |
parent | 74712b47dfec67e014a4f7e0aca1bebcd15ea4e7 (diff) | |
parent | 2a220ca9eb22f953073c6396167dbd48648fe5f9 (diff) |
Merged lindenlab/viewer-development-materials into default
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl index 2f18e1a13d..d7f0ab6d8e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl @@ -70,6 +70,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); @@ -146,7 +157,7 @@ void main() } vec3 norm = texture2DRect(normalMap, frag.xy).xyz; - norm = vec3((norm.xy-0.5)*2.0, norm.z); + norm = decode_normal(norm.xy); norm = normalize(norm); float l_dist = -dot(lv, proj_n); |