1
\$\begingroup\$

I'm trying to animate in-between keyframes for skeletal animation but having some issues. Each joint is represented by a quaternion and there is no translation component. When I try to slerp between the orientations at the two key frames, I got a very wacky animation. I know my skinning equation is right because the animation is perfectly fine when the animation is directly on a keyframe rather than in-between two.

I'm using glm's built in mix function to do the slerp, so I don't think there are any problems with the actual slerp implementation.

There's really one thing left that could be wrong here. I must not be in the correct space to do slerp. Right now the orientations are in joint local space. Do I have to be in world space? In some other space along the way? I have the bind pose matrix and world-space transformation matrix at my disposal if those are needed.

\$\endgroup\$
  • 2
    \$\begingroup\$ A code snippet may help, possibly with hard numbers showing the quaternion values at two keyframes and the value of the interpolation between the two. \$\endgroup\$ – MichaelHouse Apr 17 '12 at 21:22
2
\$\begingroup\$

Stumbled upon this post: http://www.gamedev.net/topic/605007-animation-transitions/

Interpolation doesn't work too well when the dot product of the two quaternions is less than 0. If this is the case, I just negate one of them and then do the slerp.

\$\endgroup\$
  • 2
    \$\begingroup\$ Note: this should be done by you, when you prepare your animation data. All quaternions stored in your animation should have a positive W component; that way, the interpolation will always go the "right" way (ie: the short path). \$\endgroup\$ – Nicol Bolas Apr 17 '12 at 23:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.