How to draw a mesh on it's own layer?

I’m trying to draw a mesh on its own layer on top of everything else in the scene.
I have created a new render layer ‘Top’ and applied it to the camera and the object, and then disabled depth test and write on the material.
This works perfectly for a simple mesh primitive like a cube, but when I’m trying it with a more complex mesh (but still just a single mesh piece) it’s failing because it seems like the different parts of the mesh are drawing in the wrong order. So it seems like for a complex mesh, it needs depth read/write in order to draw properly, but obviously turning those on mean the mesh no longer draws on top of the rest of the scene.
Is there a way to have the mesh draw on top of the scene and just depth test/write only itself, or only the other things on that render layer?

Do you have an example project to look at for this? Sounds like you will need camera stacking for this rather than disabling depth test and write on the material

I don’t have an easy project to show for this right now. I hadn’t come across the idea of camera stacking though.
So I see I can potentially have two cameras with different priorities, drawing different layers, but how can I compose the two cameras together as one? Is there an example project for that somewhere?

We don’t have an official example but I do it here with the gun:

The annoying part of this technique is to keep the two properties of the cameras in sync

I think the alternative is to set the layer to clear the depth buffer when it is rendered

1 Like

Ah, that’s perfect. Clearing the depth buffer is exactly what I needed to be able to do - thanks so much for the quick and helpful response, much appreciated!