Invisible material that occludes background, except of the sky - how ?

Is there a way to have an object (a model) that isn’t visible nor renderable, but it would block anything behind it except the sky box ?

For example, imagine a model of a cross. It’s not being rendered and thus it’s not visible on the final rendering, but if a character walks behind that cross, any part of the character that is occluded by the cross will not be visible. Instead you’d see skybox through it.

How to achieve that?


You could put the object on its own layer and in the Layers panel use this layer as a mask layer

See demo file


mask_layer.blend (111 KB)