summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-04-02 16:03:20 +0100
committerTofu Linden <tofu.linden@lindenlab.com>2010-04-02 16:03:20 +0100
commite9d8427d0542ebd147ad9680deba61e283f032ac (patch)
tree6fbab149eb55a08a28e7a86a3ba157b330558efb /indra/newview/app_settings
parentf9256879c77eca885b478267d9ba3baf3354bfa1 (diff)
apply ssreflection changes to class2 and class3 too.
Diffstat (limited to 'indra/newview/app_settings')
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl15
2 files changed, 19 insertions, 9 deletions
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index 922a07c306..d6fbae7b22 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -281,12 +281,13 @@ void main()
{
// the old infinite-sky shiny reflection
//
- vec3 refnorm = normalize(reflect(pos.xyz, norm.xyz));
- float sa = dot(refnorm, vary_light.xyz);
+ vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
+ float sa = dot(refnormpersp, vary_light.xyz);
vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*texture2D(lightFunc, vec2(sa, spec.a)).a;
// screen-space cheap fakey reflection map
//
+ vec3 refnorm = normalize(reflect(vec3(0,0,-1), norm.xyz));
depth -= 0.5; // unbias depth
// first figure out where we'll make our 2D guess from
vec2 ref2d = (0.25 * screen_res.y) * (refnorm.xy) * abs(refnorm.z) / depth;
@@ -311,9 +312,13 @@ 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, lightnorm.xyz), 0.0), refshad);
+ // reflect light direction to increase the illusion that
+ // these are reflections.
+ vec3 reflight = reflect(lightnorm.xyz, norm.xyz);
+ float reflit = max(dot(refn, reflight.xyz), 0.0);
// apply sun color to guess-point, dampen according to inappropriateness of guess
- vec3 refprod = (vary_SunlitColor*reflit) * refcol.rgb * refapprop;
+ float refmod = min(refapprop, reflit);
+ vec3 refprod = vary_SunlitColor * refcol.rgb * refmod;
vec3 ssshiny = (refprod * spec.a);
// add the two types of shiny together
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
index ddd69befc3..ecfd9bef52 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
@@ -284,12 +284,13 @@ void main()
{
// the old infinite-sky shiny reflection
//
- vec3 refnorm = normalize(reflect(pos.xyz, norm.xyz));
- float sa = dot(refnorm, vary_light.xyz);
+ vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
+ float sa = dot(refnormpersp, vary_light.xyz);
vec3 dumbshiny = vary_SunlitColor*scol*texture2D(lightFunc, vec2(sa, spec.a)).a;
// screen-space cheap fakey reflection map
//
+ vec3 refnorm = normalize(reflect(vec3(0,0,-1), norm.xyz));
depth -= 0.5; // unbias depth
// first figure out where we'll make our 2D guess from
vec2 ref2d = (0.25 * screen_res.y) * (refnorm.xy) * abs(refnorm.z) / depth;
@@ -313,10 +314,14 @@ void main()
// darken reflections from points which face away from the reflected ray - our guess was a back-face
//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, lightnorm.xyz), 0.0), refshad);
+ // get appropriate light strength for guess-point.
+ // reflect light direction to increase the illusion that
+ // these are reflections.
+ vec3 reflight = reflect(lightnorm.xyz, norm.xyz);
+ float reflit = max(dot(refn, reflight.xyz), 0.0);
// apply sun color to guess-point, dampen according to inappropriateness of guess
- vec3 refprod = (vary_SunlitColor*reflit) * refcol.rgb * refapprop;
+ float refmod = min(refapprop, reflit);
+ vec3 refprod = vary_SunlitColor * refcol.rgb * refmod;
vec3 ssshiny = (refprod * spec.a);
// add the two types of shiny together