Animation

Started by
2 comments, last by L. Spiro 10 years, 2 months ago

So I'm currently implementing Animation in my code, after avoiding it for such a long time. I'm sort of torn between 2 ideas right now and want some more experienced peeps to guide me.

Is it better to load and export animations with a strict number of Keyframes and frame rate, or just use key key frames? lets say I have a simple animation that lasts for 1 second, I could export 30 frames of this animation, or 15 skipping every other, or some other rate that makes sense.

This means easy math upon playback. find my current time delta, lerp between the previous frame time and next frame time based on dt.

OR

I could brake up the transformation into rotation, translation and scaling components and only key frame the important stuff, using less data to store the animation. Say the object translates each frame at a consistant speed, but only rotates at the beginning, middle, and ends. so some frames may not require complete SQT transforms.

Now upon playback, I have to find the last key frame that was stored for each track(SQT) and the next frame for each. and then use some mathemagic to get the current key frame for each track to combine into a complete matrix again.

It seems that can trade some complexity and 3x the calculation time to save some data space and loading time. Am I right to think this is a bad idea?

Advertisement

1.) Using animations with a fixed frequency of key frames may produce a bigger memory footprint. Your animation sub-system should be able to deal with both fixed and variable frequencies. Then the decision is on the used DCC and toolchain.

2.) You should use separate tracks for orientation and translation (and perhaps scaling if you use it) anyway, because interpolation of combined transform matrices is possible but cumbersome and/or requires very small steps. How to combine them depends on what is animated. The animation should not know whether it is an animation of a bone or of a clock hand … it's just an orientation (as an example).

3.) For interpolation it plays no role how much 2 key frames are apart. Whether you look-up 1 time or 3 times where the next key frame is will probably also not be so different performace-wise.

1.) Using animations with a fixed frequency of key frames may produce a bigger memory footprint. Your animation sub-system should be able to deal with both fixed and variable frequencies. Then the decision is on the used DCC and toolchain.

2.) You should use separate tracks for orientation and translation (and perhaps scaling if you use it) anyway, because interpolation of combined transform matrices is possible but cumbersome and/or requires very small steps. How to combine them depends on what is animated. The animation should not know whether it is an animation of a bone or of a clock hand … it's just an orientation (as an example).

3.) For interpolation it plays no role how much 2 key frames are apart. Whether you look-up 1 time or 3 times where the next key frame is will probably also not be so different performace-wise.

Thanks for the speedy reply, so it seems that my 2nd option, though more cumbersome and slightly more performance intensive is the best as it allows for your #2. Back to the trenches I go

Thanks for the speedy reply, so it seems that my 2nd option, though more cumbersome and slightly more performance intensive is the best as it allows for your #2. Back to the trenches I go

It is not more performance-intensive—it is virtually always if not always the faster route in terms of run-time performance, and since it matches the output of your tool chains it is just the correct way anyway.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

This topic is closed to new replies.

Advertisement