summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-04-07 09:45:20 +0100
committerTofu Linden <tofu.linden@lindenlab.com>2010-04-07 09:45:20 +0100
commit09f2898df7956d3c6ad0a04af53e0e71b63b4bde (patch)
treedc62ad0048c4d56e7cf0e7cf687b74c131d9e08c
parent368d930b3fd80a180b3403337fdc2a7dba860a3f (diff)
tidy up ssreflections comments and structure a bit.
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl14
1 files changed, 8 insertions, 6 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
index 3f4425a0b2..158eef9319 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -298,18 +298,20 @@ void main()
// of the diffuse map. LOD would be better in that regard.
// The goal of the blur is to soften reflections in surfaces
// with low shinyness, and also to disguise our lameness.
- // ---------------------
- // ^ ^ ^ ^ ^
- // a . b o c . d check=0:avg(a,b) check=1:avg(c,d)
float checkerboard = floor(mod(tc.x+tc.y, 2.0)); // 0.0, 1.0
vec2 checkoffset = normalize(ref2d)*5.0*(1.0-spec.a)*(checkerboard-0.5);
ref2d += checkoffset;
ref2d += tc.xy; // use as offset from destination
- // get attributes from the 2D guess point
- float refdepth = texture2DRect(depthMap, ref2d).a;
- vec3 refpos = getPosition_d(ref2d, refdepth).xyz;
+ // Get attributes from the 2D guess point.
+ // We average two samples of diffuse (not of anything else) per
+ // pixel to try to reduce aliasing some more.
+ // ---------------------
+ // ^ ^ ^ ^ ^
+ // a . b o c . d check=0:avg(a,b) check=1:avg(c,d)
vec3 refcol = 0.5 * (texture2DRect(diffuseRect, ref2d).rgb +
texture2DRect(diffuseRect, ref2d + checkoffset*2.0).rgb);
+ float refdepth = texture2DRect(depthMap, ref2d).a;
+ vec3 refpos = getPosition_d(ref2d, refdepth).xyz;
vec3 refn = normalize(texture2DRect(normalMap, ref2d).rgb * 2.0 - 1.0);
// figure out how appropriate our guess actually was
float refapprop = max(0.0, dot(-refnorm, normalize(pos - refpos)));