DepthMask for masking renderer objects

Anyone that happens to know how to create the following effect in UE4?

Basically what happens is that I have applied a material with a shader in unity that masks everything thats behind the object with the assigned “DepthMask-material”, the blue-ish color is the background color thats applied by the camera.

If we happen to have some shader/material-guru around here, then maybe he/she happens to know how to convert this unity-shader into a material that could be used for post processing or something :):

Shader “DepthMask”
Tags {“Queue” = “Geometry-1” }
Lighting Off
ZWrite On
ZTest LEqual
ColorMask A

Any ideas?

Thanks in advance!

Hey Inx51 -

Tom Looman has a great tutorial on using Custom Depth which should help you achieve the results you are after.

Thank You

Eric Ketchum