Browse Source

reduce over-blurring occlusion at larger view distances

Alexander Rose 2 years ago
parent
commit
926d6cbd46
2 changed files with 3 additions and 0 deletions
  1. 1 0
      CHANGELOG.md
  2. 2 0
      src/mol-gl/shader/ssao-blur.frag.ts

+ 1 - 0
CHANGELOG.md

@@ -8,6 +8,7 @@ Note that since we don't clearly distinguish between a public and private interf
 
 - Add occlusion color parameter
 - Fix issue with outlines and orthographic camera
+- Reduce over-blurring occlusion at larger view distances
 
 ## [v3.31.4] - 2023-02-24
 

+ 2 - 0
src/mol-gl/shader/ssao-blur.frag.ts

@@ -74,6 +74,8 @@ void main(void) {
     float kernelSum = 0.0;
     // only if kernelSize is odd
     for (int i = -dOcclusionKernelSize / 2; i <= dOcclusionKernelSize / 2; i++) {
+        if (abs(i) > 1 && abs(float(i)) * pixelSize > 0.5) continue;
+
         vec2 sampleCoords = coords + float(i) * offset;
         if (outsideBounds(sampleCoords)) {
             continue;