Rendering partially obstructed layers

Hi everyone.

I have three layers. One is the background. I have a person in the second. On the third, there is a table. The person is leaning on the table, so one can see his feet behind the table, and his hands on the table.

I want to render this to three separate layers, so I can edit them in photoshop afterward.

However, if I render the scene to three layers, the person is rendered in full. Ie, the parts of his body that should be obstructed by the table, are also rendered. That means I have to manually cut away the parts that should be hidden.

Is there any way to render only the parts of a layer that are not obstructed?

Any help is much appreciated. Thanks!

You can use mask layers


layers.blend (98.9 KB)