Render Tags or Something else

What is the best way to control an nodePath’s properties when being rendered with different cameras. Particularly is it possible to setShaderInput with one input when being rendered from the one camera and use another property when rendering from others. Could I also do this with lighting properties?

I know I can use renderTags is there any documentation on this? All I have is some old demo code.

It is possible to completely replace the render state of a node when it is viewed from a certain camera, although the interface for this is clumsy.

This is specified on the camera. The interfaces are:


This specifies an arbitrary render tag that will be used to control the state for nodes viewed with this particular camera. When a node is encountered in the scene graph with the specified tag key, the associated value for that tag will be used to match this:

camera.node().setTagState('value', RenderState)

This specifies the state that should be applied to the node with ‘key’:‘value’ in its render tags. This state will be accumulated in with the normal state inherited from the scene graph.

There can be multiple different values associated with the camera, each with a different RenderState. Thus, you can designate certain nodes that the camera sees that should be rendered in state A, and other nodes that should be rendered in state B, and so on.

The easiest way to get the RenderState object is to use a temporary NodePath for this purpose:

np = NodePath('t')
np.setShaderInput('foo', 1.0)
camera.node().setTagState('value', np.getState())

The temporary NodePath may be discarded after this operation; its only purpose was to provide an interface to use to build up the RenderState.

This is a terribly brief explanation of the render tag interface. I hope it is clear enough to follow. :slight_smile: