I am having trouble calculating the inverseBindMatrices from .gltf files. My model displays correctly in gltf-viewer, but not in my engine.
Here is the node I have an issue with:
{
name: 'Base Bone',
rotation: [ 1, 0, 0, 0 ],
translation: [ -2.81376314163208, 4.689605236053467, 0 ],
inverseBindMatrix: Matrix {
array: [
1,
-0,
0,
-0,
0,
-1,
-0,
0,
0,
-0,
-1,
-0,
2.81376314163208,
4.689605236053467,
0,
1
]
}
}
Another node if it helps answer the question:
{
children: [ 0 ],
name: 'Lid Bone',
rotation: [
1.5454311608209537e-8,
1.5454311608209537e-8,
-0.7071068286895752,
0.7071068286895752
],
scale: [ 1, 0.9999999403953552, 1 ],
translation: [ -2.81376314163208, 4.689605236053467, 1.4210854715202004e-14 ],
inverseBindMatrix: Matrix {
array: [
0, 1.0000001192092896,
0, -0,
-1, 0,
-4.371138828673793e-8, 0,
-4.371138828673793e-8, -0,
1, -0,
4.689605236053467, 2.813763380050659,
2.049891492106326e-7, 1
]
},
globalTransformOfJointNode: Matrix {
array: [
-1, 0, 0,
0, -0, -0,
-1, 0, 0,
-1, -0, 0,
-2.81376, 4.68961, 0,
1
]
}
}
I parsed the binary data to retrieve this inverseBindMatrix. I used the Blender 2.83 exporter, and as you can see, there is no rotation (w,x,y,z) = (1,0,0,0). However, there is a translation left then up. The inverseBindMatrix appears to flip the y and z-axes. I have really struggled for weeks on this problem. On to my question:
How can I take this rotation, translation, and scale and calculate this inverseBindMatrix? Why are two of the axes flipped?
Thank you for any help.