From 27fbf5efc9192813e5109443c60bfc26f99716ee Mon Sep 17 00:00:00 2001 From: Geenz Date: Tue, 9 Apr 2013 11:46:52 -0400 Subject: Re-added RGB10_A2 normal buffer, this time encoded with a sphere map transform so we can store the environment intensity in the blue channel. --- .../app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl') diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl index c1fa9e4aac..7930b5d18b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl @@ -37,6 +37,12 @@ VARYING vec3 vary_normal; VARYING vec4 vertex_color; 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 col = texture2D(diffuseMap, vary_texcoord0.xy) * vertex_color; @@ -49,6 +55,6 @@ void main() frag_data[0] = vec4(col.rgb, 0.0); frag_data[1] = vec4(0,0,0,0); // spec 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); } -- cgit v1.2.3