diff options
author | Ptolemy <ptolemy@lindenlab.com> | 2022-07-27 10:21:34 -0700 |
---|---|---|
committer | Ptolemy <ptolemy@lindenlab.com> | 2022-08-02 09:44:45 -0700 |
commit | c7d61c417b0e7c9b7f56e29b82476dfe85c39b91 (patch) | |
tree | e8fe05d8659a391b8284dbdd308a89dafbe62c3e /indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl | |
parent | 9e036a17fa9d1fb3061eccf21e8f8ec4b24d3200 (diff) |
SL-17762: Cleanup dist_atten
Diffstat (limited to 'indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl')
-rw-r--r-- | indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl index 5d9b4bc877..defd577266 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl @@ -88,6 +88,9 @@ void main() float nh, nl, nv, vh, lightDist; calcHalfVectors(lv, n, v, h, l, nh, nl, nv, vh, lightDist); + float dist = lightDist / size; + float dist_atten = 1.0 - (dist + falloff)/(1.0 + falloff); + if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR)) { vec3 colorDiffuse = vec3(0); @@ -101,7 +104,7 @@ void main() if (nl > 0.0 || nv > 0.0) { - vec3 intensity = getLightIntensityPoint(color, size, lightDist); + vec3 intensity = dist_atten * getLightIntensityPoint(color, size, lightDist); colorDiffuse += intensity * nl * BRDFLambertian (reflect0, reflect90, c_diff , specWeight, vh); colorSpec += intensity * nl * BRDFSpecularGGX(reflect0, reflect90, alphaRough, specWeight, vh, nl, nv, nh); } @@ -126,8 +129,6 @@ void main() discard; } - float fa = falloff+1.0; - float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0); dist_atten *= dist_atten; dist_atten *= 2.0; |