Writing Animation Data to XML

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Alopex
Posts: 41
Joined: Sat Sep 12, 2015 10:12 pm

Writing Animation Data to XML

Post 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.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Writing Animation Data to XML

Post 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.
Alopex
Posts: 41
Joined: Sat Sep 12, 2015 10:12 pm

Re: Writing Animation Data to XML

Post 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.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Writing Animation Data to XML

Post 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.
wing64
Competition winner
Posts: 242
Joined: Wed Jul 23, 2008 2:35 am
Location: Thailand
Contact:

Re: Writing Animation Data to XML

Post 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.
Alopex
Posts: 41
Joined: Sat Sep 12, 2015 10:12 pm

Re: Writing Animation Data to XML

Post 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?
wing64
Competition winner
Posts: 242
Joined: Wed Jul 23, 2008 2:35 am
Location: Thailand
Contact:

Re: Writing Animation Data to XML

Post by wing64 »

Bone count and animation length will tell you about that.
Binary format is good handle for long key frame.
Alopex
Posts: 41
Joined: Sat Sep 12, 2015 10:12 pm

Re: Writing Animation Data to XML

Post by Alopex »

What would be a good tool for writing information into binary and then reading it, assuming that's how it works?
wing64
Competition winner
Posts: 242
Joined: Wed Jul 23, 2008 2:35 am
Location: Thailand
Contact:

Re: Writing Animation Data to XML

Post by wing64 »

Depend on your algorithms.
Alopex
Posts: 41
Joined: Sat Sep 12, 2015 10:12 pm

Re: Writing Animation Data to XML

Post by Alopex »

My understanding of C++ and of Irrlicht is still basic. What algorithms are you talking about?
wing64
Competition winner
Posts: 242
Joined: Wed Jul 23, 2008 2:35 am
Location: Thailand
Contact:

Re: Writing Animation Data to XML

Post 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 ?
Alopex
Posts: 41
Joined: Sat Sep 12, 2015 10:12 pm

Re: Writing Animation Data to XML

Post 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.
wing64
Competition winner
Posts: 242
Joined: Wed Jul 23, 2008 2:35 am
Location: Thailand
Contact:

Re: Writing Animation Data to XML

Post by wing64 »

How about unreal psa format ?
Alopex
Posts: 41
Joined: Sat Sep 12, 2015 10:12 pm

Re: Writing Animation Data to XML

Post 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.
Alopex
Posts: 41
Joined: Sat Sep 12, 2015 10:12 pm

Re: Writing Animation Data to Binary

Post 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.
Post Reply