diff options
author | Ptolemy <ptolemy@lindenlab.com> | 2022-07-15 17:22:23 -0700 |
---|---|---|
committer | Ptolemy <ptolemy@lindenlab.com> | 2022-07-15 17:22:23 -0700 |
commit | 5aee9b74626432772415306ec1bf4de7600ab27c (patch) | |
tree | 903da3da6f39ef90cc0a7e5c009840e5a00673dd | |
parent | 6115941c81b6f4aa49c33a82826bcfe2994c1a67 (diff) |
SL-17702: PBR: Stub in light attenuation
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl index e28d4f38e8..3427f373d2 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl @@ -157,6 +157,42 @@ vec2 getGGX( vec2 brdfPoint ) #endif } + +// Reference: float getRangeAttenuation(float range, float distance) +float getLightAttenuationPointSpot(float range, float distance) +{ +#if 1 + return range; +#else + float range2 = pow(range, 2.0); + + // support negative range as unlimited + if (range <= 0.0) + { + return 1.0 / range2; + } + + return max(min(1.0 - pow(distance / range, 4.0), 1.0), 0.0) / range2; +#endif +} + +vec3 getLightIntensityPoint(vec3 lightColor, float lightRange, float lightDistance) +{ + float rangeAttenuation = getLightAttenuationPointSpot(lightRange, lightDistance); + return rangeAttenuation * lightColor; +} + +float getLightAttenuationSpot(vec3 spotDirection) +{ + return 1.0; +} + +vec3 getLightIntensitySpot(vec3 lightColor, float lightRange, float lightDistance, vec3 v) +{ + float spotAttenuation = getLightAttenuationSpot(-v); + return spotAttenuation * getLightIntensityPoint( lightColor, lightRange, lightDistance ); +} + // NOTE: This is different from the GGX texture float D_GGX( float nh, float alphaRough ) { |