• Advertisement
Sign in to follow this  

SLERP: How do I interpolate an arbitrary number of quaternions?

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

At the moment I am blending animations. When I only blend two animations, it is easy with SLERP. However, what if I want to blend more than that? For instance, lets say we got three animations with the following weights: Walk = 0.2f Run = 0.5f sidestep = 0.3f With a quaternion for each animation, how do I blend these three? What I am aiming for, is a solution that can deal with an arbitrary number of quaternions being interpolated.

Share this post


Link to post
Share on other sites
Advertisement
We were discussing this here about a week ago. Numerous people (including myself) suggested solutions, none of which turned out to hold water. It bears mentioning, however, that quaternions are commonly lerped and normalized rather than being fully slerped; this produces results which are not mathematically correct but may be good enough...and there's a much clearer method of lerping more than two quaternions at a time than there is of slerping them. You may want to try that.

Share this post


Link to post
Share on other sites
Quote:
Real-Time Rendering, Second Edition, page 51
When more than two orientations, ..., are available, and we want to interpolate from q0 to q1 to q2, and so on until qn-1, slerp could be used in a straightforward fashion.

...

This will cause sudden jerks to appear in the orientation interpolation, which can be seen ...

...

A better way to interpolate is to use some sort of spline.


And then follows an equation that would be hard to write down properly in html, in the few minutes I have.

Note: I have no experience with this, I was just reading this page of the book today.

Share this post


Link to post
Share on other sites
First you should scale the quaternions according to its blending weight. This can probably be done in many ways, but one is by interpolating between the identity quaternion and the current quaternion according to blending weight.

Second you can simply multiply the resulting quatenrions together. As they are already scaled and assuming the total weight is one, the resulting quaternion represents the combined rotations.

This was tested and works deliciously.

Illco

Share this post


Link to post
Share on other sites
Check out this article over at Gamasutra (free registration required). It provides a method for blending multiple animations using unitized weights, and since it's based on interpolation you can use lerp or slerp. I feel like it's very similar to the method Illco suggested, but manipluates the effective weights in such a way that you can stick with interpolation and avoid combined rotations.

But in general make sure not to confuse interpolation and blending. You used the terms almost interchangeably but they're not the same thing.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement