Writing custom OpenGL to the depth buffer *before* Unity rendering

Hi,
I know there is an existing mechanism for writing custom openGL plugins and rendering after all Unity rendering has been completed. However, I would like to render custom depth buffer data from a memory buffer before Unity rendering to be used during Unity’s depth buffer test. For example, I may have a very specialized occlusion mask that I procedurally create and would like to put this in the depth buffer before regular Unity rendering. Is this possible?

Victor

So you want to fill depth buffer with some custom pattern? It’s not possible directly even in OpenGL afaik. You need to render mesh with suitable shape that represents your mask before all other objects (or, before objects you want to respect your depth effect) with Colormask set to 0, and ZWrite set to On.