how to "flatten" animated objects?

while thinking about an efficient way how to compose the characters for a mmorpg game i came across one big problem.
mmorpg’s have lots of players, and each of them puzzled together of multiple objects and each waring different clothes/armor and carrying different weapons.
since we all know it’s terrible inefficient to upload thousands of small models seperately into the graficcard i’m looking for a way to “build” a character, “flatten” it (like you would do with static geometry) and then load it.

building the character and displaying the result is no problem. but to flatten the parts together seems to be difficult.
any ideas how to produce more grafic-port friendly animated models?
since i havent found a fitting function in panda i thought about manually reading the needed vertexdata from each modellfile and put together a new-temporary character writing those together.but i fear this could be pretty slow since a new model has to be created everytime a item changes and egg files are not very fast to read.

i’m happy for every suggestion since this can give a immense performance boost.

thomas e

You don’t have to load the vertexdata from egg. You can transfer the vertexdata of any already loaded model stored in model pool. It is fast, since the transfer process is done in memory, without any HD access involved. Just like –[THIS]–

looks very promising =) thx a lot.
thought it’s a little bit difficult to understand all the geomnode vertexdata thing.
do you have a piece of code-example which “appends” those vertexdata from one model to another one (including the bone-weights and so it can be uploaded to the graficcard in one bunch)?

Try just loading the model, setting it up the way you want by parenting in the right pieces (or removing the pieces you don’t want), and then calling model.flattenStrong(). It’s designed to work with animated characters, and it will collapse your graph into as few nodes possible.

We’ve been putting some code to make this even more effective than it already is in upcoming versions of Panda.


it’s really a releif to hear that it should work.
and what exactly can i flatten together?
i mean is it possible to flatten several single models files where each has bone-weights assigned or is it just possible to flatten one animated model with “static” objects attached to it’s bones (using reparentTo() )?

In the current, bleeding-edge cvs version codebase, you can actually flatten together multiple different Actors. If they are able to flatten fully, they will become the same NodePath, but they will remain independent Actors, and they can continue to be animated independently–even though there is only one node between them.

You actually can flatten anything but static nodes reparented into the joint hierarchy (that is, if you expect those static nodes to continue to animate along whatever any joints you parent them to). But if you have multiple different animated characters, for instance a character and his optional clothing might be set up as different characters, each with a similar joint hierarchy–you can flatten them together.

Or, you can model a character with all of his optional clothing on at once. Then when you load the character, you grab all the clothes he’s not wearing, and remove it, leaving only the clothes he’s wearing. Then flatten.

This also works, to a lesser extent, in the 1.3.2 version of Panda.


soudns very exiting :slight_smile:
thx for the detailed information. this will be of good use since it’s exactly what we need(in near future).