diff options
author | Cinder Roxley <cinder.roxley@phoenixviewer.com> | 2013-06-27 21:22:44 -0600 |
---|---|---|
committer | Cinder Roxley <cinder.roxley@phoenixviewer.com> | 2013-06-27 21:22:44 -0600 |
commit | 7e0bc07e5cd72cfb7c55c964a73d9d8c9e9e5988 (patch) | |
tree | e847d23a8642323ef63df22a9426f1524d4da796 /indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl | |
parent | 4f7b8a7e861ee25f1e0f7b0df2e9c8372254f46d (diff) | |
parent | 6060e5e46acbeb20a301070a0fd0efea029d33d0 (diff) |
Merged lindenlab/viewer-release into default
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl')
-rwxr-xr-x | indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl index bfd9b9b3eb..bcccbf77d2 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl @@ -34,6 +34,12 @@ uniform sampler2D diffuseMap; VARYING vec3 vary_normal; VARYING vec2 vary_texcoord0; +vec2 encode_normal(vec3 n) +{ + float f = sqrt(8 * n.z + 8); + return n.xy / f + 0.5; +} + void main() { vec4 diff = texture2D(diffuseMap, vary_texcoord0.xy); @@ -46,6 +52,6 @@ void main() frag_data[0] = vec4(diff.rgb, 0.0); frag_data[1] = vec4(0,0,0,0); vec3 nvn = normalize(vary_normal); - frag_data[2] = vec4(nvn.xyz * 0.5 + 0.5, 0.0); + frag_data[2] = vec4(encode_normal(nvn.xyz), 0.0, 0.0); } |