Concat animations of a mesh with an other mesh

Post your questions, suggestions and experiences regarding to Image manipulation, 3d modeling and level editing for the Irrlicht engine here.
Post Reply
Soganatsu-Julien
Posts: 29
Joined: Fri Sep 21, 2012 10:18 pm

Concat animations of a mesh with an other mesh

Post by Soganatsu-Julien »

Hello everybody !

I'm currently breaking my balls on my laptop. I searched for 2 hours before posting this, so if an existing topic exists about this subject, I'm sorry xD

I have the following problem :
I found a cool mesh with 40 animations made with cinema4D. The folder contains one project per animation and the base project that contains the unanimated mesh.
Each animation project duplicate the base project. (looooooool).
So, I'm trying to load the base mesh (that contains its bones etc) with the .x loader and after I would like to concat all the animations of the other meshes with my base mesh. It's like I want to add keys to the existing joints of the base mesh I loaded.
I hope you understand lol.

So, I tried some methods, but finally don't understand how the ISkinnedMesh interface works, since it is not enough documented.

The method I'm searching is:

Code: Select all

 
ISkinnedMesh *myBaseMesh; // The base mesh unanimated but containing its bones
ISkinnedMesh *myOtherMesh; // That contains the jump animation for example
 
for each joint of myBaseMesh {
    for each joint of myOtherMesh {
        copyAnimationInformations(myOtherMesh to myBaseMesh);
    }
}
 
So, if myBaseMesh contains 100 animations and myOtherMesh contains 150 animations, I would like to have myBaseMesh containing 250 animations after the algorithm.
Can anyone tell me what is the road I have to take ?

Thank you !
CuteAlien
Admin
Posts: 9648
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Concat animations of a mesh with an other mesh

Post by CuteAlien »

Not sure if that's possible - at least not with a simple function. But maybe you can just keep all meshes around? Might be using little memory (don't know in your situation) and you can then use ISkinnedMesh::useAnimationFrom to animate the mesh you are using with any of the other animation files.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Soganatsu-Julien
Posts: 29
Joined: Fri Sep 21, 2012 10:18 pm

Re: Concat animations of a mesh with an other mesh

Post by Soganatsu-Julien »

Thank you. Yeah, the useAnimationFrom works fine and is what I'm using today. But this method requires a lot of memory because of the mesh duplications.
The other solution should be to merge all animations in Cinema4D but I can't find how to merge only animations :(
The other solution is to only export bones and animations into the .x file maybe, I'll try and tell you if it works !

EDIT :
Also a good behavior : when i add existing position, rotation, scale keys to myBaseMesh from myOtherMesh, and then call finalize() the mesh is just increasing its scale and did the addition when I call getFrameCount(), do you know why ? xD
Soganatsu-Julien
Posts: 29
Joined: Fri Sep 21, 2012 10:18 pm

Re: Concat animations of a mesh with an other mesh

Post by Soganatsu-Julien »

Ok, it works fine.
By using the useAnimationFrom, you can follow theses steps (if never told by an other developer)

Take your base mesh with its bones and animate it
Image


Delete the mesh and keep only the bones containing the keys


Image


Import in your scene the base mesh (even if it has animations in it, in my case my base mesh can only walk)


Image


Load the other mesh that contains only bones and keys (about 255Ko for me per file)
Call useAnimationFrom(myOtherMesh) and then :



Image

I have to re-code my bases x)

I really would like to add dynamically keys to my skinned meshes and then don't necessarily need an other file in the .x format to call useAnimationFrom.
I followed steps of the .X Loader and don't understand why it doesn't work :(
Btw, we have an alternative method.
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Re: Concat animations of a mesh with an other mesh

Post by christianclavet »

Hi, Be careful with that command. I used it before, and when you use it, it change all the references of the animations. It work fine on a SINGLE instance (player would be ok) but on multiple instances like NPC all their animation will be changed with the one you set.

To see what I mean, put 3 characters in your editor and try the command again, you'll see that all the 3 character have their animations changed.

Might be good if the dev later would also instantiate the animation data when we create an instance of the mesh (I think also that the mesh data is referenced, not tried it.). The way they designed it at first was noble as they were trying to keep memory footprint low, by not duplicating elements for nodes. But this put a constraint like that.
The other solution should be to merge all animations in Cinema4D but I can't find how to merge only animations :(
I got "Fragmotion" just for doing this, as I create the animations separately and then join them with this tool.

I've done tests with DirectX meshes and their animation data is played 10 times slower than other formats (.b3d). So I'm using only B3D now.
You world editor look really nice! :D
Soganatsu-Julien
Posts: 29
Joined: Fri Sep 21, 2012 10:18 pm

Re: Concat animations of a mesh with an other mesh

Post by Soganatsu-Julien »

Ahah yes ! I tried before you tell me, shitty function xD
I'm working on an other solution only with the code, to enable irrlicht users to merge different animations in one and not necessarily use an external software. I took a look on FragMotion, it looks cool !

I almost succeed when adding keys, but the scale of my node is juste increasing. Like a node->setScale(node->getScale() * log(x)), like the scale is converging.

Thank you ! I'm still waiting for your alpha test =P (event if I have to update and complete the documentation)
Post Reply