13
$\begingroup$

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!

$\endgroup$
  • 1
    $\begingroup$ 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. $\endgroup$ – Duarte Farrajota Ramos Sep 20 '17 at 17:28
11
$\begingroup$

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.

pass index

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.

add drivers to outliner

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 :

animated

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.