diff --git a/src/perspective_view/panel.ts b/src/perspective_view/panel.ts index 9ef7755c5..3f877fa4c 100644 --- a/src/perspective_view/panel.ts +++ b/src/perspective_view/panel.ts @@ -1164,6 +1164,7 @@ export class PerspectivePanel extends RenderedDataPanel { ); }; bindVolumeRenderingBuffer(); + renderContext.bindVolumeRenderingBuffer = bindVolumeRenderingBuffer; gl.clearDepth(1.0); gl.clearColor(0.0, 0.0, 0.0, 1.0); gl.clear( diff --git a/src/perspective_view/render_layer.ts b/src/perspective_view/render_layer.ts index 69e5e994d..c05482230 100644 --- a/src/perspective_view/render_layer.ts +++ b/src/perspective_view/render_layer.ts @@ -71,6 +71,11 @@ export interface PerspectiveViewRenderContext */ bindMaxProjectionBuffer?: () => void | undefined; + /** + * Specifies how to bind the volume rendering buffer + */ + bindVolumeRenderingBuffer?: () => void | undefined; + /** * Specifies how to assign the max projection emitter */ diff --git a/src/volume_rendering/volume_render_layer.ts b/src/volume_rendering/volume_render_layer.ts index 32d11453e..48ae1ee34 100644 --- a/src/volume_rendering/volume_render_layer.ts +++ b/src/volume_rendering/volume_render_layer.ts @@ -775,18 +775,20 @@ outputValue = vec4(1.0, 1.0, 1.0, 1.0); const performedSecondPassForPicking = !isProjectionMode(this.mode.value) && !renderContext.isContinuousCameraMotionInProgress; - // In this case, we need the max projection buffer + // If the layer is in projection mode or the second pass for picking has been performed, + // the max projection state is needed + // the max projection buffer is not bound, because it is immediately read back + // in the perspective panel to update the max projection picking buffer if (isProjectionMode(this.mode.value) || performedSecondPassForPicking) { gl.depthMask(true); gl.disable(WebGL2RenderingContext.BLEND); gl.depthFunc(WebGL2RenderingContext.GREATER); - renderContext.bindMaxProjectionBuffer!(); } else { - // Otherwise, the regular OIT buffer is needed + // Otherwise, the regular OIT buffer is needed along with the state gl.depthMask(false); gl.enable(WebGL2RenderingContext.BLEND); gl.depthFunc(WebGL2RenderingContext.LESS); - renderContext.bindFramebuffer(); + renderContext.bindVolumeRenderingBuffer!(); } gl.enable(WebGL2RenderingContext.DEPTH_TEST); };