After looking more into the rendering code, I found a much simpler way to fix this issue. The only reason why Nez can’t handle the depth layer is that
Material.defaultMaterial, which has its
DepthStencilState set to
So I created a custom Renderer with this line in the constructor
this.material.depthStencilState = DepthStencilState.Default;
that was enough to fix all of the issues and for the
Batcher.draw() method to accept/use the depthLayer.
I was wondering, do you want me to submit a Pull Request to add this to the DefaultRenderer? Or perhaps add a new Renderer that fixes that issue? Or maybe add it to the docs? Just think it might be useful for others in the future.