Hey there - I’m using stencils to make these purple particles render behind a quad, but I had to check the “Disable Depth Test” option within the particles’ material to get them to render below my floor (since otherwise, the depth test would cull them).
The problem is that now I’m seeing the purple particles even behind objects such as the sphere in the video.
I know this is caused precisely by disabling the depth test, but I would still like to see the particles behind the “stencil-quad” when there’s a clear line of sight to it.
Explicitly speaking, I would like to output:
- Stencil buffer = 0 if the quad is not hit by the camera raycast;
- Stencil Buffer = 1 if the quad is directly hit by the camera raycast, therefore passing both the stencil and depth test,;
- and Stencil Buffer = 0 if the quad hit by the stencil test during the raycast, but is obstructed by another object in the depth test’s raycast.
Which I think sums up to:
- I want the make the depth test for my particles to take priority over their stencil test.
How would I go about doing this? Or is there perhaps a simpler solution to my problem?
Here are two screenshots from the engine - one with my framebuffers and another with my material setup for the particles.
I hope this is enough information, otherwise, I’d gladly provide more insight.