How to hide outline post process effect behind objects

I created an outline effect following the instructions in this tutorial:

[outline tutorial][1]

I had to create the M_highlight material because I couldn’t find it in the content examples. I think it is no longer available there.
Maybe I messed that up. But I can’t find any problem with it.

Anyway, most of the material works fine, I am perfectly happy with the outline. Only thing is, that it is drawn on top of the whole scene. So if I place an object in front of the object with the outline and do not activate its “custom depth pass” the outline of the other object is rendered on top of this. Like in this screenshot:

Here is the material I recreated from the video:

Any idea what i did wrong???
Every help would be much appreciated.

1 Like

Is there another way to do this, if it is not possible to achieve the desired result using the M_highlight material and post-processing?

I think you will find an answer there : Disabling Custom Depth Rendering on certain objects - Rendering - Unreal Engine Forums

1 Like

Hi, you need to subtract ocluded parts from your Stencil / Custmom Depth: