Hi Skinny !
So the issue arises from the fact that at those pixels, the RGBA values are a mix of the front particle and some very distant ones, while the Z value corresponds to the topmost particle. Because of that alpha overlap, the particles visible in the background are considered to be in the foreground by the DOF algo.
That's an issue you'll encounter with semi-transparency and all the algo that use depth (DOF, ambient occlusion, cast shadows, ect).
To fix this, there is a simple solution; if you use the DOF only on a particle system, the trick is to fake it in the selector of the sprite points:
- you need to select your sprites based on the depth
- use a function selector to embed the depth selector, so that you can have a nice sine (and blur the front and the back while smoothly making the center focused)
- use two sprites in your selector, one nice and sharp and the other one, the same, but blurred (an example could be to use "Standard Pack/Texture/Particle/Disc.png" and ".../Dot White B.png")
- add a point scale attributes modifier, that scales up the particles in the front and scales down the particles in the center (using the same sine function as before)
That way, you'll get a beautiful DOF effect!
I joined a compo from the examples that does just that (from Examples/Particles).
Particular Depth of Field.compo (31.4 KB)