Custom depth outline draws over any object that doesn't have checked Render Custom Depth

I’m newbie in Unreal development and I want to draw an outline only around some actors on my level.

I have found a lot of tutorials about it, and all of them draw the outline using Custom Depth buffer. Here are some of the tutorials that I have found:

Now I’m working on the last one (youtube), and as you can see on second 0:43, the steps’ is hidden by the player:


This is because both, the player and the steps, have Render Custom depth checked.

This doesn’t happen on my level, because my player’s gun doesn’t have checked Render Custom Depth. Look:


But here, I have checked it on two squares:


The furthest square doesn’t draw its outline in front of the nearest square.

My problem here if I check Render Custom Depth in all of my actor, even in the ones that I don’t need it, I will have all of the outlined.

I need to normalize SceneDepth to only outline NOT hidden geometry. Any idea about how to do it?