optimize same-skeleton Actors?

I have my characters and his clothing and accessories as separate files. Each has the same bone hierarchy and uses the same animation files. I load them and create Actors. Then I assign the same animation to each one and play them together.

Is there some optimization which can be done? My character can change clothing, so I don’t want to merge the Actors irreversibly, but the current design seems to end up with lots of unnecessary identical calculations.

egg-optchar can remove joints from an animation that are not used. For instance, it will remove the leg joints from a hat model. Of course, when you do this, the hat model no longer has the same skeleton hierarchy as the whole character, so it means you will have to replicate out the animation tables. You can have, for instance, a copy of the animation tables for hats, and another copy for coats, and another copy for pants, and another copy for the overall character. This will at least avoid the need to redundantly compute every single joint for all the pieces of clothing, at the cost of additional memory to maintain modified copies of the animation tables.

But this isn’t what you’re asking about. You want to load multiple different identical skeletons, each with its own geometry, and then merge the skeletons into a single skeleton that only has to animate once. This is actually supported, using the mergeLODBundles flag to the Actor constructor, but it is meant to be used for different LOD’s of the same model, rather than different pieces that are all visible at the same time.

It would no doubt be possible to finesse this system to also support different pieces that are all visible at the same time; you’ll have to be able to read the Actor code and understand how it uses the low-level Character and AnimBundle interfaces. Since you’ve been working in this space already, I think you’ve got a pretty good shot at this. :slight_smile:


Seems like the Actor class makes use of Character’s mergeBundles() method for the LODs.
panda3d.org/reference/1.8.0/ … 985c78c8d4

From the description I’m guessing the bundles have to be in one Character/Actor. I’ll need to do some testing…

Most of the bottleneck comes from skinning though, do you think merging identical skeletons will affect that as well? Wondering if it’s worth the time.