How can VFX Graph be detected by Depth Camera or lidar?

I want to simulate snowflakes using Unity’s VFX Graph, and make the lidar simulated based on a depth camera detect the snowflakes. How should I modify the VFX Graph output?

Hi!

Assuming that your lidar camera works using the depth buffer, the option that you have to enable (ZWrite Mode) is shown on the inspector of the Output node:

image

However, this does not work very well with additive, as you will see.

You will have to set Sort to On (automatic mode means no sorting with additive).

I also recommend enabling Use Alpha Clipping.

Hope that helps!



I have made the changes as you requested, but it still cannot be rendered to the depth buffer. Also, I don’t see the ‘sort mode’ option on the inspector page. Is there any way to quickly determine if the depth buffer has already been written to?

I have made the changes as you requested, but I have encountered some issues and hope you can provide some answers.

You can use the Rendering Debugger to visualize the depth texture:
https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@14.0/manual/features/rendering-debugger.html#rendering-debug

Or the Frame Debugger, to visualize it step by step:

Regarding this:

Also, I don’t see the ‘sort mode’ option on the inspector page

Don’t worry about the Sort Mode. I guess it was not available in 22.3 LTS, but in your case the default option will work just fine.

My best guess is that your lidar is resolving (reading) the depth texture right after the opaque pass, while the particles will be rendered in the transparent pass, a bit later. You can see this in the Frame Debugger

I’m afraid I have no good solution, if that is the case. My suggestion would be to try to render it as Opaque, with Use Alpha Clipping. It won’t be transparent, but it will be rendered to the depth buffer. Your particles seem quite solid anyway, so it might work.