Per-camera object visibility?

Hey all,

Is there a way to control the visibility of models on a per-camera basis?

For example, here’s what I’m trying to do… I have a two-camera split-screen setup, where each screen shows the POV of one character. I’m using motion trackers to control the movement of the characters’ hands. The hands, when viewed from a 1st-person perspective, look fine, but when viewed by the other character, appear way too far away from the character. The solution, I think, would be to render one pair of hands in the 1st-person camera and an alternate, closer pair of hands in the other character’s camera. (Or, I might move the 1st-person camera outside the character’s head, but then I’d still need to hide the body in that camera.)


BVW 2009

The bottom of the Common State Changes manual page briefly mentions using camera masks for this purpose. This page is a little bit confused, though.

The basic idea is that you assign a unique bit to each camera, using Camera.setCameraMask(). Then you can use nodePath.hide(bitmask) and to hide and show a node from a particular camera or from a set of cameras.

This operates in a different space from nodePath.hide() and without parameters. When you call nodePath.hide(), it is hidden globally, which is different from hiding or showing it from a particular camera. If a node is hidden globally, it is always hidden, regardless of its per-camera settings.


Works perfectly! Thanks for the ridiculously quick reply.