Hiding an object from camera per render layer

Hi,

I have a project where I need to hide an object from camera in a specific render layer. I can not exclude it as I need all the reflections and shadows. I will then composite the object back in the scene. Is there a way to hide camera ray visibility local to a render layer and not globally to the entire scene?

What I have done is when all my render layers are finished. I composite them, then go to the render layer that I need to hide the object from camera. Go to object properties and check off camera ray for that layer and re-render that render layer.

But If were to animate the scene, this would not be an option because the object would be hidden from all my render layers when I only want it hidden from a couple.

It seems like there should be way to check off camera ray visibility per layer in the scene settings.

Maya-style per-property layer overrides would be great for this. In the meantime, you can put the object on its own layer and uncheck it from the render layer using the descriptively-named “Layer” set of layer flags. (That would be the set of layer boxes in the top right). Quick overview of how those flags work:

Scene: If checked, layer is exported. Unlike the other 3, this option is shared by all render layers, and by default, the viewport!
Layer: If unchecked, layer is invisible to camera rays
Exclude: If checked, layer is not exported, regardless of its other layer flags
Mask: If checked, layer has the “holdout” shader to camera rays (matte color is always black, iirc).

Yeah…I have all my render layers set up, masked and all that. The issue is being able to hide something from camera per render layer while still getting all the shadows and reflections cast onto the other objects. If I uncheck a layer from the layer boxes, the object that is unchecked has zero influence on the scene. I still need shadows and reflections from the layer that is off. If I uncheck camera ray in the object properties it is global. I do not want that either.

I will post a couple of images showing what my issue is.