Skipping nodes that don't have a mesh / have children with a mesh

I load gltf files, I preserve the node hierearchy for my scene graph.
Then, when rendering, I work out the final xform and draw if there’s a node with a mesh attached.

This is nice.

However, I loaded a file with animations and it had hundreds of nodes that were related to animation and only a few nodes that had meshes attached to it / meshes attached to one of their children.
Is there a way to skip over nodes that don’t have meshes attached at any part of their hierearchy and are purely for animation? Is the only way to know this answer is to go down to every node’s child and check if atleast one has a mesh attached? Are there rules about gltf files to find this answer trivially? Maybe only leaf nodes can ever have meshes attached to them?

I know when I load a gltf file in engines like godot, the scene tree doesn’t have nodes that are purely for joints. That data goes elsewhere.

Any other suggestions?

Thank you

Hi @Mizu! I’m not sure if the nodes you’re mentioning are joints in a skin, or just animated nodes, but either way I think the answer is probably the same. There isn’t a shortcut guaranteed by the specification here — to find all nodes containing meshes, you would need to iterate over the complete list of nodes at least once. Some engines do represent armatures/skeletons as part of the same scene graph as the mesh geometry, and it is possible to attach meshes to any node, whether it is a joint or empty, animated or static, etc.

If you control the pipeline creating the models, or are willing to pre-process the models to optimize them for your engine, then you could enforce stricter requirements.