Jump to content
  • Advertisement
Sign in to follow this  
RobMaddison

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.

If you intended to correct an error in the post then please contact us.

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.

Thanks in advance

Share this post


Link to post
Share on other sites
Advertisement

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 this post


Link to post
Share on other sites

[quote name='RobMaddison' timestamp='1330264793' post='4916715']
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 this post


Link to post
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 this post


Link to post
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

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!