From 47cd3cb0ad03c91f118fd20fea8d8924759fd2b7 Mon Sep 17 00:00:00 2001
From: "Jonathan \"Geenz\" Goodman" <geenz@geenzo.com>
Date: Tue, 27 Feb 2024 13:46:49 -0800
Subject: [PATCH] #681 More generalization of falloff.

---
 .../class3/deferred/reflectionProbeF.glsl     | 21 ++-----------------
 1 file changed, 2 insertions(+), 19 deletions(-)

diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
index 7df9bdba5d8..257299258e7 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
@@ -698,22 +698,6 @@ layout (std140) uniform HeroProbeData
     int heroProbeCount;
 };
 
-float sphereWeightHero(vec3 pos, vec3 dir, vec3 origin, float r, 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 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;
-
-    w *= atten;
-
-    return w;
-}
-
 void tapHeroProbe(inout vec3 glossenv, vec3 pos, vec3 norm, float glossiness)
 {
     float clipDist = dot(pos.xyz, clipPlane.xyz) + clipPlane.w;
@@ -729,16 +713,15 @@ void tapHeroProbe(inout vec3 glossenv, vec3 pos, vec3 norm, float glossiness)
     else
     {
         float r = heroSphere[0].w;
-        //v = sphereIntersect(pos, norm, heroSphere[0].xyz, 4096.0*4096.0);
         
-        w = sphereWeightHero(pos, norm, heroSphere[0].xyz, r, dw);
+        w = sphereWeight(pos, norm, heroSphere[0].xyz, r, vec4(1), dw);
     }
     
     {
         vec3 refnormpersp = reflect(pos.xyz, norm.xyz);
         if (dot(refnormpersp.xyz, clipPlane.xyz) > 0.0)
         {
-            glossenv = textureLod(heroProbes, vec4(env_mat * refnormpersp, 0), (1.0-glossiness)*heroMipCount).xyz * w;
+            glossenv = mix(glossenv, textureLod(heroProbes, vec4(env_mat * refnormpersp, 0), (1.0-glossiness)*heroMipCount).xyz, w);
         }
     }
 }
-- 
GitLab