Multiple custom depth passes (channels?)

Hi!

I was wondering if it’s possible to have more than one custom depth pass. Now I know there are stencils which can be used to seperate objects within one depth pass. But there is a particular issue with this that I need a fix for. Namely, that stencils only works as long as the objects are in front of eachother, but what I want is to see an object before another object within a depth pass even while it is behind another other object.

Ok, let me try and explain it again haha. So imagine a large plane, and imagine a sphere. Both objects are rendered into a depth pass. Now as long as the sphere is in front of the plane I will be able to see the sphere and the plane with two seperate colors using stencils. But now imagine that the sphere is behind the plane, this means I can no longer see the sphere. Now how would I go about fixing this so that the sphere is always rendered no matter if it is in front or behind the plane.

The only solution I can think of is by having a secondary depth pass channel, and rendering the sphere and plane to two seperate channels and then somehow using thos channels to render them.

Has anyone ever done this?