summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-05-09 15:02:10 +0100
committerTofu Linden <tofu.linden@lindenlab.com>2010-05-09 15:02:10 +0100
commit940bca8ebc03d963d8384f07b4bea7c5484691a3 (patch)
tree890058e8315e803a0d2f740a9fe4bddcd53706f5 /indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl
parentccc50f752223fb96ee97690e50725d204c003f55 (diff)
Rejig deferred normal-map packing a little, to double its accuracy for free.
Diffstat (limited to 'indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl')
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl10
1 files changed, 6 insertions, 4 deletions
diff --git a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl
index 7325825d6d..66606233cd 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl
@@ -44,7 +44,8 @@ float getDepth(vec2 pos_screen)
void main()
{
- vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz*2.0-1.0;
+ vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz;
+ norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
float depth = getDepth(vary_fragcoord.xy);
vec3 ccol = texture2DRect(giLightMap, vary_fragcoord.xy).rgb;
@@ -56,9 +57,10 @@ void main()
for (int i = 0; i < kern_length; i++)
{
vec2 tc = vary_fragcoord.xy + kern[i].y*dlt;
- vec3 sampNorm = texture2DRect(normalMap, tc.xy).xyz*2.0-1.0;
-
- float d = dot(norm.xyz, sampNorm);
+ vec3 sampNorm = texture2DRect(normalMap, tc.xy).xyz;
+ sampNorm = vec3((sampNorm.xy-0.5)*2.0,sampNorm.z); // unpack norm
+
+ float d = dot(norm.xyz, sampNorm);
if (d > 0.5)
{