- Home /
Control render order of geometry besides queues
I'm writing a voxel-renderer for particles in Unity, and the rendering flow is as follows:
i) Draw opaque scene
ii) Fill voxels (3D textures) by using PS or CS
iii) Render voxels as cubes, and ray march pixels that pass the depth test with voxel info from (ii)
I'm stuck in step (iii). I need to do both front-to-back blending and back-to-front blending for the voxel cubes for the algorithm to work. If i create the cubes as game objects and tie them to a material with a shader that uses, say, Queue = Transparent
, unity is going to sort them back-to-front and render them in that order, after the queues that precede it.
I'd like to control the exact order in which they are drawn, and I thought Graphics.DrawMeshNow
would do that. I use it in Camera.OnRenderObject
and from a frame capture, I see it being the first thing drawn (even before the opaque objects in step i).
I thought OnRenderObject
would be called only after rendering the scene as seen by the camera, but that's not what I observe.
Any help would be greatly appreciated. Thanks for reading!
Hey did you find a solution for this problem?^^ I've got the same problem...
thank you in advance