DepthMask for masking renderer objects

Hi!
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”
{
SubShader
{
Tags {“Queue” = “Geometry-1” }
Lighting Off
Pass
{
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.

http://www.tomlooman.com/the-many-uses-of-custom-depth-in-unreal-4/

Thank You

Eric Ketchum