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

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

## 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 on other sites
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 on other sites
Quote:
 Real-Time Rendering, Second Edition, page 51When 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 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 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.

1. 1
2. 2
3. 3
Rutin
18
4. 4
5. 5

• 13
• 14
• 9
• 9
• 9
• ### Forum Statistics

• Total Topics
632925
• Total Posts
3009238
• ### Who's Online (See full list)

There are no registered users currently online

×