summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-09-07 17:46:04 +0800
committerErik Kundiman <erik@megapahit.org>2024-09-07 17:46:04 +0800
commita742349cabd97b42e61e1b445f79840407cb3479 (patch)
tree6d6f043f53cd3d7b9bf004e543932a86cb89ad7c /indra/newview/app_settings/shaders
parent895e2decd591ce8ab3cfcdce93c8b10447eedbee (diff)
parent1f754e50908ba325c132b8d83383f7f0dbbdf793 (diff)
Merge remote-tracking branch 'secondlife/release/2024.08-DeltaFPS' into 2024.08-DeltaFPS
Diffstat (limited to 'indra/newview/app_settings/shaders')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl11
1 files changed, 7 insertions, 4 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
index 5193a46ac2..8588a93648 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
@@ -99,10 +99,13 @@ void calcHalfVectors(vec3 lv, vec3 n, vec3 v,
{
l = normalize(lv);
h = normalize(l + v);
- nh = clamp(dot(n, h), 0.0, 1.0);
- nl = clamp(dot(n, l), 0.0, 1.0);
- nv = clamp(dot(n, v), 0.0, 1.0);
- vh = clamp(dot(v, h), 0.0, 1.0);
+
+ // lower bound to avoid divide by zero
+ float eps = 0.000001;
+ nh = clamp(dot(n, h), eps, 1.0);
+ nl = clamp(dot(n, l), eps, 1.0);
+ nv = clamp(dot(n, v), eps, 1.0);
+ vh = clamp(dot(v, h), eps, 1.0);
lightDist = length(lv);
}