diff options
author | Graham Madarasz <graham@lindenlab.com> | 2013-04-09 12:39:01 -0700 |
---|---|---|
committer | Graham Madarasz <graham@lindenlab.com> | 2013-04-09 12:39:01 -0700 |
commit | 991a3cf40eb22559f89808a87fdeda1d44eaaf8f (patch) | |
tree | 7ecdda17135130988843d04c278e85e0fb76845d /indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl | |
parent | 893bcf34f7daa432ce70224b4d30d3c22f9c80ad (diff) | |
parent | 76f36001e2e09a0a017bffedfe140b181677f590 (diff) |
Merge
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl | 13 |
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); |