How can depthtest in ShaderPass


I tried to customize the selectable boomeffect example using two scene.
the first scene is general render, and the second scene is for bloom render.
And I tired to combine two render result in shaderpass like the official example.(three.js examples)
But, I am not sure how to process the depth test in the shader.
Can you provide some advice?
Here is my code sandbox, but I think line #97 should be refine using depth test.
BLOOM ADVANCED - JSFiddle - Code Playground

Thanks in advance for your feedback.

Why are you using two effect composers? The setup would be easier to debug if you simplify things.

In this official example, it used two composers.

but, I just want to optimize the rendering performance in case of implement the selectable bloomeffects.

for the selectable bloom effects, we had to render non-bloom objects twice, one is regular render for diffuse color, and another is in bloom pass with black color.
but, I want to render all objects only once by using splitted scene. one scene is used for non-bloom objects, and another scene is used for bloom objects. (aka bloom-scene).
in that case, in renderpass of the bloom-scene, we need to test depth value with non-bloom-scene’s rendered depth result.

that is the reason what I want to do depth test in the shaderPass with previous rendered depth buffer texture.