View Full Version : Matrix blending using weights

McCLaw

03-05-2005, 07:32 PM

Hi All

I am in the process of implementing a Bone Blending animation class, but I have hit a math snag.

I have gotten to the point of getting all the interpolated matrices from the active animations, but I am unsure how to change them according to the weight of each animation, and then how to merge them.

PS: My math knowledge sucks, so speak to me like i'm a three year old :lol:

Any ideas will be greatly appreciated

JSoftware

04-05-2005, 09:02 AM

you could try just interpolate all the values in the matrices but this wouldn't really be very precise.. you could also extract the rotation vector of the matrices and then interpolate over these. i think most people use quaternions but i won't speak about those..(read: i have no idea of how they work)

i hope this was surely enlighting. i can try to fetch some links

McCLaw

04-05-2005, 09:11 AM

A friend of mine (Nitrogen) suggested that I do the following.

I take the matrix and scale it by the weight, and then add it to the final matrix.

finalmatrix = animmatrix1*weight1 + animmatrix2*weight2 + animmatrixN*weightN;

Only thing that might cause issues, is if the sum of all weights is higher than 1

I will try that tonight and see if it works.

I fear quats, so I dont want to jump in there at the moment.

The matrices I want to blend, are already interpolated versions of two keyframes for each animation.

does it sound like the above could work?

JSoftware

04-05-2005, 09:28 AM

you could eventually divide each weight by the sum of them to make the sum get 1.

McCLaw

04-05-2005, 11:32 AM

Ahh yes!

That would work :D

Thank you

Powered by vBulletin® Version 4.2.5 Copyright © 2019 vBulletin Solutions Inc. All rights reserved.