Sign in to follow this  

skeletal animation question (interpolation)

This topic is 3660 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

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

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 3660 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.

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