summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-03-26 09:07:08 +0000
committerTofu Linden <tofu.linden@lindenlab.com>2010-03-26 09:07:08 +0000
commit42b7edb0f1d7e18fae87aa67cbcbca06e8ee1969 (patch)
tree3d107d961a6ce7f6a41e732318b8dc1f19af2169 /indra
parent8bf1ade40d3aa38fc2d39b2a8232eb4d9ad909bd (diff)
screen-space reflections: remember to unbias the value from the depth map. don't use varying version of lightnorm for lighting the reflection-guess-point.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl3
3 files changed, 6 insertions, 3 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
index 7d57eaa13d..c78d7ece7e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -288,6 +288,7 @@ void main()
// screen-space cheap fakey reflection map
//
+ depth -= 0.5; // unbias depth
// first figure out where we'll make our 2D guess from
vec2 ref2d = tc.xy + (0.5 * screen_res.y) * (refnorm.xy) * abs(refnorm.z) / depth;
// get attributes from the 2D guess point
@@ -301,7 +302,7 @@ void main()
//refapprop *= step(dot(refnorm, refn), 0.0);
refapprop = min(refapprop, max(0.0, -dot(refnorm, refn))); // more conservative variant
// get appropriate light strength for guess-point
- float reflit = max(dot(refn, vary_light.xyz), 0.0);
+ float reflit = max(dot(refn, lightnorm.xyz), 0.0);
// apply sun color to guess-point, dampen according to inappropriateness of guess
vec3 refprod = (vary_SunlitColor*reflit) * refcol.rgb * refapprop;
vec3 ssshiny = (refprod * spec.a);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index c5530c5f59..9305d77ddb 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -287,6 +287,7 @@ void main()
// screen-space cheap fakey reflection map
//
+ depth -= 0.5; // unbias depth
// first figure out where we'll make our 2D guess from
vec2 ref2d = tc.xy + (0.5 * screen_res.y) * (refnorm.xy) * abs(refnorm.z) / depth;
// get attributes from the 2D guess point
@@ -301,7 +302,7 @@ void main()
//refapprop *= step(dot(refnorm, refn), 0.0);
refapprop = min(refapprop, max(0.0, -dot(refnorm, refn))); // more conservative variant
// get appropriate light strength for guess-point
- float reflit = min(max(dot(refn, vary_light.xyz), 0.0), refshad);
+ float reflit = min(max(dot(refn, lightnorm.xyz), 0.0), refshad);
// apply sun color to guess-point, dampen according to inappropriateness of guess
vec3 refprod = (vary_SunlitColor*reflit) * refcol.rgb * refapprop;
vec3 ssshiny = (refprod * spec.a);
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
index 265fb437ec..262b34ede7 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
@@ -290,6 +290,7 @@ void main()
// screen-space cheap fakey reflection map
//
+ depth -= 0.5; // unbias depth
// first figure out where we'll make our 2D guess from
vec2 ref2d = tc.xy + (0.5 * screen_res.y) * (refnorm.xy) * abs(refnorm.z) / depth;
// get attributes from the 2D guess point
@@ -304,7 +305,7 @@ void main()
//refapprop *= step(dot(refnorm, refn), 0.0);
refapprop = min(refapprop, max(0.0, -dot(refnorm, refn))); // more conservative variant
// get appropriate light strength for guess-point
- float reflit = min(max(dot(refn, vary_light.xyz), 0.0), refshad);
+ float reflit = min(max(dot(refn, lightnorm.xyz), 0.0), refshad);
// apply sun color to guess-point, dampen according to inappropriateness of guess
vec3 refprod = (vary_SunlitColor*reflit) * refcol.rgb * refapprop;
vec3 ssshiny = (refprod * spec.a);