Rendering behind z-mask layer in cycles


I use mask layers (in render layers panel) to hide some parts of scene (for rendering). But i don’t know how to render only objects that are behind mask layer. I know that in Blender Internal i could use “negate” option, but this button is not in cycles.

Please, does anybody know how can i render something behind (and not in front of) mask layer in cycles?

It depends on what you are trying to achieve. Explaining this clearly will get you better answers.

Mask layers aren’t for hiding objects. Per the wiki:

Mask Layers: objects on these will mask out other objects appearing behind them. This is equivalent to assigning a Holdout shader for camera rays to the objects on such layers

In Maya we called this a black hole pass. It basically takes all objects behind the mask layers and cuts the mask layers object shape into the alpha of the objects behind.

If you want to just completely exclude certain objects from a render just deselect that object’s layer from the Scene Layers. If you want indirect lighting from objects in the scene, put those in the Camera Layers. If you want the mask objects in the background using foreground objects, use the Mask Layers. If you want multiple setups use multiple render layers. Just click the plus where it says “Renderlayer1”.

In Maya you could also use render layers to test different shaders. Each render layer could have an object that was assigned a different shader