Different lights for different cameras

Hi,

I’m rendering a scenegraph multiple times from different angles using separate cameras. I would like the lighting that’s applied to the scene to be different in each camera.

I’ve set the CameraMask on each camera and tried to hide() the lights from cameras in which those lights shouldn’t be applied, in a naive attempt to control whether those lights are traversed by the renderer. But that didn’t seem to have any effect.

How do I properly control lighting on a per-camera basis?

One tactic I haven’t tried is to instance my entire scenegraph to a new parent for each camera and apply the lighting to that per-camera parent. But that seems like a wasteful hack.

Right, hiding a light doesn’t disable it. The light object itself is invisible anyway, so showing or hiding the light itself has no meaning. What you want to do is to remove the light from the render state, which is something different.

To do this, you need to be able to set a different render state for each camera. The trick you suggest, with instancing the scene graph to a different node for each camera, would actually work fine, and wouldn’t be particularly wasteful. But there is a mechanism built into Panda to handle a different render state on each camera, as described (rather poorly) in Multi-Pass Rendering in the manual.

David