From 65310e52de41ed90b66a5ac85c6a18887f8fee4e Mon Sep 17 00:00:00 2001
From: Alexander Rose <alexander.rose@weirdbyte.de>
Date: Tue, 6 Dec 2022 22:48:22 -0800
Subject: [PATCH] guard against issue with bumpiness in impostors

---
 CHANGELOG.md                                       | 2 ++
 src/mol-gl/shader/chunks/apply-light-color.glsl.ts | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index aafa39682..7416cb14a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,8 @@ Note that since we don't clearly distinguish between a public and private interf
 
 ## [Unreleased]
 
+- Better guard against issue (black fringes) with bumpiness in impostors
+
 ## [v3.26.0] - 2022-12-04
 
 - Support for ``powerPreference`` webgl attribute. Add ``PluginConfig.General.PowerPreference`` and ``power-preference`` Viewer GET param.
diff --git a/src/mol-gl/shader/chunks/apply-light-color.glsl.ts b/src/mol-gl/shader/chunks/apply-light-color.glsl.ts
index bddbf634b..ff2036d50 100644
--- a/src/mol-gl/shader/chunks/apply-light-color.glsl.ts
+++ b/src/mol-gl/shader/chunks/apply-light-color.glsl.ts
@@ -12,7 +12,7 @@ export const apply_light_color = `
     gl_FragColor = material;
 #else
     #ifdef bumpEnabled
-        if (uBumpFrequency > 0.0 && uBumpAmplitude > 0.0) {
+        if (uBumpFrequency > 0.0 && uBumpAmplitude > 0.0 && bumpiness > 0.0) {
             normal = perturbNormal(-vViewPosition, normal, fbm(vModelPosition * uBumpFrequency), (uBumpAmplitude * bumpiness) / uBumpFrequency);
         }
     #endif
-- 
GitLab