making an alpha mask out of a mesh?

I want to render an object which is partly covered by a second object. In the final rendering the second object should only appear as alpha, making the first object invisible where it is covered (see attached pics).
I think I could gain this result with different renderlayers and nodes somehow but I am not familiar with these. I tried all night but it does not work the way I want (the attached pics are photoshopped).
The final output is planned to be a series of alpha-masked movies that can be combined in an editing software.

The left one is what you gain normally, the right one what I want:


I think it is as simple as rendering your object with 0 transparency. Try that.

The image below is simply a uv shere with a flat plane in front of it that has 0 transparency


(should have asked earlier and spent last night with more fun activities…):slight_smile: