Set position/orientation

this is a question not specific to Panda3d (I think).

Assume a scene graph with two nodes at the lowest level. One (render/player) is quite simple, perhaps a single NodePath with half a dozen children, or no children at all. The other one (render/environment) is highly complex, with hundreds of children stacked in several levels.

Now I want to move one node relative to the other. This can be done in two way: setting position/orientation of the player, or setting position/orientation of the environment.

The question: which one is faster?

My intuitive answer would be that moving the player is faster, since the environment is more complex and more matrices have to be set. But I don’t know much on how scene graph transformations are implemented and which operations are executed each frame for rendering the scene graph, so the intuitive answer might be wrong and both are about the same.


I would go with your intuitive guess also, either both are about the same or moving the player is faster cause you´re moving less geometry. It´d be surprising if moving the environment was faster.

I too think there are only two options: (1) moving player is faster, or (2) both are the same.

I think the question is about how nodes store their transforms. Relative to their parent node, or absolute (relative to a world space).

Assuming each node stores its transform relative to it’s parent. Then it would be setting 1 transform in both cases (render-to-player, or render-to-environment). All other parent/child transforms stay the same. But then for rendering all scene graph transforms have to be evaluated each frame to find the absolute transforms (???). In this case both options would be the same, I think.

The other way would be that each node stores it’s transform relative to the scene graph root. In this case setting a node transform would require to adjust the transform of all it’s children. Setting would be slower for a node with many children obviously. Rendering itself would be just to read the absolute world space transforms for each node and then only have to transform them to the camera space (or whatever ???). Rendering might be faster this way.


Because Panda supports instancing, where a given node might have multiple different parents and therefore multiple different net transforms from the root, it is impossible for each node to store its net transform. Thus, each node stores its relative transform only, and either option is the same.

Of course, there is also a transform cache, which must be recomputed. But you blow that cache away every time you move the camera, so I wouldn’t worry about it.


Thank you for your explanations, David and chombee. I did a small test and my empirical result is, too,that both ways are about the same.