- Home /
Graphics.drawProcedural in normal render queue
I'm using a compute shader to create a particle system and draw it using Graphics.DrawProcedural on the Camera.OnRenderObject function. Unfortunately, according to the Unity documentation:
Note that this call executes immediately, similar to Graphics.DrawMeshNow. It uses currently set render target, transformation matrices and currently set shader pass.
But I want the particles to be subject to post-processing, blur, transparencies, depth-testing, etc. In other words, I want them to be drawn on the geometry queue (or whatever queue the shader specifies), like with Graphics.DrawMesh:
Note that DrawMesh does not draw the mesh immediately; it merely "submits" it for rendering. The mesh will be rendered as part of normal rendering process.
Obviously I can't use Graphics.DrawMesh, because I would need to pass all the vertex information back to the CPU using ComputeBuffer.GetData, which would be SUPER slow and defeat the purpose of using the compute shader in the first place. Any ideas?
Answer by foxes · Sep 19, 2017 at 08:53 AM
I have tried to use CommandBuffers. If you install one of them BeforeDepthTexture this will allow drawProcedural so that the result is written to the depth buffer. (for Forward Render Path) But I faced the problem that not have write to color buffer.
Your answer
![](https://koobas.hobune.stream/wayback/20220613193938im_/https://answers.unity.com/themes/thub/images/avi.jpg)