summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2023-03-27 13:07:31 -0500
committerDave Parks <davep@lindenlab.com>2023-03-27 13:07:31 -0500
commit960715efc1cda86f924acc50f2a322e9403abd14 (patch)
treedcd8ce9fe6fb88bc433f540c43016f04515d9b21
parent5882215a6d53f5a20779be78805392f4e38c3669 (diff)
SL-19477 Remove angular attenuation from sphere probe weight to fix harsh indirect lighting. Minor incidental decruft.
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl18
2 files changed, 6 insertions, 14 deletions
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
index ef35bf3fd7..e7322c14fb 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
@@ -79,7 +79,6 @@ vec3 srgb_to_linear(vec3 c);
vec3 linear_to_srgb(vec3 c);
vec2 encode_normal (vec3 n);
-vec3 scaleSoftClipFragLinear(vec3 l);
vec3 atmosFragLightingLinear(vec3 light, vec3 additive, vec3 atten);
void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive);
@@ -279,7 +278,6 @@ void main()
color.rgb = linear_to_srgb(color.rgb);
color.rgb = atmosFragLightingLinear(color.rgb, additive, atten);
- color.rgb = scaleSoftClipFragLinear(color.rgb);
color.rgb = srgb_to_linear(color.rgb);
vec4 light = vec4(0,0,0,0);
diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
index bd06a680f5..1f4833ea21 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
@@ -95,6 +95,7 @@ bool shouldSampleProbe(int i, vec3 pos)
return false;
}
+ // never allow automatic probes to encroach on box probes
sample_automatic = false;
}
else
@@ -429,25 +430,19 @@ void boxIntersectDebug(vec3 origin, vec3 pos, int i, inout vec4 col)
// dir - normal to be weighted
// origin - center of sphere probe
// r - radius of probe influence volume
-// min_da - minimum angular attenuation coefficient
// i - index of probe in refSphere
// dw - distance weight
-float sphereWeight(vec3 pos, vec3 dir, vec3 origin, float r, float min_da, int i, out float dw)
+float sphereWeight(vec3 pos, vec3 dir, vec3 origin, float r, int i, out float dw)
{
float r1 = r * 0.5; // 50% of radius (outer sphere to start interpolating down)
vec3 delta = pos.xyz - origin;
float d2 = max(length(delta), 0.001);
- float r2 = r1; //r1 * r1;
-
- //float atten = 1.0 - max(d2 - r2, 0.0) / max((rr - r2), 0.001);
- float atten = 1.0 - max(d2 - r2, 0.0) / max((r - r2), 0.001);
+ float atten = 1.0 - max(d2 - r1, 0.0) / max((r - r1), 0.001);
float w = 1.0 / d2;
dw = w * atten * max(r, 1.0)*4;
- atten *= max(dot(normalize(-delta), dir), min_da);
-
w *= atten;
return w;
@@ -484,7 +479,7 @@ vec3 tapRefMap(vec3 pos, vec3 dir, out float w, out float dw, float lod, vec3 c,
refIndex[i].w < 1 ? 4096.0*4096.0 : // <== effectively disable parallax correction for automatically placed probes to keep from bombing the world with obvious spheres
rr);
- w = sphereWeight(pos, dir, refSphere[i].xyz, r, 0.25, i, dw);
+ w = sphereWeight(pos, dir, refSphere[i].xyz, r, i, dw);
}
v -= c;
@@ -524,7 +519,7 @@ vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, out float dw, vec3 c, int
refIndex[i].w < 1 ? 4096.0*4096.0 : // <== effectively disable parallax correction for automatically placed probes to keep from bombing the world with obvious spheres
rr);
- w = sphereWeight(pos, dir, refSphere[i].xyz, r, 0.001, i, dw);
+ w = sphereWeight(pos, dir, refSphere[i].xyz, r, i, dw);
}
v -= c;
@@ -562,7 +557,6 @@ vec3 sampleProbes(vec3 pos, vec3 dir, float lod)
float dw = 0;
vec3 refcol;
-
{
refcol = tapRefMap(pos, dir, w, dw, lod, refSphere[i].xyz, i);
@@ -735,7 +729,7 @@ void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout
vec3 refnormpersp = reflect(pos.xyz, norm.xyz);
ambenv = sampleProbeAmbient(pos, norm);
-
+
if (glossiness > 0.0)
{
float lod = (1.0-glossiness)*reflection_lods;