Custom Collada Exporter - Problem with matrices calculation.

Hi all! I’m trying to create a simple Collada exporter for a custom 3D model binary format. I managed to get everything work properly except for what concern skinning data and joint scene nodes. Actually, the Skeleton class I’m using in my application to store the joints’ information read from the binary file is just a simple hierarchical Joint[] where Joint class looks like this:

class Joint
    Joint[] children;
    Quaternion rotation;
    Joint parent;
    String name;
    UInt32 id;
    Vector3 traslation;

Rotations and translations are relative to the parent Joint. What I really don’t know is how to proceed in order to calculate the matrix of JOINT nodes in the Collada’s visual scene.

<node name="x" id="x_id" sid="x" type="JOINT">
    <matrix sid="matrix">?</matrix>

What does that matrix represents? Local transform? World transform? How can I retrieve it from the data I currently have? I tried calculating both those using the algorithms provided by a few tutorials I read but I’m always producing bad results (I know how the skeleton should look like and what I get is completely wrong).

Also, I’m struggling to find a way to calculate the bind_shape_matrix and the INV_BIND_MATRIX source elements required in for the skinning controllers.


<source id="x_id">
   <float_array id="x_id-array" count="X">?</float_array>
      <accessor source="#x_id-array" count="(X / 16)" stride="16">
         <param type="float4x4" />

The Collada model I need to produce needs to be Y_UP, unit meter/1 and contains no animations. Only meshes, skeleton and skinning data with vertex weights.
A little help would be really appreciated because this is the last step I need to make my tool working properly :frowning:

One thing you can try is schema validation. If you run xmllint on your file, it might discover the problem. This only finds errors that violate the schema though, so it won’t catch all problems