How to access depth of RenderTargetTexture?

Any pointers what I am doing wrong here?

This is a very simple setup that renders stuff to RenderTargetTexture and then a node material that just renders the texture back on screen: https://www.babylonjs-playground.com/#27GIQD#2

Problem: As soon as I call opaqueRenderTarget.createDepthStencilTexture() which to my understanding just results the render target to use a texture as depth buffer, nothing is visible in the rendered texture anymore. And the depth component when rendered is just red (I suppose because the depth exists only in the red / x channel of the texture and with no content is 1.0): https://www.babylonjs-playground.com/#27GIQD#1

Why does the rendered content disappear when using depth texture?

cc @Evgeni_Popov

You can’t use MSAA with a depth texture in WebGL, so you must set samples = 1 when both creating the opaque render target and when creating the depth/stencil texture:

A depth texture has only a red component, that’s why the texture appears red.