diff --git a/CHANGELOG.md b/CHANGELOG.md index e97d58488934f2d0b34e9f56056c619809bebb09..c80c7cdc685ab5c6bf4c8c212ed933fc20164517 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ Note that since we don't clearly distinguish between a public and private interf - Fix rendering issues caused by VAO reuse - Add "Zoom All", "Orient Axes", "Reset Axes" buttons to the "Reset Camera" button - Improve trackball move-state handling when key bindings use modifiers +- Fix rendering with very small viewport and SSAO enabled ## [v3.33.0] - 2023-04-02 diff --git a/src/mol-canvas3d/passes/postprocessing.ts b/src/mol-canvas3d/passes/postprocessing.ts index 4ec19e94fbd1707db6bb42745f60bb9653201df0..78cff827451685325ed053cc171127fa66e97c76 100644 --- a/src/mol-canvas3d/passes/postprocessing.ts +++ b/src/mol-canvas3d/passes/postprocessing.ts @@ -506,11 +506,11 @@ export class PostprocessingPass { const sw = Math.floor(width * this.ssaoScale); const sh = Math.floor(height * this.ssaoScale); - const hw = Math.floor(sw * 0.5); - const hh = Math.floor(sh * 0.5); + const hw = Math.max(1, Math.floor(sw * 0.5)); + const hh = Math.max(1, Math.floor(sh * 0.5)); - const qw = Math.floor(sw * 0.25); - const qh = Math.floor(sh * 0.25); + const qw = Math.max(1, Math.floor(sw * 0.25)); + const qh = Math.max(1, Math.floor(sh * 0.25)); this.downsampledDepthTarget = drawPass.packedDepth ? webgl.createRenderTarget(sw, sh, false, 'uint8', 'linear', 'rgba') @@ -562,12 +562,12 @@ export class PostprocessingPass { this.ssaoDepthTexture.define(sw, sh); this.ssaoDepthBlurProxyTexture.define(sw, sh); - const hw = Math.floor(sw * 0.5); - const hh = Math.floor(sh * 0.5); + const hw = Math.max(1, Math.floor(sw * 0.5)); + const hh = Math.max(1, Math.floor(sh * 0.5)); this.depthHalfTarget.setSize(hw, hh); - const qw = Math.floor(sw * 0.25); - const qh = Math.floor(sh * 0.25); + const qw = Math.max(1, Math.floor(sw * 0.25)); + const qh = Math.max(1, Math.floor(sh * 0.25)); this.depthQuarterTarget.setSize(qw, qh); ValueCell.update(this.renderable.values.uTexSize, Vec2.set(this.renderable.values.uTexSize.ref.value, width, height));