summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class3/deferred
diff options
context:
space:
mode:
authorPtolemy <ptolemy@lindenlab.com>2022-08-31 21:06:41 -0700
committerPtolemy <ptolemy@lindenlab.com>2022-08-31 21:06:41 -0700
commitce685a12b9acc888a39c336c91ae6272db74ce91 (patch)
tree47a5234c7578f409d3570757c775ec729821a42b /indra/newview/app_settings/shaders/class3/deferred
parent539fd5fcf9fa1872996fbb687b49307737f1c8b5 (diff)
DRTVWR-559: PBR: Cleanup distance attenuation calcs
Diffstat (limited to 'indra/newview/app_settings/shaders/class3/deferred')
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl5
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl5
2 files changed, 4 insertions, 6 deletions
diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl
index a9a2b8dcb4..3efc9c1689 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl
@@ -110,6 +110,7 @@ uniform mat4 inv_proj;
vec3 BRDFLambertian( vec3 reflect0, vec3 reflect90, vec3 c_diff, float specWeight, float vh );
vec3 BRDFSpecularGGX( vec3 reflect0, vec3 reflect90, float alphaRoughness, float specWeight, float vh, float nl, float nv, float nh );
void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float nh, out float nl, out float nv, out float vh, out float lightDist);
+float calcLegacyDistanceAttenuation(float distance, float falloff);
vec3 colorized_dot(float x);
bool clipProjectedLightVars(vec3 center, vec3 pos, out float dist, out float l_dist, out vec3 lv, out vec4 proj_tc );
vec3 getLightIntensitySpot(vec3 lightColor, float lightRange, float lightDistance, vec3 v);
@@ -155,9 +156,7 @@ void main()
vec3 n;
vec4 norm = getNormalEnvIntensityFlags(tc, n, envIntensity);
- float dist_atten = 1.0 - (dist + falloff)/(1.0 + falloff);
- dist_atten *= dist_atten;
- dist_atten *= 2.0;
+ float dist_atten = calcLegacyDistanceAttenuation(dist, falloff);
if (dist_atten <= 0.0)
{
discard;
diff --git a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl
index 41e40a07e7..87b7977f64 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl
@@ -85,6 +85,7 @@ uniform mat4 inv_proj;
vec3 BRDFLambertian( vec3 reflect0, vec3 reflect90, vec3 c_diff, float specWeight, float vh );
vec3 BRDFSpecularGGX( vec3 reflect0, vec3 reflect90, float alphaRoughness, float specWeight, float vh, float nl, float nv, float nh );
void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float nh, out float nl, out float nv, out float vh, out float lightDist);
+float calcLegacyDistanceAttenuation(float distance, float falloff);
bool clipProjectedLightVars(vec3 center, vec3 pos, out float dist, out float l_dist, out vec3 lv, out vec4 proj_tc );
vec3 getLightIntensitySpot(vec3 lightColor, float lightRange, float lightDistance, vec3 v);
vec4 getNormalEnvIntensityFlags(vec2 screenpos, out vec3 n, out float envIntensity);
@@ -129,9 +130,7 @@ void main()
vec3 n;
vec4 norm = getNormalEnvIntensityFlags(tc, n, envIntensity); // need `norm.w` for GET_GBUFFER_FLAG()
- float dist_atten = 1.0 - (dist + falloff)/(1.0 + falloff);
- dist_atten *= dist_atten;
- dist_atten *= 2.0;
+ float dist_atten = calcLegacyDistanceAttenuation(dist, falloff);
if (dist_atten <= 0.0)
{
discard;