• Advertisement
Sign in to follow this  

custom skeletal animation format

This topic is 4345 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've recently been experimenting with rendering skeletal animation as described in Tom Miller's "DirectX 9 Graphics and Game Programming Kickstart" and had some difficulty getting anything to run. I finally was able to get something on screen, but it was all horribly wrong for some unknown reason, and it only rendered when I had something else on screen. Otherwise it would give me a weird AccessViolationException on the varible used in a for loop (don't know if there's a term for that little guy). So I figured maybe it was a problem with code, seeing as how the book was written in 2003(?). So off to the SDK samples I go and after taking out what I needed from there, I got the same results as previously. So while apparently possible, I'm finding the .x format extremely confusing to work with. I did a little research, or attempted to do a little research, rather, and wasn't able to come up with much. So I've decided to take a stab at making a skeletal animation format that only includes what I need in it and was wondering if anyone here had any recommendations or advice as far as what needs to go into a format such as that at a bare minimum. Also any pitfalls I should be aware of or things that would make my life easier while doing this? Many thanks. -AJ

Share this post


Link to post
Share on other sites
Advertisement
Hey,

Wonderful idea! There is no better way to learn all the ins and outs then doing it yourself. Not only will it teach you much more but you can add complexity one step at a time. For example, you can start with exporting a cube and rendering it to the screen. Then next do two cubes attached by a joint and get rigid binding working correctly. Then add skinned weights to the verts and get that working. Before you know it you'll have bone masked, skinned, blended, and ik up and running!

As far as what type of format to go with? I'd just go with human readable so you can go through the file and see if there are any errors with your exports.

Good luck and have fun!

Share this post


Link to post
Share on other sites

I did this a while ago using ASCII. Not sure if it was the best way but it worked for me. I used blocks to represent the tree structure, after each bone was written out I wrote flags to mark the beginning and end of the list of child bones

{ bone 1 childlist begin
// some bones
} bone 1 childlist end

then when the reader comes across them it knows to call down() and up() on the write iterator for my tree class. each bone consisted of its origin relative to its parent and its transform data relative to that origin. To make life easier when reconstructing skeletons I also stored the accumulated origin and transform data relative to the model. You can work this out as you go but its easier to just read/write it and it's not a performance critical bit of code anyway.

I stored skins in seperate files which allows me to apply different skins to one skeleton and its corresponding animation data (skins are just a big list of all the verts, each one stating the bones it is linked to and the weight for each one).

Anyway, like I say, not necessarily the best way... just the way I did it at that time :)

Share this post


Link to post
Share on other sites
Thanks for the replies, guys. That looks like some really good info. I just need to know more about these 'weights' I keep seeing mentioned. What are they and how are they used? I mean I'm assuming they are values that affect the way the animation plays out, but in what way do they affect it? Thanks.

-AJ

Share this post


Link to post
Share on other sites

A vertex may be affected by more than one bone to achieve a soft body feel to the animation. Around the elbow, for example, verteces are usually transformed by a combination of the upper arm and lower arm bones. weights for any one vertex usually add up to 1.

Using weights in your animation is easy as you can simply get the position for the vertex as transformed by each bone that affects it then do linear interpolation using the weight values as your percentage argument.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement