Rendering overlapping custom depth pass objects

Hello Andrew,
how can I get what it’s seen in first image?
image

Thank you!