Animation keyframes
#1 Members - Reputation: 231
Posted 30 October 2012 - 05:02 PM
I was also looking at fbx and this stores much less keyframes. If you use some modeling program and set up about 5 keyframes on the bones it looks like it cubically interpolates between them over a long animation. If this animation was exported to md5 though, it'd generate all of the in between keyframes and have the game linearly interpolate between them. I could go from storing 5 keyframes to like 250.
Is there a reason to convert an animation with a small number of keyframes to a format that has many more? My guesses so far is that linear interpolation is much faster. Also it could be that the more complex animations, especially the ones that are motion captured, would effectively have a huge amount of keyframes anyway. The doom 3 animations definitely look very complex and full of constantly changing motion.
#2 Crossbones+ - Reputation: 5346
Posted 30 October 2012 - 06:29 PM
A compromise would be to start out with all 250 example key frames and eliminate redundant key frames.
This is fairly trivial to do.
Start with key frames 0 and 2 and linearly interpolate between them.
If the result is reasonably close to the value of key frame 1, eliminate key frame 1.
Repeat with key frame 1 and 3, checking to see if 2 can be eliminated.
When you reach a point where you can’t eliminate a key frame, repeat the whole process from that key frame.
For example if 2 cannot be eliminated, restart the process with key frames 2 and 4, checking for 3’s elimination.
You can adjust the accuracy tolerance to eliminate more key frames at the cost of playback accuracy, but you generally won’t be able to notice any inaccuracies at run-time unless they are huge.
L. Spiro
Edited by L. Spiro, 30 October 2012 - 06:31 PM.
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums
#3 Members - Reputation: 4037
Posted 30 October 2012 - 06:51 PM
In that sense it's still a viable technology for many model types. Not everything needs the full animation possibilities of a character or opponent, and simpler models can be quite reasonably handled with keyframes. If you're happy to eat the extra memory requirement (which - depending on the simplicity of the model - may not actually be overly onerous and may be hugely outweighed by the perf benefits) then it may be a great choice for certain classes of scene decoration objects.
It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.
#4 Members - Reputation: 841
Posted 31 October 2012 - 03:56 PM
I think most modeling programs allow you to use cubic bezier paths to define interpolation between keyframes. This makes it possible to have very small number of keyframes even for complex animations. But those keyframes/interpolations are usually defined for IK targets during animation and (at least for Blender) will be resampled to many keyframes with linear interpolation while converting animations to FK skeleton.
You can compact your animations to cubic or quadratic bezier interpolation, thus significantly reducing the number of keyframes but it requires a method to find local minima of arbitrary functions (some serious math). Or some optimization library (like LM).
First technology demo of my game Shinya is out: http://lauris.kaplinski.com/shinya
Khayyam 3D - a freeware poser and scene builder application: http://khayyam.kaplinski.com/
#5 Members - Reputation: 231
Posted 31 October 2012 - 05:40 PM
#6 Members - Reputation: 841
Posted 01 November 2012 - 02:51 AM
So right now it sounds like just linear interpolations may be the way to go after all. I was looking at some code for cubic interpolation and it looks a bit heavy. Also if this worked for Doom 3 in the year 2004, it's probably fine and not something that will cause huge performance issues today.
It will be storage issue, not performance issue. High-quality animations take a lot of space and thus the compression of keyframes is important.
But this probably is no-issue for most indie games where people do not have a budget for massive amount of scripted animations anyways...
First technology demo of my game Shinya is out: http://lauris.kaplinski.com/shinya
Khayyam 3D - a freeware poser and scene builder application: http://khayyam.kaplinski.com/






