Sign in to follow this  
NumberXaero

lerp broke my animation blend?

Recommended Posts

NumberXaero    2624
I had read many posts and articles on lerp vs slerp (im using quaternions) and for my intermediate skeleton pose frame calculations when initially writing it I went with slerp and it worked fine. I later swapped it with lerp reading that the impact can be negligible, I didnt see any difference so stayed with lerp for the intermediate pose interpolation, lerp being less intense to calculate. I was just blending two test animations together, an idle to a crouched idle animation. I blended the two temporary skeletons using lerp on translation, rotation (normalized in, normalized result) and scale components. What I started seeing was that the feet of character was doing weird things and it always seems to be the toe bone/joint at the end of the foot. First the left foot only, it seemed to scale in on itself turning the foot into a vertical plane, so I changed from run to idle, to, idle to crouch idle, and both feet started shooting out to the side and then back, sometimes they seemed to spin 360 then back in place, the action wasnt the same each time, it was changing, so didnt seem to be a animation data specific problem or rig problem. I applied a scale to the blend time of one second and all the strange movements seemed to happen exactly at 0.5 in the blend time, thinking back to the run to idle combo, thats where it seemed to happen there too. So I double checked everything thinking it was the way I was doing the switch from src anim A to dst anim B. Rewrote how it changes over a few times, same result every time. So I switched to slerp for blending and the foot spinning stopped, they blended together as I thought they should. Id like to continue using lerp just because its simple and Ive seen it used for blending many times and no one else seemed to be having a problem this obvious. Is this something that should be expected with lerp, maybe something Im missing or should I be looking at other sections of code for a problem that slerp is hiding from me? maybe someone knows why it always happend at 50% between the two and why it only seems to affect the toe joints?

Share this post


Link to post
Share on other sites
alvaro    21246
Perhaps you should post your lerp code. It sounds to me like you might be linearly interpolating in between quaternions that have negative dot product.

Since q and -q represent the same quaternion, you could have two very similar rotations represented with quaternions that are very different, and then interpolation will not make any sense. This is why your lerp code should check to see if the two input quaternions have a negative dot product, and if they do flip one of them.

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