diff options
author | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-06-20 16:40:43 -0700 |
---|---|---|
committer | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-06-20 16:40:43 -0700 |
commit | 988eae369882f57eeb4bca893dcc2c46eb773ec7 (patch) | |
tree | 8518e405fceeff8a0593329c1a0d335a30b79031 /indra/newview/app_settings/shaders/class1/deferred/treeF.glsl | |
parent | 50bb863be1c0e3528fd850aac812fc6196a7c4fc (diff) | |
parent | 7da4c651911743707c0cc7cd4bebdcefb52eb379 (diff) |
merge
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred/treeF.glsl')
-rwxr-xr-x | indra/newview/app_settings/shaders/class1/deferred/treeF.glsl | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl index da253846ef..808750496f 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl @@ -37,6 +37,12 @@ VARYING vec2 vary_texcoord0; uniform float minimum_alpha; +vec2 encode_normal(vec3 n) +{ + float f = sqrt(8 * n.z + 8); + return n.xy / f + 0.5; +} + void main() { vec4 col = texture2D(diffuseMap, vary_texcoord0.xy); @@ -48,5 +54,5 @@ void main() frag_data[0] = vec4(vertex_color.rgb*col.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); } |