diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class3/deferred/deferredUtil.glsl')
-rw-r--r-- | indra/newview/app_settings/shaders/class3/deferred/deferredUtil.glsl | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/indra/newview/app_settings/shaders/class3/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class3/deferred/deferredUtil.glsl index cccd01e0d7..e27bbce094 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/deferredUtil.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/deferredUtil.glsl @@ -1,5 +1,5 @@ /** - * @file class3/deferred/deferredUtil.glsl + * @file class1/deferred/deferredUtil.glsl * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code @@ -29,8 +29,6 @@ uniform sampler2DRect depthMap; uniform mat4 inv_proj; uniform vec2 screen_res; -vec3 decode_normal(vec2 enc); - vec2 getScreenCoordinate(vec2 screenpos) { vec2 sc = screenpos.xy * 2.0; @@ -43,8 +41,14 @@ vec2 getScreenCoordinate(vec2 screenpos) vec3 getNorm(vec2 screenpos) { - vec2 enc_norm = texture2DRect(normalMap, screenpos.xy).xy; - return decode_normal(enc_norm); + vec2 enc = texture2DRect(normalMap, screenpos.xy).xy; + 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; } float getDepth(vec2 pos_screen) |