Sign in to follow this  
godmodder

The need for SLERP

Recommended Posts

Hi, I just implemented some skeletal animation again in my engine and it works splendidly. Problem is, every resource on animation on the net tells me I shouldn't use linear interpolation for my rotation quaternions, but I don't notice any weird "jerkyness" at all. In fact, I can't even spot a single difference between linear interpolation and SLERP. Could someone tell me how to reproduce a case where this occurs? Ofcourse I will use an advanced form of interpolation in the final code, but I want to learn which problems SLERP exactly alleviates. Thanks, Jeroen

Share this post


Link to post
Share on other sites
If you normalize the quaternions after linear interpolation, the only noticeable difference is variable angular velocity. Try interpolating between two orientations that are, say, 170 degrees apart, and you'll notice a speeding up-slowing down effect with linear interpolation.

Share this post


Link to post
Share on other sites
Thanks, Sneftel! I tried what you said and you are right. With big differences in rotations there is a visual distortion of the animation. But my game animations aren't that extreme. Anyway, should I use SLERP just to be "safe"?

Share this post


Link to post
Share on other sites
SLERP can be a pretty expensive way to "be safe". Of the well-designed animation toolkits I know well enough to opine on, none (okay, "neither") use SLERP; they use normalized linear interpolation. I'd say the best place to play it safe is in the tools: Search for inter-keyframe rotations above a particular angle, and if you find any, just insert extra keyframes.

Share this post


Link to post
Share on other sites
NOOO! Well, okay, as a last resort, but this is something you can do automatically. Just have the exporter check all the angles, and use slerp to generate interpolated ones as needed.

Share this post


Link to post
Share on other sites
Ah, ok. I'm sorry I misunderstood you. Ofcourse, checking the differences between the rotations should be a cake. Thanks for the clarification. My artists will thank you for it ;)

Share this post


Link to post
Share on other sites
AFAIK there is another difference between nlerp (normalized lerp) and slerp that has an impact on animations: nlerp is commutative, while slerp is not. In other words the order of arguments has an effect on the result if using slerp. When interpolating between key-frames one can live with this. But it may make live easier for the artists and coders when it is not commutative.

EDIT: What the hell have I written there? What I meant is:

When interpolating between key-frames one can live with this. But in case of animation blending it may make live easier for the artists and coders when it is not commutative.

Thanks to Sneftel at hinting me to read my post more thoroughly next time, and to osmanb for the link discussing this in more depth.

[Edited by - haegarr on August 13, 2008 4:13:03 PM]

Share this post


Link to post
Share on other sites
The non-commutativity of SLERP doesn't matter for keyframed animation, since only a single SLERP is involved.

Share this post


Link to post
Share on other sites

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