I am currently trying to achieve two things with the depth buffer:
- Have select pieces of geometry ignore depth comparisons and automatically write to the depth buffer. (I will refer to these as “type 1” objects.)
- Specify the order in which objects are processed in the depth pre-pass.
The current way I manage this is by making any “type 1” object (objects that overwrite depth) translucent, and disabling depth-checking. To get around the depth-order, any object that needs to be rendered in a specific order is made translucent. I then abuse the translucency sort priority to manage the rendering order of objects.
This is a terrible hack, and not very performant. Is there any way I can control the ordering/depth-stencil functionality through materials? Worst case I can pull source and make some modifications how the ordering for depth gets handled, but I’m trying to avoid making my team use our own version of Unreal.
Edit: This all assumes that depth pre-pass happens over all objects, and then during main-pass it doesn’t perform depth-writes, only depth comparisons. Looking at renderer source I’m no longer sure this is true? Regardless, the question still stands.