Depth Mask Shaders?

I’ve been trying to figure out how to implement a Depth Mask Shader in Unreal Engine 4 for like two days now. I’m coming form unity where it was pretty much just ticking a flag in a shader script and applying that.

Would anyone know how I can create one in UE4? If it involves code, that’s fine too, but I can’t find any good documentation on what to do in code to enable this, either.

In case it’s called something else here, this is what I’m referring to: http://wiki.unity3d.com/index.php?title=DepthMask

Thanks in advance!

Edit: Just to give context, I’m attempting to use a Depth Shader Mask to allow me to write the output of a second camera onto the surface of a mesh. I know about the Scene Capture 2D object, but it doesn’t suit my needs exactly.

DepthFade node inside the material editor is what you are looking for i suppose.

Thank you for the response. I’ve seen that feature, but it doesn’t really do what I need it to do. I’ve added some context to my original question to hopefully clarify.

What exactly are you trying to make? It would help if you can be a little more specific since I have never used Unity so i dont know how exactly that shader works(i only took a guess depending on the link you showed) and why Scene Capture 2D wont do the job.

My actual use case is described in my forum post here: DepthMasks and Portals? - Pipeline & Plugins - Unreal Engine Forums

I’m open to other suggestions, but I’m trying to translate my work from Unity into Unreal so I’m trying to stick to my old ways of doing things. I had this working nearly perfectly in the Unity engine using Depth Mask shaders.

Now i see. That’s beyond me, however. :\ I’ve seen a ton of people coming here from Unity though so hopefully one of them or someone with more experience with the engine will stop by soon!