Hi Panda3D community,
I have just learned how to code in Panda3D. I have some issue with Actors. Basically, I want to have 30 animated characters. They are actually the same character with the same animation set.
I want each of the character plays a different animation (depending on the code logic) at any time. However, if we load a new copy each time, it seems a little bit redundant, because basically they are the same model/animations.
I have read from Panda3D website. It is said that, we can use something like instancing (using instanceTo()). However, looking from the document, it seems I can only modify the attributes that are tied to the node path and I’m not sure whether I can play a different animation for each character.
Do you guys have any solution for this? Thanks.
AFAIK is instancing only usefull if
This is not true in your case. Therefore you have to handle each Actor on its own. If two or more actors do the same thing at the same time you have to reconsider instancing.
When I load 10 static models, render.analyze looks like
10 Geoms, with 1 GeomVertexDatas, appear on 10 GeomNodes
When I load 10 actors, render.analyze looks like
10 Geoms, with 10 GeomVertexDatas, appear on 10 GeomNodes
IMO that is not ideal. An engine only has to store one matrix per bone per actor, but to be honest I don’t understand the internals of Panda3D very well (looks to Josh & David).
Unless you take advantage of hardware vertex animation, which is either going to severely limit the number of joints you can animate, or force you to write a complex shader to do the animation, then Panda will perform the animation on the CPU. This requires having a different copy of the vertex data for each differently-animated actor.
Note that this is not really too bad an arrangement. You’ve got lots of memory on the graphics card for vertices (the vertices are typically something like 1% of the total memory of your scene; the vast majority of graphics memory is taken up by textures). You might as well use that memory. It doesn’t do any harm to have 10 different copies of one particular actor’s vertices, and it will still render as quickly as if you were using the same vertex data 10 different times.