Using PandaNodes as "scene" control

Essentially, I want to use an empty PandaNode in the SceneGraph as unity-like “scenes”. So that I can view a group of objects, then “change scene”, and render another group of objects instead. So I have a “Start Menu”-scene, “Ingame-scene”, ect.

But when a append objects to children of the render-node, they are no longer rendered.

For example, using a flat structure like:


Renders the text node fine.
But using using the empty PandaNode “start_menu” as a node in the SceneGraph tree.


Renders nothing. All I do is change the node’s parent from the root node “render”, to my empty node “start_menu”.

So, how do I make my game render the children of nodes that is not the root node.

Are there any render state applied to your scene node (the empty pandaNode) ?
If not, maybe you can try with something like “render.attachNewNode(‘myScene’)” and try again to attach your textNode to this one, see if it shows on screen

1 Like

render itself is scaled to work well with 3D models. For UI elements like buttons, texts etc, you’d usually use the base nodepath (NP) render2d or pixel2d (dependent on whether you want pixel scales or aspect ratio -1 - 1 scales).
You can of course have anything in the render tree, but then your start_menu NP should be scaled accordingly and you may also want to have it always face the camera, if you don’t want to place your UI in the actual 3D space.
But usually, if you put UI elements in the render graph, they are either to large, to small or not facing the camera. I also guess you put an actual text in your TextNode, otherwise there won’t be text to render anyways.

You may have a look at this part of ShowBase to see how the default nodepath for pandas UI is set up: panda3d/ at 92185bcb2843302081dd9fae3f15cb4b403316db · panda3d/panda3d · GitHub

1 Like

Hmm… This implies to my mind–as FRPS_Archy says–that there’s some state applied to “start_menu” that is preventing “-TextNode” from being rendered.

Is “start_menu” perhaps hidden? Or placed at some location that puts it outside of the camera’s view? Or even rotated such that you’re seeing the back of “-TextNode”…?

1 Like

Ah, makes sense.

I ended up adding an additional PandaNode to the scene class that is appended to render2d branch, instead of the normal render branch. So that I have a node specifically for UI, in scenes that require custom UI. like the start menu. This solved my issue, and the buttons are now visible.

UI won’t work when appended directly to render2d. You can’t click on it. The location will also be slightly different from what you would aspect if you created the UI without a “parent”.
It has to be appended to aspect2d, which is a child of render2d. So the final location for UI in the SceneGraph ended up being:


Thanks for all the helpful answers!

1 Like