Ok, I solved it.
Here is my matlab code to recalculate the inverse binding matrix from the sample data above. It helped me understand further what the BM is. Maybe you could sticky this info in some form marcus as it would help anyone trying to write an exporter from “raw data”.
Note: That I have left out a few transforms since their angles were 0 and not necessary in the verification.
TA1 = [1.000000 0.0 0.0 0.0 ; ...
0.0 1.000000 0.0 4.363676 ;...
0.0 0.0 1.000000 -1.020067 ;...
0.0 0.0 0.0 1.000000];
angleZ = -81.926788;
angleY = -3.109476;
angleX = 0.0;
angleX2= -150.000000;
TB1 = [[eye(3) ; 0.0 0.0 0.0 ] [0.450181 0.049889 0.340342 1.0]'];
TB2 =[cosd(angleZ) -sind(angleZ) 0.0 0.0 ; sind(angleZ) cosd(angleZ) 0.0 0.0 ; 0.0 0.0 1.0 0.0 ; 0.0 0.0 0.0 1.0]
TB3 = [cosd(angleY) 0.0 sind(angleY) 0; 0.0 1.0 0.0 0.0 ; -sind(angleY) 0.0 cosd(angleY) 0.0 ; 0.0 0.0 0.0 1.0]
TB4 = [ 1.0 0.0 0.0 0.0 ; 0.0 cosd(angleX2) -sind(angleX2) 0.0 ; 0.0 sind(angleX2) cosd(angleX2) 0.0 ; 0.0 0.0 0.0 1.0 ]
T1= TA1*TB1;
T2 = T1*TB2;
T3 = T2*TB3;
T4 = T3*TB4; % Calculates the Binding Matrix for l_hip
inv(T4) % The inverse binding matrix
This code was written according to the following as before I was trying the pre multiplication mentioned earlier in the same topic by the same person but using his definition for post multiplication I managed to finally get the right values and verify that it is the post multiplication that I needed:
The full topic is here: https://collada.org/public_forum/viewtopic.php?f=12&t=1249&p=4523&hilit=transform+order#p4523 . Read this to see how TA1 and TB1 are the hierarchy of node transformations.
For post-multiplication:
M = (T1A x T1B x T1C) x (T2A x T2B x T2C) x (T3A x T3B x T3C)
wv = M x v
v = vertex in local space
wv = vertex in world space
For OpenGL:
glMultMatrix(T1A);
glMultMatrix(T1B);
glMultMatrix(T1C);
is equal to
glMultMatrix(T1A x T1B x T1C);
For <translate> to <matrix> conversion:
<translate>2 3 4</translate>
is equal to
<matrix>1 0 0 2 0 1 0 3 0 0 1 4 0 0 0 1</matrix>
For OpenGL:
GLfloat T1A = {2, 3, 4};
glTranslatefv(T1A);
is equal to
GLfloat T1A = {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2, 3, 4, 1};
glMultMatrixf(T1A);
Mark, does this make sense?
Herbert
Thanks for your help marcus