Ever wondered how to implement occlusion masking in UE4? I wanted this effect for my game – so I spent some time googling and ended up in Post Process material section of Unreal Engine Documentation. You might be too. There is plenty of tutorials about the use of Custom Depth and Custom Depth Stencil Value material nodes on the Internet. I personally find this youtube video quite helpful:
Tom Looman’s tutorials are pretty good too: https://www.tomlooman.com/the-many-uses-of-custom-depth-in-unreal-4/