Write to stencil buffer but not to custom depth

Hey Epic,

I need the option to tag meshes to be rendered in the custom stencil buffer but without also writing to the custom depth buffer (like it currently does).

That would be very useful when you need to mask things in your scene but also use the custom depth for other effects.

I cannot think of a reason why this is not already the case, as I understand the stencil is written at the custom depth pass but at the end of the day they are two different buffers so it should be possible to add a boolean in the static mesh settings for this (right?)

I’m also after this feature (for water masking purposes).

Sounds like a good feature

Still actual.

isn’t that what stencil buffer value is for? 255 different masks pretty sure. 0-255, if stencil value = this do this…

Problem is that you can’t write custom stencil without also writing to depth buffer.

This is indeed possible, sort of! A translucent material will write to the stencil buffer even if part of it is discarded due to the depth test. In the material, if you set Blend Mode → Translucent, enable “Output Depth and Velocity” to enable the Pixel Depth Offset pin, then set Pixel Depth Offset to some large value, e.g. 10000000, the primitive will be behind everything else in Custom Depth, but it will still write its stencil value.