VFX Graph and Depth of Field in URP

Hey Guys,

i am trying to get the depth of field (volume effect) running with the VFX Graph Particles. As i understood there is a problem with the transparency, when i have opaque particles it works. But i want to have additive particles. Is there a change to achive that for transparent particles?

Thanks!
Cheers.

Assuming you want to create some volumetric effect from particles, what exactly is the problem?
I mean, if you want them to be additive it means they do not blend/override each other, but instead color is added, so if you have red and green particles on top of each other the order should not matter, you just end up with yellow anyway.

Hey Qriva,

the problem is that the additive particles always be blurred completely. So the focus distance does not work there. Its like they dont provide any depth information. When i make the particles oqaque it works, but the visual result does not work for that case.

Your graph on the picture is so small that nothing can be read from it.

I might be wrong, but I think depth of field requires depth buffer to work correctly, so the only way might be to enable Z-write in the output of the graph. Opaque works as it writes to depth by default, while transparent does not, however if you enable zwrite for additive I am not sure it will look the way you want. You need to try, it might be worth to experiment with z-test too, so they fill depth buffer, but still render on top of each other.

1 Like

Yes i thought so too. What i am missing here in the VFX Graph are the Graph Settings. Shouldn`t they supposed to be in the vfx graph editor window? There was once something like a graph inspector with the graph settings. I am here in unity 2023 with vfx graph 15.02.

I suppose there should be the options to enable z-writing etc.

Any node you select in vfx graph window has standard inspector like any other game object.
Click the output context and check inspector.

1 Like

Nice one. That did the trick. Enable Z Write Mode and put Z Test Mode To “Always”.
Now i can adjust the focus distance, the picture underneath shows the foreground to be sharp and the background to be blurry.

Thank you!

Hi, does this work in Unity 2022.3.18 also, i have opaque lit URP quads in VFX particle and Zwrite on and cant see the particles in the _CameraDepthTexture

Thanks

I tested 2022.3.21 and there are particles, at least in profiler.
9803676--1407501--upload_2024-4-29_20-1-26.png
My guess is you have different setup of URP options or there was some bug in particle shader.

My URP settings:
9803676--1407510--upload_2024-4-29_20-3-17.png

9803676--1407513--upload_2024-4-29_20-3-42.png

Hi, thanks for the feedback

Actually found the issue, seems the 2ond camera depth was rather hard to catch from just the standard depth textures, needed to cast it in a render texture in the right time, so now works :slight_smile:

1 Like