How to get depthtexture on WebGLRenderTarget that contains only opaque objects

This thread and the attached example code may be helpful - you can switch off certain elements, render the depth texture, then switch the elements back before color is rendered.