PDA

View Full Version : How to calculate palette matrix from Colladamatrix

fearmenot
02-16-2010, 09:15 PM
Hi everyone,
I want to write a program to read skeletal animation in a Collada file, then render it using OpenGL. In Collada spec is :
outv = SUM (( v * BSM ) * IBM[i] * JVM[i]) * JW )
where
n : The number of joints that influence vertex v
BSM: Bind-shape matrix
IBM[i]: Inverse bind-pose matrix of joint i
JMi: Transformation matrix of joint i
JW: Weight of the influence of joint i on vertex v

I read these matrices, calculated each vertex using the above equation and render the animation successfully . But now I want to port the code using matrix palette to boost the performance. The spec in matrix palette says :

(xe) n-1 (xo)
(ye) = SUM w_i * M_i * (yo)
(ze) i=0 (zo)
(we) (wo)

where
M_i = MatrixPalette[MatrixIndex[i]],
if MATRIX_PALETTE_OES is enabled
w_i = weight_i, if MATRIX_PALETTE_OES is enabled

My question is how to calculate M_i from IBM[i] and JVM[i] ? I think this is a math question because I have an equation:

SUM (( v * BSM ) * IBM[i] * JVM[i]) * JW ) =
tranpose (SUM w_i * M_i * transpose(v))
where :
transpose (v) is the transpose matrix of v
w_i and JW are the same

Please help , I am not good at 3d math . I have tried M_i = IBM[i] * JVM[i] or M_i = tranpose ( IBM[i] * JVM[i] ) but it doesn't seem right.
Note that all matrix is 4x4 and vector is 1x4.

Thanks