# Make an object invisible to a specific camera? (Cycles)

I'm trying to set up multiple cameras for a scene set in a room. Is there a way to link object visibility to a specific camera? Ideally, a wall or ceiling would not render if it were in the way of the specified camera.

I've tried to get around this by keyframing Restrict Rendering, but that gets difficult to keep track of. I've also tried adjusting the clipping plane, but that clips too much and would also need to be keyframed if the camera moves.

Thanks!

• This is not possible as far as I know. Common workflow is to use several scenes instead, each with linked objects but different active cameras. Remove undesired objects on each one. – Duarte Farrajota Ramos Sep 20 '17 at 17:28

This is possible using Drivers similar to the method described in the answer to How to change world background based on active camera?

You should set the Pass Index for each of the Camera objects so as to identify each camera.

Then add the driver to the visibility of the object being controlled - either the eye icon in the Outliner or the Camera icon - depending on whether you want to control the visibility only in the 3D view or in the final render.

Set the Driver expression to :

bpy.context.scene.camera.pass_index == n


Where 'n' is replaced with the pass_index of the camera from which you want that object to be hidden. Repeat for each object, specifying the relevant 'n' for each driver as appropriate.

Changing the active camera should now hide the object from view. Note that the driver will not necessarily update the visibility but will be updated on the next frame change - so animating the change in active camera on a specific frame will now automatically change the visibility of the objects.

Here I had 4 cameras positioned around the objects - with Pass Index of 1,2,3,4 - with the visibility of the objects (Cone, Cylinder, Torus, Icosphere) driven appropriately and the active camera changing on each marker :

• Brilliant! Works perfectly. Thanks for your help! – kopi_bon Sep 20 '17 at 21:49