skeletal animation question (interpolation)

Started by
2 comments, last by haegarr 16 years, 4 months ago
Im creating a simple skeletal animation project in OGL and Im using blender to export the meshes, skeleton and animations. Im stuck a little in animations. The main idea is to export (from blender) the quats, locations (vector3), scales (vector3) for a number of keyframes and not for every frame of the animation. The problem is that I dont know how to interpolate between two keyframes (given the quat, loc, scale for these two keyframes). I've used slerp but the bones rotate from the center of the screen. If anyone knows how to calculate a matrix (or anything) between 2 keyframes please share it with me, it will be a live saver. Thanks in advance :D
-----------------------My Page: † AncienT RituaL †
Advertisement

Hi,

Using slerps to interpolate quaternions should be perfectly ok so the problem must be else where.

So, constructing the matrix should be as simple as converting the quaternion to 3x3 matrix, placing the position in it and scaling it.


One really important thing with the skeletal animation is to know whether the bone's orientation quaternion, position, scale is relative to the parent bone or to the object space. It is common to have these values relative to the parent bone (since it makes the system more flexible).

So, with the information available, my guess would be that you have forgotten to multiply your bone matrix with the parent's bone matrix. Of course, in this case it is also important to start processing the hierarchy at the top node.

Good luck!
First of all thanks for the reply!

Quote:Original post by kauna
So, constructing the matrix should be as simple as converting the quaternion to 3x3 matrix, placing the position in it and scaling it.

I use slerp between 2 keyframes and get the middle quat. I convert it to a 3x3 but what pos and scale should I use? keyframe 1 or keyframe 2? I mean I use slerp to interpolate the rotation but what should I use to interpolate position and scale?

Quote:Original post by kauna
One really important thing with the skeletal animation is to know whether the bone's orientation quaternion, position, scale is relative to the parent bone or to the object space.

They should be in object space

-----------------------My Page: † AncienT RituaL †
Quote:Original post by Godlike
I use slerp between 2 keyframes and get the middle quat. I convert it to a 3x3 but what pos and scale should I use? keyframe 1 or keyframe 2? I mean I use slerp to interpolate the rotation but what should I use to interpolate position and scale?

The "s" in "slerp" stands for spherical, what makes it suitable for rotations. Positions and scales are to be interpolated not on a sphere but a plane, e.g. by doing a lerp.

Regardless whether you interpolate a rotation, position, or scale, you have to decide whether you use linear, quadratic, cubic polynomial or spline interpolation, or what else (but not all kinds are directly supported by all transformation representations). That decision becomes recognizeable in the smoothness when the interpolation crosses over a sampling point.

Coming back to slerp rotations for keyframe interpolation, you might be interested in reading this article.

This topic is closed to new replies.

Advertisement