I need help with PP Materials - Custom depth

I display part of some objects as solid color if they are behind another object. I use a global PP and a PP Material (Rendering Features ->Post Process Materials -> MyMaterial). Rendering color is same for all objects. In my case there are objects which are belonging to different players and those have different player colors. I want to also set different colors for PP operation I do. When they are behind another object they should produce different colors. Yes, I could do it with depth fade but at that time my material have to be translucent which I do not want.

render: https://i.ibb.co/FHPGsYL/custom-Depth.jpg

What is the way I do it ?

Thanks for any idea.