Page 1 of 1

Writing Animation Data to XML

Posted: Sat Oct 03, 2015 2:50 pm
by Alopex
I have been trying to figure out a way to store animation data separately from my meshes (or rather, to make it easier to edit animations and to avoid the use of useAnimationFrom). I plan on several characters/creatures that use the same skeleton, and many of these characters will be made of different pieces (see here). Reading a bunch of different topics, I know that it is possible to extract animation data (bone loc/rot/scale keys) and write it to an XML file. I just don't know everything I need to extract, how to extract it, and how to apply the data to another mesh.

I plan to write an irrlicht program that will load my animated meshes (.b3d), get the important data from them, and write it to an XML file.

What I want to know is:

1. What does "animation data" comprise? Is it just the loc/rot/scale keys of each bone?
2. Where is the information stored?
3. When I have the information and have written it to my xml file, what is the best way to store that information in-game? From there, how do I apply it to another mesh?

Thank you all for your time.

Re: Writing Animation Data to XML

Posted: Sat Oct 03, 2015 11:08 pm
by mongoose7
1. Yes.
2. In the 'Joint's.
3. First work out how you will use it, then you can define the structures. Look at the SmartBody example to see how to apply an animation to a mesh.

Re: Writing Animation Data to XML

Posted: Sun Oct 04, 2015 12:54 am
by Alopex
1. Good.
2.ISkinnedMesh, right? Or IBoneSceneNode?
3. I think I've seen someone mention something about that before, but I don't know where to find that example.

Re: Writing Animation Data to XML

Posted: Sun Oct 04, 2015 2:23 am
by mongoose7
2. Grep for 'Joint' in the header files. Bone scene nodes are not part of the animation system, they just provide access.
3. Try Project Announcements or use the Search box at the top right.

Re: Writing Animation Data to XML

Posted: Sun Oct 04, 2015 11:06 am
by wing64
3. If your problem 1 and 2 are solved then you decided xml as main format for your animation data. Just my 2 cents, xml is not the best way to keep animation key frame because if you have much more key frames then you will pay overhead both file size and loading time but if you dont care about that or you have no long key frame animation, xml is not bad for this case.

Re: Writing Animation Data to XML

Posted: Sun Oct 04, 2015 3:23 pm
by Alopex
@wing64

What do you consider to be too many keyframes?

If I did in fact have too many, what would be a better way to store the information, in your opinion?

Re: Writing Animation Data to XML

Posted: Mon Oct 05, 2015 1:49 am
by wing64
Bone count and animation length will tell you about that.
Binary format is good handle for long key frame.

Re: Writing Animation Data to XML

Posted: Wed Oct 07, 2015 12:11 am
by Alopex
What would be a good tool for writing information into binary and then reading it, assuming that's how it works?

Re: Writing Animation Data to XML

Posted: Wed Oct 07, 2015 10:35 am
by wing64
Depend on your algorithms.

Re: Writing Animation Data to XML

Posted: Wed Oct 07, 2015 1:01 pm
by Alopex
My understanding of C++ and of Irrlicht is still basic. What algorithms are you talking about?

Re: Writing Animation Data to XML

Posted: Thu Oct 08, 2015 2:13 am
by wing64
Dont worry about that my friend, write data to binary file is basis c/c++ you can find information by google but Firstly, your main points are understand irrlicht joints system and port data to your own file format. In my opinion b3d format is good enough for almost casual game. I'm not sure, Did you try b3d in your game ?

Re: Writing Animation Data to XML

Posted: Thu Oct 08, 2015 4:39 pm
by Alopex
I/O stream stuff. Okay.

Yes, I have tried B3D. The format isn't the problem; I am just wanting to handle animation data in a way that Irrlicht doesn't typically allow for, without having to patch Irrlicht. I want to store animation data separately from my rigged mesh, so I can manage animations a little more easily. I would like to keep each animation in a separate file.

Re: Writing Animation Data to XML

Posted: Sat Oct 10, 2015 2:50 am
by wing64
How about unreal psa format ?

Re: Writing Animation Data to XML

Posted: Sat Oct 10, 2015 1:39 pm
by Alopex
I honestly don't want to mess with anything pertaining to unreal engine. Keeping track of licensing obstacles is already getting tedious.

That is what I'm needing, though. Since my basic male human skeleton contains around 30 bones and a lot of the animations are 80 or more frames, a binary format is probably the only feasible option.

Thank you.

Re: Writing Animation Data to Binary

Posted: Thu Oct 15, 2015 3:07 pm
by Alopex
Edit: I wrote some code to help me extract animation information from my B3D files. It appears to be working. I just wrote a binary file of 18 KB, which seems the appropriate size. Now, I need to make my actual game read and apply this data. Thank you all.