# skeletal animation question (interpolation)

This topic is 4002 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 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 on other sites
First of all thanks for the reply!

Quote:
 Original post by kaunaSo, 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 kaunaOne 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 on other sites
Quote:
 Original post by GodlikeI 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.

1. 1
Rutin
40
2. 2
3. 3
4. 4
5. 5

• 18
• 20
• 12
• 14
• 9
• ### Forum Statistics

• Total Topics
633363
• Total Posts
3011514
• ### Who's Online (See full list)

There are no registered users currently online

×