diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl index e99329bbf2..27863b0095 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl @@ -54,6 +54,17 @@ uniform vec2 screen_res; uniform mat4 inv_proj; uniform vec4 viewport; +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 getPosition(vec2 pos_screen) { float depth = texture2DRect(depthMap, pos_screen.xy).r; @@ -84,7 +95,7 @@ void main() } vec3 norm = texture2DRect(normalMap, frag.xy).xyz; - norm = (norm.xyz-0.5)*2.0; // unpack norm + norm = decode_normal(norm.xy); // unpack norm float da = dot(norm, lv); if (da < 0.0) { |