Sign in to follow this  

Animation storing dillema

Recommended Posts

Hello, guys and girls, I just created account on GameDev, I didn't find anything on world wide web to solve it or get an opinion(s) at least. For now Im reading 3d models (.x) with Assimp and follow this by storing them as my own primitive format, what I do with animations is just calculate final bones matrices for all animations key frames in vectors and do the saving/loading routine. But I faced a problem - in WoW (the game I'm lining on when doing animation stuff) the characters when not holding melee weapons have their palms straight and have fists clenched when holding any. With my current approach (vector of steady precalculated matrices, targeted to get combined to shader vector of matrices depending on upper and lower body actions) I don't see how to archive this effect (2 states of palms - clenched and relaxed), that's why I came to a question:

Is it worth keeping Assimp animation keys and nodes hierachy and calculate them on the fly (which I see as a solution for described above problem) and not to precalculate animations for further saving/reading/passing to shader?

 

In my case model has about 17 deforming bones.

Plus I have 6 additional non-deforming bones that Im using for hooked items goals - Im also storing them as precalculated vectors.

For now Im using just testing animations (1-2), average frames number is about 30.

 

Im also posing the question because the amount of animations is going to increase so thinking about performance first of all.

Thanks for all the tips and opinions :)

Edited by auraxarr

Share this post


Link to post
Share on other sites

The solution wow uses is called animation layers. Basically most organic things are able to do more than one thing at a time. And on observation, it is a combination of basic actions.

 

The easiest way to approach this is to simply override the animation of concerned bones.

Share this post


Link to post
Share on other sites

what I do with animations is just calculate final bones matrices for all animations key frames in vectors and do the saving/loading routine

 

This is bad for animation layers and also takes a lot of memory.

 

I suggest you only store the animated rotation keys as quaternions (1/4th of data), and a skeleton for the rest pose of the character.

To get positions you need to transform your skeleton hirarchy starting from the root bone (pelvis) by given rotation keys. E.g. parent bone (upper arm) rotates child bone (forearm) to get the position of the ellbow joint.

You should not need any scaling for character animation.

 

With this system it is easy to implement animation layers. For instance given one arm animation per weapon, you can apply this by lerping the correspondending quaternion key frames.

This way you can mix any number of animations together, also including procedural animation like pointing a gun to a target.

Share this post


Link to post
Share on other sites

Thanks for the reply mates, for now I decided only to store precalculated local matrices from Assimp keys (trans*rot*scale) and calculate globals through nodes vector on the fly, kinda 50/50 decision :) will come to its usefullness when recreate saving/loading and proper testing for this new  idea :)

Edited by auraxarr

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this