Download

Custom Depth Stencil sort priority

Hello,

I might me overlooking something but I am not able to specify the draw order of meshes writing into the custom depth buffer with different stencil values. I am not interested in sorting them based on distance from the camera so they have the same ‘Z’ coordinates.
Is this even possible? I am using translucent materials. Everything works fine and I get the expected results if the meshes don’t write into the custom depth buffer, but as soon as they do, the ‘TranslucentSortPriority’ setting seems to get ignored and the random winner of the Z-fight will be rendered on top. Moving one of the meshes a few units up on the ‘Z’ axis fixes the issue, but it isn’t an ideal solution.

Any help would be appreciated.

Asking the same question. I’ve tried a few things including setting the reverse culling but that only flips the problem to the other side. The REALLY weird issue for me, is this doesn’t seem to happen when looking top down, only when underneath looking up. (The Environment project, aka the ocean project)