Browse Source

apply bumpiness as lightness with ignoreLight

Alexander Rose 2 years ago
parent
commit
f08729a402
2 changed files with 8 additions and 0 deletions
  1. 1 0
      CHANGELOG.md
  2. 7 0
      src/mol-gl/shader/chunks/apply-light-color.glsl.ts

+ 1 - 0
CHANGELOG.md

@@ -10,6 +10,7 @@ Note that since we don't clearly distinguish between a public and private interf
     - Move or fly around the scene using keys
     - Pointer lock to look around scene
     - Toggle spin/rock animation using keys
+- Apply bumpiness as lightness variation with `ignoreLight`
 
 ## [v3.32.0] - 2023-03-20
 

+ 7 - 0
src/mol-gl/shader/chunks/apply-light-color.glsl.ts

@@ -9,6 +9,13 @@
 
 export const apply_light_color = `
 #ifdef dIgnoreLight
+    #ifdef bumpEnabled
+        if (uBumpFrequency > 0.0 && uBumpAmplitude > 0.0 && bumpiness > 0.0) {
+            material.rgb += fbm(vModelPosition * uBumpFrequency) * (uBumpAmplitude * bumpiness) / uBumpFrequency;
+            material.rgb -= bumpiness / (2.0 * uBumpFrequency);
+        }
+    #endif
+
     gl_FragColor = material;
 #else
     #ifdef bumpEnabled