Unity3D: Drawing particles after AA resolve for pe

2020-07-18 20:07发布

问题:

I'm trying to gauge the effect of MSAA on scenes with lots of particles in Unity.

To do that, I'd need to:

  1. Draw all non-particle objects in the scene with 8x MSAA

  2. Use the resolved depth buffer from the previous pass to render all the non-occluded particle systems onto a smaller render target.

  3. Alpha Blend the color buffer of (2) with (1)

I'm looking at the post-processing effects to get a sense of what i might need to do, but none of them use the depth buffer from a previous pass to affect the depth test of other objects in the scene (in this case, the particles). They instead post-process the depth buffer as a whole and modulate the existing color buffer.

Is is possible to do what I'm trying in Unity? I'm reading up on Replacement Shaders, but I'm wondering how I can pass one cameras' depth buffer to another camera (that renders the non-occluded particles to a non-msaa RT).

(This was originally posted on the Unity forums, but I didn't get any reply. Hopefully, SO will help!)

I did checkout the "high speed off screen particles in unity" articles (on the same topic - some of the important links in it don't work anymore x(