summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2024-09-19 19:32:15 +0300
committerGitHub <noreply@github.com>2024-09-19 19:32:15 +0300
commitb111dce31a48e1329f30366c2a5541c1434d362b (patch)
tree3f5e6517f50a942fb191877202d1ae10744eb72f /indra/newview/app_settings/shaders
parentea8d7cb40501af9b31d784da78aaaf7353af58f3 (diff)
parentea28e97d85707099ef3cadf7f5632224498af401 (diff)
Merge pull request #2605 from secondlife/marchcat/b-main-sync
Main (DeltaFPS) → Maint B sync
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 ab0e4fd4d8..3319e32cdf 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);
}