### Exporting Bone Data *Solved*

Posted:

**Sun Feb 26, 2006 2:49 pm**Hi all,

I have recently been attempting at writing python script to export 3d models to my own file format, but i've run into problems with successfully exporting matrix data belonging to the armature/bones of my model.

First of all, i am using Direct3D and a left-hard coordinate system. Secondly there are two objects that i wish to export: a single mesh and an armature with underlying bones that control this mesh. For every key frame i would like to write the bone matrices to my file so that i could transform each vertex from within D3D in this manner:

V' = M1 * V * w1 + M2 * v * w2;

I know that the vertices are weighted properly because arms, legs and feet are visible when i try to render this in D3D, but they are all over the place with respect to each other.

Should i be converting the vertex coordinates of the mesh(to the D3D format) as i write them to the file, or should i incorporate this into all the bone matrices? (I havent had any luck with either so far...)

Do i need to change the blender matrices before writing them to the file? D3D seems to store their matrices differently to everything else...

What combination of bone.localMatrix / .poseMatrix etc etc do i have to use to get the final bone matrix that i could use in the above equation?

I have been trying to solve this for so long but i have got absolutely nowhere. Any help, however sarcastic towards my oversights, is greatly appreciated!

Thanks in advance,

Jebus

I have recently been attempting at writing python script to export 3d models to my own file format, but i've run into problems with successfully exporting matrix data belonging to the armature/bones of my model.

First of all, i am using Direct3D and a left-hard coordinate system. Secondly there are two objects that i wish to export: a single mesh and an armature with underlying bones that control this mesh. For every key frame i would like to write the bone matrices to my file so that i could transform each vertex from within D3D in this manner:

V' = M1 * V * w1 + M2 * v * w2;

*Where V' is the new vertex pos, V is the old vertex pos and where M1 + M2 and w1 + w2 are the matrices and vertex weights corrosponding to the two most influential bones for each vertex.*I know that the vertices are weighted properly because arms, legs and feet are visible when i try to render this in D3D, but they are all over the place with respect to each other.

**So, a few questions:**Should i be converting the vertex coordinates of the mesh(to the D3D format) as i write them to the file, or should i incorporate this into all the bone matrices? (I havent had any luck with either so far...)

Do i need to change the blender matrices before writing them to the file? D3D seems to store their matrices differently to everything else...

What combination of bone.localMatrix / .poseMatrix etc etc do i have to use to get the final bone matrix that i could use in the above equation?

I have been trying to solve this for so long but i have got absolutely nowhere. Any help, however sarcastic towards my oversights, is greatly appreciated!

Thanks in advance,

Jebus