# Interpolating during animation blending

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

## Recommended Posts

I've read about the differences between slerp and nlerp and I get that, but I'm confused about blending multiple animations together.

Assuming I have one animation, I nlerp between the keyframe matrices (which I convert to quaternions to do the lerp) to find the correct pose - this works fine. When I want to blend between two animations, I nlerp between each of the keyframes which gives me the pose on each animation. Then I nlerp between those two resulting quaternions to blend between the two. This I understand.

What I can't get my head around is blending a third animation. Surely you can't lerp between two quaternions and then lerp between that result and the third? I did some sketches of this and it doesn't work.

##### Share on other sites

What I can't get my head around is blending a third animation. Surely you can't lerp between two quaternions and then lerp between that result and the third? I did some sketches of this and it doesn't work.

Sure you can. What seems to be the problem?

##### Share on other sites

What I can't get my head around is blending a third animation. Surely you can't lerp between two quaternions and then lerp between that result and the third? I did some sketches of this and it doesn't work.

Sure you can. What seems to be the problem?
[/quote]

If you draw an irregular triangle and try interpolating to 0.5 of point a and b and then from that point to 0.5 of point c, that won't give you 0.5 interpolation between all 3. This can be proved by interpolating between point b and point c and then interpolating that result to point a, it'll be in a different place.

Maybe I'm reading this wrong. For blending animations, shouldn't I be adding up each of the key frame animations' matrices, converting to quaternions and then nlerping between those two?

##### Share on other sites
You need to be able to compute weighted averages. You can then compute

T= 0.5*A+0.5*B
M = 0.66667*T+0.33333*C

Alternatively, you can add all three together and divide by 3, which works well if you are using nlerp.

##### Share on other sites

You need to be able to compute weighted averages. You can then compute

T= 0.5*A+0.5*B
M = 0.66667*T+0.33333*C

Alternatively, you can add all three together and divide by 3, which works well if you are using nlerp.

Got it - makes perfect sense now - thanks Alvaro

1. 1
2. 2
Rutin
20
3. 3
khawk
17
4. 4
A4L
14
5. 5

• 12
• 16
• 26
• 10
• 11
• ### Forum Statistics

• Total Topics
633758
• Total Posts
3013712
×