How to display Custom Depth as black&white only?

When getting custom depth view via SceneTexture:CustomDepth in post process material, the output multiplied by 0.0001 gives almost-black&white image. Almost, because the further from the CustomDepth object, the more it brightens up. Resulting in black&gray image. Is it possible to somehow filter it to always display 100% black and 100% white pixel values from this custom depth output?

Here’s some additional explanation:


On the left - CustomDepth output that I see when getting far from CustomDepth object. On the right - that’s how I would like to see it, no matter how far from the object it is.

Update: When it is really far from an object, customdepth view of this object almost disappears… Something to ignore distance at custom depth would solve the problem…

I’ve found a solution: Use CustomDepth Stencil. Here is how to set it up - it doesn’t fade out like regular CustomDepth: CustomStencil usage in PP material? - Rendering - Unreal Engine Forums

[Sadly it needs to be enabled in project settings first (and I’m preparing my tool for marketplace) but well, I’ll just need to inform end user to enable CustomDepth Stencil in project settings]