Using depth texture in ShaderPass

Here is your updated fiddle: BLOOM ADVANCED - JSFiddle - Code Playground

  • It does not make sense to call clear() right after rendering to depthRenderTarget. This will clear its content.
  • You have to be aware that passing a shader to ShaderPass means it’s uniforms are cloned (meaning the texture of the WebGLRenderTarget which does not work). So you have to assign the values right after the pass creation.
  • It’s not necessary to assign tDiffuse since it’s automatically assigned by ShaderPass. It represents the contents of the EffectComposer’s read buffer right before the pass is executed. In your particular case, it’s the result of RenderPass.
1 Like