# OpenGL Clarification for a directX ASCII file...

This topic is 3378 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Ok here is an example of a directX file I generated using a 3D modeling software, since i am not using directX, but writing a loader for this file, I would like to clarify what does each individual part of it mean.

Frame RootFrame {

FrameTransformMatrix {
1.000000,0.000000,0.000000,0.000000,
0.000000,0.000000,1.000000,0.000000,
0.000000,1.000000,0.000000,0.000000,
0.000000,0.000000,0.000000,1.000000
}
Frame Bone_000 {

FrameTransformMatrix {
1.000000,0.000000,0.000000,0.000000,
0.000000,0.000000,1.000000,0.000000,
0.000000,-1.000000,0.000000,0.000000,
0.000000,0.000000,0.000000,1.000000
}
Frame Bone_001 {

FrameTransformMatrix {
1.000000,0.000000,0.000000,0.000000,
0.000000,1.000000,-0.002400,0.000000,
0.000000,0.002400,1.000000,0.000000,
0.000000,1.000000,0.000000,1.000000
}
Frame Bone_002 {

FrameTransformMatrix {
1.000000,0.000000,0.000000,0.000000,
0.000000,0.999400,0.034500,0.000000,
0.000000,-0.034500,0.999400,0.000000,
0.000000,1.256400,0.000000,1.000000
}
Frame Bone_003 {

FrameTransformMatrix {
1.000000,0.000000,0.000000,0.000000,
0.000000,0.998000,-0.062600,0.000000,
0.000000,0.062600,0.998000,0.000000,
0.000000,1.257200,0.000000,1.000000
}
Frame Bone_004 {

FrameTransformMatrix {
1.000000,0.000000,0.000000,0.000000,
0.000000,0.997900,0.064500,0.000000,
0.000000,-0.064500,0.997900,0.000000,
0.000000,1.538700,0.000000,1.000000
}
Frame Bone_005 {

FrameTransformMatrix {
1.000000,0.000000,0.000000,0.000000,
0.000000,0.995700,-0.092500,0.000000,
0.000000,0.092500,0.995700,0.000000,
0.000000,1.192200,0.000000,1.000000
}
}
}
}
}
}
}  // End of the Bone Bone


Am I right to say that these are the representations of the armatures in my model's underlying skeleton? They are each local matrices, right?(Lets call them localMatrix for now) What does rootFrame do? From my guess it isn't a bone, it is just a matrix which we have to multiply against to find the "world matrix", (i'm assuming that these are individual local bone matrices laid out in a hierarchy, correct?) So, next, in what way do I combine these matrices, is it top to bottom or bottom to top? Bone_005(worldmatrix) = 005 * 004 * 003 * 002 * 001 * 000 * rootFrame or is it the other way round? Bone_005(worldmatrix) =rootFrame * 000 * 001 * 002 * 003 * 004 * 005 or is rootFrame multiplied in the last? I'm quite confused about this, good if someone could clarify with me. So lets say I store these matrices in an array with an ascending order(according to bone name, 000 to 005), with rootFrame individually stored... so lets continue...
Mesh {
132;
0.442900; 0.268300; 8.127200;,
0.442900; -0.368400; 8.128700;,
-0.428400; 0.268300; 8.127200;,
0.442900; -0.368400; 8.128700;,
-0.428400; -0.368400; 8.128700;,
-0.428400; 0.268300; 8.127200;,
0.442900; -0.372100; 6.574900;,
-0.428400; -0.372100; 6.574900;,
-0.428400; -0.368400; 8.128700;,
0.442900; -0.372100; 6.574900;,
-0.428400; -0.368400; 8.128700;,
0.442900; -0.368400; 8.128700;,
-0.428400; -0.372100; 6.574900;,
-0.428400; 0.264600; 6.573400;,
-0.428400; 0.268300; 8.127200;,
-0.428400; -0.372100; 6.574900;,
-0.428400; 0.268300; 8.127200;,
-0.428400; -0.368400; 8.128700;,
0.442900; 0.264600; 6.573400;,
0.442900; -0.372100; 6.574900;,
0.442900; -0.368400; 8.128700;,
0.442900; 0.264600; 6.573400;,
0.442900; -0.368400; 8.128700;,
0.442900; 0.268300; 8.127200;,
-0.428400; 0.264600; 6.573400;,
0.442900; 0.264600; 6.573400;,
-0.428400; 0.268300; 8.127200;,
0.442900; 0.264600; 6.573400;,
0.442900; 0.268300; 8.127200;,
-0.428400; 0.268300; 8.127200;,
-0.428400; 0.262000; 5.477000;,
0.442900; 0.262000; 5.477000;,
-0.428400; 0.264600; 6.573400;,
0.442900; 0.262000; 5.477000;,
0.442900; 0.264600; 6.573400;,
-0.428400; 0.264600; 6.573400;,
0.442900; 0.262000; 5.477000;,
0.442900; -0.374700; 5.478500;,
0.442900; 0.264600; 6.573400;,
0.442900; -0.374700; 5.478500;,
0.442900; -0.372100; 6.574900;,
0.442900; 0.264600; 6.573400;,
-0.428400; -0.374700; 5.478500;,
-0.428400; 0.262000; 5.477000;,
-0.428400; -0.372100; 6.574900;,
-0.428400; 0.262000; 5.477000;,
-0.428400; 0.264600; 6.573400;,
-0.428400; -0.372100; 6.574900;,
0.442900; -0.374700; 5.478500;,
-0.428400; -0.374700; 5.478500;,
-0.428400; -0.372100; 6.574900;,
0.442900; -0.374700; 5.478500;,
-0.428400; -0.372100; 6.574900;,
0.442900; -0.372100; 6.574900;,
0.442900; -0.378500; 3.887200;,
-0.428400; -0.378500; 3.887200;,
-0.428400; -0.374700; 5.478500;,
0.442900; -0.378500; 3.887200;,
-0.428400; -0.374700; 5.478500;,
0.442900; -0.374700; 5.478500;,
-0.428400; -0.378500; 3.887200;,
-0.428400; 0.258100; 3.885700;,
-0.428400; -0.374700; 5.478500;,
-0.428400; 0.258100; 3.885700;,
-0.428400; 0.262000; 5.477000;,
-0.428400; -0.374700; 5.478500;,
0.442900; 0.258100; 3.885700;,
0.442900; -0.378500; 3.887200;,
0.442900; 0.262000; 5.477000;,
0.442900; -0.378500; 3.887200;,
0.442900; -0.374700; 5.478500;,
0.442900; 0.262000; 5.477000;,
-0.428400; 0.258100; 3.885700;,
0.442900; 0.258100; 3.885700;,
-0.428400; 0.262000; 5.477000;,
0.442900; 0.258100; 3.885700;,
0.442900; 0.262000; 5.477000;,
-0.428400; 0.262000; 5.477000;,
-0.428400; 0.254400; 2.325300;,
0.442900; 0.254400; 2.325300;,
-0.428400; 0.258100; 3.885700;,
0.442900; 0.254400; 2.325300;,
0.442900; 0.258100; 3.885700;,
-0.428400; 0.258100; 3.885700;,
0.442900; 0.254400; 2.325300;,
0.442900; -0.382300; 2.326900;,
0.442900; 0.258100; 3.885700;,
0.442900; -0.382300; 2.326900;,
0.442900; -0.378500; 3.887200;,
0.442900; 0.258100; 3.885700;,
-0.428400; -0.382300; 2.326900;,
-0.428400; 0.254400; 2.325300;,
-0.428400; -0.378500; 3.887200;,
-0.428400; 0.254400; 2.325300;,
-0.428400; 0.258100; 3.885700;,
-0.428400; -0.378500; 3.887200;,
0.442900; -0.382300; 2.326900;,
-0.428400; -0.382300; 2.326900;,
-0.428400; -0.378500; 3.887200;,
0.442900; -0.382300; 2.326900;,
-0.428400; -0.378500; 3.887200;,
0.442900; -0.378500; 3.887200;,
0.442900; -0.388200; -0.136900;,
0.442900; 0.248500; -0.138400;,
-0.428400; -0.388200; -0.136900;,
0.442900; 0.248500; -0.138400;,
-0.428400; 0.248500; -0.138400;,
-0.428400; -0.388200; -0.136900;,
-0.428400; 0.254400; 2.325300;,
-0.428400; -0.382300; 2.326900;,
-0.428400; -0.388200; -0.136900;,
-0.428400; 0.254400; 2.325300;,
-0.428400; -0.388200; -0.136900;,
-0.428400; 0.248500; -0.138400;,
0.442900; 0.248500; -0.138400;,
0.442900; -0.388200; -0.136900;,
0.442900; 0.254400; 2.325300;,
0.442900; -0.388200; -0.136900;,
0.442900; -0.382300; 2.326900;,
0.442900; 0.254400; 2.325300;,
0.442900; -0.388200; -0.136900;,
-0.428400; -0.388200; -0.136900;,
-0.428400; -0.382300; 2.326900;,
0.442900; -0.388200; -0.136900;,
-0.428400; -0.382300; 2.326900;,
0.442900; -0.382300; 2.326900;,
0.442900; 0.248500; -0.138400;,
0.442900; 0.254400; 2.325300;,
-0.428400; 0.254400; 2.325300;,
0.442900; 0.248500; -0.138400;,
-0.428400; 0.254400; 2.325300;,
-0.428400; 0.248500; -0.138400;;
44;
3; 0, 2, 1;,
3; 3, 5, 4;,
3; 6, 8, 7;,
3; 9, 11, 10;,
3; 12, 14, 13;,
3; 15, 17, 16;,
3; 18, 20, 19;,
3; 21, 23, 22;,
3; 24, 26, 25;,
3; 27, 29, 28;,
3; 30, 32, 31;,
3; 33, 35, 34;,
3; 36, 38, 37;,
3; 39, 41, 40;,
3; 42, 44, 43;,
3; 45, 47, 46;,
3; 48, 50, 49;,
3; 51, 53, 52;,
3; 54, 56, 55;,
3; 57, 59, 58;,
3; 60, 62, 61;,
3; 63, 65, 64;,
3; 66, 68, 67;,
3; 69, 71, 70;,
3; 72, 74, 73;,
3; 75, 77, 76;,
3; 78, 80, 79;,
3; 81, 83, 82;,
3; 84, 86, 85;,
3; 87, 89, 88;,
3; 90, 92, 91;,
3; 93, 95, 94;,
3; 96, 98, 97;,
3; 99, 101, 100;,
3; 102, 104, 103;,
3; 105, 107, 106;,
3; 108, 110, 109;,
3; 111, 113, 112;,
3; 114, 116, 115;,
3; 117, 119, 118;,
3; 120, 122, 121;,
3; 123, 125, 124;,
3; 126, 128, 127;,
3; 129, 131, 130;;
MeshMaterialList {
2;
44;
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1;;
Material Material {
0.800000; 0.800000; 0.800000;1.0;;
0.500000;
1.000000; 1.000000; 1.000000;;
0.0; 0.0; 0.0;;
}  //End of Material
Material Mat1 {
1.0; 1.0; 1.0; 1.0;;
1.0;
1.0; 1.0; 1.0;;
0.0; 0.0; 0.0;;
TextureFilename {    "wood-planks-texture.j";  }
}  // End of Material
}  //End of MeshMaterialList
MeshNormals {
132;
-0.577349; -0.577349; 0.577349;,
-0.666646; -0.666646; -0.333323;,
0.577349; -0.577349; 0.577349;,
-0.666646; -0.666646; -0.333323;,
0.408246; -0.408246; -0.816492;,
0.577349; -0.577349; 0.577349;,
-0.554674; 0.000000; -0.832026;,
0.799982; 0.000000; -0.599994;,
0.408246; -0.408246; -0.816492;,
-0.554674; 0.000000; -0.832026;,
0.408246; -0.408246; -0.816492;,
-0.666646; -0.666646; -0.333323;,
0.799982; 0.000000; -0.599994;,
0.554674; 0.000000; 0.832026;,
0.577349; -0.577349; 0.577349;,
0.799982; 0.000000; -0.599994;,
0.577349; -0.577349; 0.577349;,
0.408246; -0.408246; -0.816492;,
-0.799982; 0.000000; 0.599994;,
-0.554674; 0.000000; -0.832026;,
-0.666646; -0.666646; -0.333323;,
-0.799982; 0.000000; 0.599994;,
-0.666646; -0.666646; -0.333323;,
-0.577349; -0.577349; 0.577349;,
0.554674; 0.000000; 0.832026;,
-0.799982; 0.000000; 0.599994;,
0.577349; -0.577349; 0.577349;,
-0.799982; 0.000000; 0.599994;,
-0.577349; -0.577349; 0.577349;,
0.577349; -0.577349; 0.577349;,
0.707083; 0.000000; 0.707083;,
-0.707083; 0.000000; 0.707083;,
0.554674; 0.000000; 0.832026;,
-0.707083; 0.000000; 0.707083;,
-0.799982; 0.000000; 0.599994;,
0.554674; 0.000000; 0.832026;,
-0.707083; 0.000000; 0.707083;,
-0.707083; 0.000000; -0.707083;,
-0.799982; 0.000000; 0.599994;,
-0.707083; 0.000000; -0.707083;,
-0.554674; 0.000000; -0.832026;,
-0.799982; 0.000000; 0.599994;,
0.707083; 0.000000; -0.707083;,
0.707083; 0.000000; 0.707083;,
0.799982; 0.000000; -0.599994;,
0.707083; 0.000000; 0.707083;,
0.554674; 0.000000; 0.832026;,
0.799982; 0.000000; -0.599994;,
-0.707083; 0.000000; -0.707083;,
0.707083; 0.000000; -0.707083;,
0.799982; 0.000000; -0.599994;,
-0.707083; 0.000000; -0.707083;,
0.799982; 0.000000; -0.599994;,
-0.554674; 0.000000; -0.832026;,
-0.707083; 0.000000; -0.707083;,
0.707083; 0.000000; -0.707083;,
0.707083; 0.000000; -0.707083;,
-0.707083; 0.000000; -0.707083;,
0.707083; 0.000000; -0.707083;,
-0.707083; 0.000000; -0.707083;,
0.707083; 0.000000; -0.707083;,
0.707083; 0.000000; 0.707083;,
0.707083; 0.000000; -0.707083;,
0.707083; 0.000000; 0.707083;,
0.707083; 0.000000; 0.707083;,
0.707083; 0.000000; -0.707083;,
-0.707083; 0.000000; 0.707083;,
-0.707083; 0.000000; -0.707083;,
-0.707083; 0.000000; 0.707083;,
-0.707083; 0.000000; -0.707083;,
-0.707083; 0.000000; -0.707083;,
-0.707083; 0.000000; 0.707083;,
0.707083; 0.000000; 0.707083;,
-0.707083; 0.000000; 0.707083;,
0.707083; 0.000000; 0.707083;,
-0.707083; 0.000000; 0.707083;,
-0.707083; 0.000000; 0.707083;,
0.707083; 0.000000; 0.707083;,
0.799982; 0.000000; 0.599994;,
-0.707083; 0.000000; 0.707083;,
0.707083; 0.000000; 0.707083;,
-0.707083; 0.000000; 0.707083;,
-0.707083; 0.000000; 0.707083;,
0.707083; 0.000000; 0.707083;,
-0.707083; 0.000000; 0.707083;,
-0.707083; 0.000000; -0.707083;,
-0.707083; 0.000000; 0.707083;,
-0.707083; 0.000000; -0.707083;,
-0.707083; 0.000000; -0.707083;,
-0.707083; 0.000000; 0.707083;,
0.554674; 0.000000; -0.832026;,
0.799982; 0.000000; 0.599994;,
0.707083; 0.000000; -0.707083;,
0.799982; 0.000000; 0.599994;,
0.707083; 0.000000; 0.707083;,
0.707083; 0.000000; -0.707083;,
-0.707083; 0.000000; -0.707083;,
0.554674; 0.000000; -0.832026;,
0.707083; 0.000000; -0.707083;,
-0.707083; 0.000000; -0.707083;,
0.707083; 0.000000; -0.707083;,
-0.707083; 0.000000; -0.707083;,
-0.666646; 0.333323; -0.666646;,
-0.333323; 0.666646; 0.666646;,
0.666646; 0.666646; -0.333323;,
-0.333323; 0.666646; 0.666646;,
0.577349; 0.577349; 0.577349;,
0.666646; 0.666646; -0.333323;,
0.799982; 0.000000; 0.599994;,
0.554674; 0.000000; -0.832026;,
0.666646; 0.666646; -0.333323;,
0.799982; 0.000000; 0.599994;,
0.666646; 0.666646; -0.333323;,
0.577349; 0.577349; 0.577349;,
-0.333323; 0.666646; 0.666646;,
-0.666646; 0.333323; -0.666646;,
-0.707083; 0.000000; 0.707083;,
-0.666646; 0.333323; -0.666646;,
-0.707083; 0.000000; -0.707083;,
-0.707083; 0.000000; 0.707083;,
-0.666646; 0.333323; -0.666646;,
0.666646; 0.666646; -0.333323;,
0.554674; 0.000000; -0.832026;,
-0.666646; 0.333323; -0.666646;,
0.554674; 0.000000; -0.832026;,
-0.707083; 0.000000; -0.707083;,
-0.333323; 0.666646; 0.666646;,
-0.707083; 0.000000; 0.707083;,
0.799982; 0.000000; 0.599994;,
-0.333323; 0.666646; 0.666646;,
0.799982; 0.000000; 0.599994;,
0.577349; 0.577349; 0.577349;;
44;
3; 0, 2, 1;,
3; 3, 5, 4;,
3; 6, 8, 7;,
3; 9, 11, 10;,
3; 12, 14, 13;,
3; 15, 17, 16;,
3; 18, 20, 19;,
3; 21, 23, 22;,
3; 24, 26, 25;,
3; 27, 29, 28;,
3; 30, 32, 31;,
3; 33, 35, 34;,
3; 36, 38, 37;,
3; 39, 41, 40;,
3; 42, 44, 43;,
3; 45, 47, 46;,
3; 48, 50, 49;,
3; 51, 53, 52;,
3; 54, 56, 55;,
3; 57, 59, 58;,
3; 60, 62, 61;,
3; 63, 65, 64;,
3; 66, 68, 67;,
3; 69, 71, 70;,
3; 72, 74, 73;,
3; 75, 77, 76;,
3; 78, 80, 79;,
3; 81, 83, 82;,
3; 84, 86, 85;,
3; 87, 89, 88;,
3; 90, 92, 91;,
3; 93, 95, 94;,
3; 96, 98, 97;,
3; 99, 101, 100;,
3; 102, 104, 103;,
3; 105, 107, 106;,
3; 108, 110, 109;,
3; 111, 113, 112;,
3; 114, 116, 115;,
3; 117, 119, 118;,
3; 120, 122, 121;,
3; 123, 125, 124;,
3; 126, 128, 127;,
3; 129, 131, 130;;
}  //End of MeshNormals
MeshTextureCoords {
132;
-0.007812;-0.937500;,
0.468750;-0.695312;,
1.000000;-1.000000;,
0.000000;-0.000000;,
0.171875;-0.906250;,
1.000000;-1.000000;,
0.000000;-0.000000;,
0.734375;-0.210938;,
1.000000;-1.000000;,
0.000000;-0.000000;,
0.171875;-0.906250;,
1.000000;-1.000000;,
0.000000;-0.000000;,
0.726562;-0.414062;,
1.000000;-1.000000;,
0.000000;-0.000000;,
0.820312;-0.671875;,
1.000000;-1.000000;,
0.000000;-0.000000;,
1.000000;-0.000000;,
1.000000;-1.000000;,
0.000000;-0.000000;,
0.468750;-0.695312;,
1.000000;-1.000000;,
0.000000;-0.000000;,
1.000000;-0.000000;,
1.000000;-1.000000;,
0.000000;-0.000000;,
1.000000;-0.000000;,
1.000000;-1.000000;,
0.000000;-0.000000;,
1.000000;-0.000000;,
1.000000;-1.000000;,
0.000000;-0.000000;,
1.000000;-0.000000;,
1.000000;-1.000000;,
0.000000;-0.000000;,
1.000000;-0.000000;,
1.000000;-1.000000;,
0.000000;-0.000000;,
1.000000;-0.000000;,
1.000000;-1.000000;,
0.000000;-0.000000;,
1.000000;-0.000000;,
1.000000;-1.000000;,
0.000000;-0.000000;,
0.726562;-0.414062;,
1.000000;-1.000000;,
0.000000;-0.000000;,
1.000000;-0.000000;,
1.000000;-1.000000;,
0.000000;-0.000000;,
0.734375;-0.210938;,
1.000000;-1.000000;,
0.000000;-0.000000;,
1.000000;-0.000000;,
1.000000;-1.000000;,
0.000000;-0.000000;,
1.000000;-0.000000;,
1.000000;-1.000000;,
0.000000;-0.000000;,
1.000000;-0.000000;,
1.000000;-1.000000;,
0.000000;-0.000000;,
1.000000;-0.000000;,
1.000000;-1.000000;,
0.000000;-0.000000;,
1.000000;-0.000000;,
1.000000;-1.000000;,
0.000000;-0.000000;,
1.000000;-0.000000;,
1.000000;-1.000000;,
0.000000;-0.000000;,
1.000000;-0.000000;,
1.000000;-1.000000;,
0.000000;-0.000000;,
1.000000;-0.000000;,
1.000000;-1.000000;,
0.000000;-0.000000;,
0.023438;-0.968750;,
1.000000;-1.000000;,
0.000000;-0.000000;,
1.000000;-0.000000;,
1.000000;-1.000000;,
0.000000;-0.000000;,
0.632812;-0.500000;,
1.000000;-1.000000;,
0.000000;-0.000000;,
1.000000;-0.000000;,
1.000000;-1.000000;,
0.000000;-0.000000;,
0.453125;-0.945312;,
1.000000;-1.000000;,
0.000000;-0.000000;,
1.000000;-0.000000;,
1.000000;-1.000000;,
0.000000;-0.000000;,
0.125000;-0.804688;,
1.000000;-1.000000;,
0.000000;-0.000000;,
1.000000;-0.000000;,
1.000000;-1.000000;,
0.000000;-0.000000;,
1.000000;-0.000000;,
1.000000;-1.000000;,
0.000000;-0.000000;,
1.000000;-0.000000;,
1.000000;-1.000000;,
0.000000;-0.000000;,
0.125000;-0.804688;,
1.000000;-1.000000;,
0.000000;-0.000000;,
0.914062;-0.015625;,
1.000000;-1.000000;,
0.000000;-0.000000;,
1.000000;-0.000000;,
1.000000;-1.000000;,
0.000000;-0.000000;,
0.632812;-0.500000;,
1.000000;-1.000000;,
0.000000;-0.000000;,
0.914062;-0.015625;,
1.000000;-1.000000;,
0.000000;-0.000000;,
0.125000;-0.804688;,
1.000000;-1.000000;,
0.000000;-0.000000;,
0.023438;-0.968750;,
1.000000;-1.000000;,
0.000000;-0.000000;,
0.453125;-0.945312;,
1.000000;-1.000000;;
}  //End of MeshTextureCoords


ok, this part I guess I pretty much understand,since I managed to get it implemented correctly :) next up...
  XSkinMeshHeader {
5;
15;
6;
}
SkinWeights {
"Bone_001";
18;
103,
105,
114,
126,
129,
106,
113,
131,
102,
115,
117,
120,
123,
104,
107,
110,
112,
121;
0.033756,
0.033756,
0.033756,
0.033756,
0.033756,
0.029167,
0.029167,
0.029167,
0.049336,
0.049336,
0.049336,
0.049336,
0.049336,
0.032584,
0.032584,
0.032584,
0.032584,
0.032584;
1.000000,0.000000,0.000000,0.000000,
0.000000,0.002400,-1.000000,0.000000,
0.000000,1.000000,0.002400,0.000000,
0.000000,-1.000000,-0.002400,1.000000
}
SkinWeights {
"Bone_002";
0;
1.000000,0.000000,0.000000,0.000000,
0.000000,-0.032100,-0.999500,0.000000,
0.000000,0.999500,-0.032100,0.000000,
0.000000,-2.255200,0.075400,1.000000
}
SkinWeights {
"Bone_003";
132;
103,
105,
114,
126,
129,
79,
81,
84,
116,
119,
127,
78,
91,
93,
108,
111,
128,
130,
106,
113,
131,
102,
115,
117,
120,
123,
85,
87,
96,
99,
118,
125,
90,
97,
109,
122,
124,
104,
107,
110,
112,
121,
54,
57,
67,
69,
88,
101,
55,
60,
92,
95,
98,
100,
61,
63,
72,
80,
83,
94,
66,
73,
75,
82,
86,
89,
31,
33,
36,
68,
71,
76,
30,
43,
45,
64,
74,
77,
37,
39,
48,
51,
59,
70,
42,
49,
56,
58,
62,
65,
7,
12,
15,
44,
47,
50,
52,
6,
9,
19,
40,
53,
13,
24,
32,
35,
46,
18,
21,
25,
27,
34,
38,
41,
2,
5,
14,
16,
26,
29,
0,
23,
28,
1,
3,
11,
20,
22,
4,
8,
10,
17;
0.341596,
0.341596,
0.341596,
0.341596,
0.341596,
0.420363,
0.420363,
0.420363,
0.420363,
0.420363,
0.420363,
0.464187,
0.464187,
0.464187,
0.464187,
0.464187,
0.464187,
0.464187,
0.355773,
0.355773,
0.355773,
0.347670,
0.347670,
0.347670,
0.347670,
0.347670,
0.455057,
0.455057,
0.455057,
0.455057,
0.455057,
0.455057,
0.472454,
0.472454,
0.472454,
0.472454,
0.472454,
0.355873,
0.355873,
0.355873,
0.355873,
0.355873,
0.317348,
0.317348,
0.317348,
0.317348,
0.317348,
0.317348,
0.319257,
0.319257,
0.319257,
0.319257,
0.319257,
0.319257,
0.314616,
0.314616,
0.314616,
0.314616,
0.314616,
0.314616,
0.311477,
0.311477,
0.311477,
0.311477,
0.311477,
0.311477,
0.342739,
0.342739,
0.342739,
0.342739,
0.342739,
0.342739,
0.342436,
0.342436,
0.342436,
0.342436,
0.342436,
0.342436,
0.344942,
0.344942,
0.344942,
0.344942,
0.344942,
0.344942,
0.344508,
0.344508,
0.344508,
0.344508,
0.344508,
0.344508,
0.469669,
0.469669,
0.469669,
0.469669,
0.469669,
0.469669,
0.469669,
0.469530,
0.469530,
0.469530,
0.469530,
0.469530,
0.473440,
0.473440,
0.473440,
0.473440,
0.473440,
0.471819,
0.471819,
0.471819,
0.471819,
0.471819,
0.471819,
0.471819,
0.459076,
0.459076,
0.459076,
0.459076,
0.459076,
0.459076,
0.459859,
0.459859,
0.459859,
0.459713,
0.459713,
0.459713,
0.459713,
0.459713,
0.457383,
0.457383,
0.457383,
0.457383;
1.000000,0.000000,0.000000,0.000000,
0.000000,0.030600,-0.999500,0.000000,
0.000000,0.999500,0.030600,0.000000,
0.000000,-3.510200,-0.144600,1.000000
}
SkinWeights {
"Bone_004";
132;
103,
105,
114,
126,
129,
79,
81,
84,
116,
119,
127,
78,
91,
93,
108,
111,
128,
130,
106,
113,
131,
102,
115,
117,
120,
123,
85,
87,
96,
99,
118,
125,
90,
97,
109,
122,
124,
104,
107,
110,
112,
121,
54,
57,
67,
69,
88,
101,
55,
60,
92,
95,
98,
100,
61,
63,
72,
80,
83,
94,
66,
73,
75,
82,
86,
89,
31,
33,
36,
68,
71,
76,
30,
43,
45,
64,
74,
77,
37,
39,
48,
51,
59,
70,
42,
49,
56,
58,
62,
65,
7,
12,
15,
44,
47,
50,
52,
6,
9,
19,
40,
53,
13,
24,
32,
35,
46,
18,
21,
25,
27,
34,
38,
41,
2,
5,
14,
16,
26,
29,
0,
23,
28,
1,
3,
11,
20,
22,
4,
8,
10,
17;
0.163324,
0.163324,
0.163324,
0.163324,
0.163324,
0.215433,
0.215433,
0.215433,
0.215433,
0.215433,
0.215433,
0.215349,
0.215349,
0.215349,
0.215349,
0.215349,
0.215349,
0.215349,
0.168731,
0.168731,
0.168731,
0.165487,
0.165487,
0.165487,
0.165487,
0.165487,
0.215891,
0.215891,
0.215891,
0.215891,
0.215891,
0.215891,
0.215233,
0.215233,
0.215233,
0.215233,
0.215233,
0.168440,
0.168440,
0.168440,
0.168440,
0.168440,
0.379916,
0.379916,
0.379916,
0.379916,
0.379916,
0.379916,
0.380710,
0.380710,
0.380710,
0.380710,
0.380710,
0.380710,
0.387358,
0.387358,
0.387358,
0.387358,
0.387358,
0.387358,
0.386436,
0.386436,
0.386436,
0.386436,
0.386436,
0.386436,
0.227694,
0.227694,
0.227694,
0.227694,
0.227694,
0.227694,
0.227211,
0.227211,
0.227211,
0.227211,
0.227211,
0.227211,
0.228640,
0.228640,
0.228640,
0.228640,
0.228640,
0.228640,
0.228238,
0.228238,
0.228238,
0.228238,
0.228238,
0.228238,
0.193774,
0.193774,
0.193774,
0.193774,
0.193774,
0.193774,
0.193774,
0.193595,
0.193595,
0.193595,
0.193595,
0.193595,
0.192044,
0.192044,
0.192044,
0.192044,
0.192044,
0.192524,
0.192524,
0.192524,
0.192524,
0.192524,
0.192524,
0.192524,
0.213981,
0.213981,
0.213981,
0.213981,
0.213981,
0.213981,
0.212335,
0.212335,
0.212335,
0.212225,
0.212225,
0.212225,
0.212225,
0.212225,
0.216489,
0.216489,
0.216489,
0.216489;
1.000000,0.000000,0.000000,0.000000,
0.000000,-0.033900,-0.999400,0.000000,
0.000000,0.999400,-0.033900,0.000000,
0.000000,-5.047700,0.181200,1.000000
}
SkinWeights {
"Bone_005";
132;
103,
105,
114,
126,
129,
79,
81,
84,
116,
119,
127,
78,
91,
93,
108,
111,
128,
130,
106,
113,
131,
102,
115,
117,
120,
123,
85,
87,
96,
99,
118,
125,
90,
97,
109,
122,
124,
104,
107,
110,
112,
121,
54,
57,
67,
69,
88,
101,
55,
60,
92,
95,
98,
100,
61,
63,
72,
80,
83,
94,
66,
73,
75,
82,
86,
89,
31,
33,
36,
68,
71,
76,
30,
43,
45,
64,
74,
77,
37,
39,
48,
51,
59,
70,
42,
49,
56,
58,
62,
65,
7,
12,
15,
44,
47,
50,
52,
6,
9,
19,
40,
53,
13,
24,
32,
35,
46,
18,
21,
25,
27,
34,
38,
41,
2,
5,
14,
16,
26,
29,
0,
23,
28,
1,
3,
11,
20,
22,
4,
8,
10,
17;
0.078383,
0.078383,
0.078383,
0.078383,
0.078383,
0.103265,
0.103265,
0.103265,
0.103265,
0.103265,
0.103265,
0.103172,
0.103172,
0.103172,
0.103172,
0.103172,
0.103172,
0.103172,
0.080974,
0.080974,
0.080974,
0.079439,
0.079439,
0.079439,
0.079439,
0.079439,
0.103806,
0.103806,
0.103806,
0.103806,
0.103806,
0.103806,
0.103441,
0.103441,
0.103441,
0.103441,
0.103441,
0.080852,
0.080852,
0.080852,
0.080852,
0.080852,
0.185076,
0.185076,
0.185076,
0.185076,
0.185076,
0.185076,
0.184907,
0.184907,
0.184907,
0.184907,
0.184907,
0.184907,
0.183145,
0.183145,
0.183145,
0.183145,
0.183145,
0.183145,
0.183329,
0.183329,
0.183329,
0.183329,
0.183329,
0.183329,
0.363752,
0.363752,
0.363752,
0.363752,
0.363752,
0.363752,
0.365105,
0.365105,
0.365105,
0.365105,
0.365105,
0.365105,
0.360247,
0.360247,
0.360247,
0.360247,
0.360247,
0.360247,
0.361556,
0.361556,
0.361556,
0.361556,
0.361556,
0.361556,
0.284909,
0.284909,
0.284909,
0.284909,
0.284909,
0.284909,
0.284909,
0.285079,
0.285079,
0.285079,
0.285079,
0.285079,
0.283294,
0.283294,
0.283294,
0.283294,
0.283294,
0.284156,
0.284156,
0.284156,
0.284156,
0.284156,
0.284156,
0.284156,
0.276806,
0.276806,
0.276806,
0.276806,
0.276806,
0.276806,
0.277504,
0.277504,
0.277504,
0.277709,
0.277709,
0.277709,
0.277709,
0.277709,
0.276189,
0.276189,
0.276189,
0.276189;
1.000000,0.000000,0.000000,0.000000,
0.000000,0.058600,-0.998300,0.000000,
0.000000,0.998300,0.058600,0.000000,
0.000000,-6.229900,-0.396800,1.000000
}
SkinWeights {
"Bone_000";
132;
103,
105,
114,
126,
129,
79,
81,
84,
116,
119,
127,
78,
91,
93,
108,
111,
128,
130,
106,
113,
131,
102,
115,
117,
120,
123,
85,
87,
96,
99,
118,
125,
90,
97,
109,
122,
124,
104,
107,
110,
112,
121,
54,
57,
67,
69,
88,
101,
55,
60,
92,
95,
98,
100,
61,
63,
72,
80,
83,
94,
66,
73,
75,
82,
86,
89,
31,
33,
36,
68,
71,
76,
30,
43,
45,
64,
74,
77,
37,
39,
48,
51,
59,
70,
42,
49,
56,
58,
62,
65,
7,
12,
15,
44,
47,
50,
52,
6,
9,
19,
40,
53,
13,
24,
32,
35,
46,
18,
21,
25,
27,
34,
38,
41,
2,
5,
14,
16,
26,
29,
0,
23,
28,
1,
3,
11,
20,
22,
4,
8,
10,
17;
0.382941,
0.382941,
0.382941,
0.382941,
0.382941,
0.260939,
0.260939,
0.260939,
0.260939,
0.260939,
0.260939,
0.217292,
0.217292,
0.217292,
0.217292,
0.217292,
0.217292,
0.217292,
0.365355,
0.365355,
0.365355,
0.358069,
0.358069,
0.358069,
0.358069,
0.358069,
0.225246,
0.225246,
0.225246,
0.225246,
0.225246,
0.225246,
0.208873,
0.208873,
0.208873,
0.208873,
0.208873,
0.362250,
0.362250,
0.362250,
0.362250,
0.362250,
0.117660,
0.117660,
0.117660,
0.117660,
0.117660,
0.117660,
0.115126,
0.115126,
0.115126,
0.115126,
0.115126,
0.115126,
0.114881,
0.114881,
0.114881,
0.114881,
0.114881,
0.114881,
0.118758,
0.118758,
0.118758,
0.118758,
0.118758,
0.118758,
0.065814,
0.065814,
0.065814,
0.065814,
0.065814,
0.065814,
0.065249,
0.065249,
0.065249,
0.065249,
0.065249,
0.065249,
0.066171,
0.066171,
0.066171,
0.066171,
0.066171,
0.066171,
0.065698,
0.065698,
0.065698,
0.065698,
0.065698,
0.065698,
0.051648,
0.051648,
0.051648,
0.051648,
0.051648,
0.051648,
0.051648,
0.051796,
0.051796,
0.051796,
0.051796,
0.051796,
0.051221,
0.051221,
0.051221,
0.051221,
0.051221,
0.051502,
0.051502,
0.051502,
0.051502,
0.051502,
0.051502,
0.051502,
0.050137,
0.050137,
0.050137,
0.050137,
0.050137,
0.050137,
0.050302,
0.050302,
0.050302,
0.050354,
0.050354,
0.050354,
0.050354,
0.050354,
0.049939,
0.049939,
0.049939,
0.049939;
1.000000,0.000000,0.000000,0.000000,
0.000000,0.000000,-1.000000,0.000000,
0.000000,1.000000,0.000000,0.000000,
0.000000,0.000000,0.000000,1.000000
}
}  // End of the Object Cube
}  // End of the Root Frame


ok, I had partial success with this part, I understand that the matrix for every bone "binds" the skeleton to the mesh,(lets call this the binding matrix) and the weights and index affects how much each vertex is binded by a bone. So, I have, for each vertex, (lets say vertexA) newVertexAPosition = (inverseBindingMatrix(Bone_000) * worldMatrix(Bone_000)) * weight(vertexA,Bone_000) * currentPosition(vertexA) + (inverseBindingMatrix(Bone_001) * worldMatrix(Bone_001)) * weight(vertexA,Bone_001) * currentPosition(vertexA) + .... + (inverseBindingMatrix(Bone_005) * worldMatrix(Bone_005)) * weight(vertexA,Bone_005) * currentPosition(vertexA) correct? I'm new to this so please comment if I'm wrong. Basically why I said I only have partial success with this is that the model isn't deformed(or at least doesn't look deformed), but the orientation of the whole model is wrong, any idea where I might have gone wrong? ok, last and the most confusing part for me, animations
AnimationSet AnimationSet0 {
Animation {
{ Bone_001 }
AnimationKey {
4;
3;
1;16;1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,-0.002400,0.000000,0.000000,0.002400,1.000000,0.000000,0.000000,1.000000,0.000000,1.000000;;,
91;16;1.000000,0.000000,0.000000,0.000000,0.000000,0.608200,-0.793800,0.000000,0.000000,0.793800,0.608200,0.000000,0.000000,1.000000,0.000000,1.000000;;,
121;16;1.000000,0.000000,0.000000,0.000000,0.000000,0.626100,0.779700,0.000000,0.000000,-0.779700,0.626100,0.000000,0.000000,1.000000,0.000000,1.000000;;;
}
}

Animation {
{ Bone_002 }
AnimationKey {
4;
1;
1;16;1.000000,0.000000,0.000000,0.000000,0.000000,0.999400,0.034500,0.000000,0.000000,-0.034500,0.999400,0.000000,0.000000,1.256400,0.000000,1.000000;;;
}
}

Animation {
{ Bone_003 }
AnimationKey {
4;
2;
1;16;1.000000,0.000000,0.000000,0.000000,0.000000,0.998000,-0.062600,0.000000,0.000000,0.062600,0.998000,0.000000,0.000000,1.257200,0.000000,1.000000;;,
61;16;1.000000,0.000000,0.000000,0.000000,0.000000,0.820100,-0.572200,0.000000,0.000000,0.572200,0.820100,0.000000,0.000000,1.257200,0.000000,1.000000;;;
}
}

Animation {
{ Bone_004 }
AnimationKey {
4;
1;
1;16;1.000000,0.000000,0.000000,0.000000,0.000000,0.997900,0.064500,0.000000,0.000000,-0.064500,0.997900,0.000000,0.000000,1.538700,0.000000,1.000000;;;
}
}

Animation {
{ Bone_005 }
AnimationKey {
4;
2;
1;16;1.000000,0.000000,0.000000,0.000000,0.000000,0.995700,-0.092500,0.000000,0.000000,0.092500,0.995700,0.000000,0.000000,1.192200,0.000000,1.000000;;,
31;16;1.000000,0.000000,0.000000,0.000000,0.000000,0.635100,-0.772400,0.000000,0.000000,0.772400,0.635100,0.000000,0.000000,1.192200,0.000000,1.000000;;;
}
}

Animation {
{ Bone_000 }
AnimationKey {
4;
1;
1;16;1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.002400,0.000000,0.000000,-0.002400,1.000000,0.000000,-0.097800,-4.209400,-0.070400,1.000000;;;
}
}

} // End of Animation Set


Ok, first off, from what i understand from the text,
Animation {
{ Bone_005 }
AnimationKey {
4;
2;
1;16;1.000000,0.000000,0.000000,0.000000,0.000000,0.995700,-0.092500,0.000000,0.000000,0.092500,0.995700,0.000000,0.000000,1.192200,0.000000,1.000000;;,
31;16;1.000000,0.000000,0.000000,0.000000,0.000000,0.635100,-0.772400,0.000000,0.000000,0.772400,0.635100,0.000000,0.000000,1.192200,0.000000,1.000000;;;
}
}


Bone_005 will be at 2 keyframed positions at keyframe 1 and 31, and these positions are represented by matrices(lets call these animation matrices). Now the whole crux of this whole post. WHAT DO I DO WITH THE MATRICES? are they the local armatures' positions (represented by matrices) at those keyframes? Or are they transformation matrices which I have to apply on the armatures(the matrices discussed on the very first part of the post) So lets say for keyframe 31, Bone_005, do I 1) Multiply the animationMatrix(Bone_005) with localMatrix(Bone_005), then multiply with the other localMatrices to find the world Matrix, then use the inverseBindingMatrix * worldMatrix * weight * vertex to find all the new individual vertex positions, for all bones binded by Bone_005. or 2) Replace the armature for Bone_005, meaning replace 1.000000,0.000000,0.000000,0.000000, 0.000000,0.995700,-0.092500,0.000000, 0.000000,0.092500,0.995700,0.000000, 0.000000,1.192200,0.000000,1.000000 with .000000,0.000000,0.000000,0.000000,0.000000,0.635100,-0.772400,0.000000,0.000000,0.772400,0.635100,0.000000,0.000000,1.192200,0.000000,1.000000 then multiply it with the other bones to find the worldMatrix then so on... 3) Other ways?!? So, I guess interpolation is complicated too? I touched a bit of it but totally messed the model up, so I decided to get my basics right first. Also, I see that the order of matrix multiplication matters, and this is also something I'm not sure about Yep, so that's about it, whew, long post, thanks for taking your time to read it and help me, I really appreciate it. Also, it might help if you know that I'm using openGL to render the model, but I don't think it would mess the matrices up,(right-handed vs left-handed systems) since I'm using my own matrix calculator and other maths calculators. Once again, thanks alot for your help and time reading this Cheers :)

##### Share on other sites
X File Format Reference -> Text Encoding

Although I should point out that the .X file format really isn't a very nice format for parsing as text. Your life will be much easier if you can use binary instead.

##### Share on other sites
Hi, thanks for taking time to read my problem.

Unfortunately, I'm not using windows and not using directX as an API, I am just using the text file as a medium to represent data which is exported from my 3D modeling software to my code. Therefore, D3DMatrix and other directX related classes or functions would not be used by me.

Basically I can say that I understand what are the information stored in the .x file. what I'm not sure is how to use this information to make an animated model with code.

Thanks again.

##### Share on other sites
Isn't what Evil Steve linked exactly what you want?

This lists all templates and this explains AnimationKey quite well

No-one is asking you to use D3DMatrix..

##### Share on other sites
Quote:
 Original post by charpiUnfortunately, I'm not using windows and not using directX as an API, I am just using the text file as a medium to represent data which is exported from my 3D modeling software to my code. Therefore, D3DMatrix and other directX related classes or functions would not be used by me.
You don't have to use them, but you'll need to know how they work, since they're used by the .X file format.

Quote:
 Original post by charpiBasically I can say that I understand what are the information stored in the .x file. what I'm not sure is how to use this information to make an animated model with code.
The Templates section of the docs covers what each template type is and how it's defined. As for actually applying all of the information to render a model, you might be best trying to find a .X file parser and reverse engineering it. There's some information in each of the template sections, but it's still a bit hard to follow.

The following is fairly guess-y, I've not done much .X file skinned mesh stuff before:

Quote:
 Original post by charpiAm I right to say that these are the representations of the armatures in my model's underlying skeleton? They are each local matrices, right?(Lets call them localMatrix for now) What does rootFrame do? From my guess it isn't a bone, it is just a matrix which we have to multiply against to find the "world matrix", (i'm assuming that these are individual local bone matrices laid out in a hierarchy, correct?)
I believe that's all correct, yes.

Quote:
 Original post by charpiSo, next, in what way do I combine these matrices, is it top to bottom or bottom to top?
I think it's top to bottom - the transforms are hierarchical, so the hand matrix needs transformed by the arm matrix and so on. So to get the hand matrix, you'd do:
Hand = Body * Torso * UpperArm * Arm
And so on.

Quote:
 Original post by charpiSo, I have, for each vertex, (lets say vertexA)newVertexAPosition = (inverseBindingMatrix(Bone_000) * worldMatrix(Bone_000)) * weight(vertexA,Bone_000) * currentPosition(vertexA) + (inverseBindingMatrix(Bone_001) * worldMatrix(Bone_001)) * weight(vertexA,Bone_001) * currentPosition(vertexA) + .... + (inverseBindingMatrix(Bone_005) * worldMatrix(Bone_005)) * weight(vertexA,Bone_005) * currentPosition(vertexA)correct? I'm new to this so please comment if I'm wrong.
Yes. It's just standard skin weights.

Quote:
 Original post by charpiBasically why I said I only have partial success with this is that the model isn't deformed(or at least doesn't look deformed), but the orientation of the whole model is wrong, any idea where I might have gone wrong?
In Direct3D, +Z is "into" the screen, and +Y is "up". I seem to recall that OpenGL has +Z as "out of" the screen, and +Y is up. You'll need to compensate here (Now I think about it, I'm not even sure that Y and Z are the same axes in OpenGL).

Quote:
 Original post by charpiok, last and the most confusing part for me, animations*** Source Snippet Removed ***Ok, first off, from what i understand from the text,*** Source Snippet Removed ***Bone_005 will be at 2 keyframed positions at keyframe 1 and 31, and these positions are represented by matrices(lets call these animation matrices). Now the whole crux of this whole post.WHAT DO I DO WITH THE MATRICES?
See the AnimationKey section and sub-sections.

Quote:
 Original post by charpiAlso, I see that the order of matrix multiplication matters, and this is also something I'm not sure about
If you don't know that the order of matrix multiplications matters, I don't think you should be trying to load a skinned mesh [smile]

##### Share on other sites
ok thanks alot !

Now the only thing is to find out whether the animation matrices replace the worldMatrix of that bone, the local Matrix of that bone, or is it just a transformation matrix which I should apply to the FrameTransformMatrix to get a new matrix as a local/world Matrix...the msdn is quite vague on animation matrices...

thanks alot, will probably be back with much more questions!!

cheers

##### Share on other sites
DirectX matrices are stored in row-major layout. That is, a matrix with the base vectors U, V and W and the translational part T are given in the following format:

Ux Uy Uz 0Vx Vy Vz 0 Wx Wy Wz 0Tx Ty Tz 1

You should be able to decipher the matrices in XFiles using this schema. Every frame states its local tranformation, the transformation of the node in relation to its parent's local coordinate space. Therefore, animations alter the *local* transformation of the node they affect. They replace the node's original transformation matrix, to be more precise.

Bones have an offset matrix each. It's a bit mis-named like this, other sources describe it more accuratly as inverse bone matrix. It's the matrix that transforms from mesh coordinate space to the bone's local coordinate space. Therefore, to get a full bone transformation matrix which describes how a vertex of the mesh is transformed by the bone you have to do the following:

BoneMat = BoneOffsetMatrix * BoneNodeTransform * ParentNodeTransform * ... all the way back to the root node of the bone hierarchy. For row-major matrices the multiplication sequence is MatFirst * MatMiddle * MatLast. This is the opposite sequence of what you might be used to from OpenGL's column-major matrices.

For the moment you can safely ignore the root frame's transformation. In most cases it will be the unity matrix anyways.

At last: please don't mind me posting a bit of a promotion here: Assimp - The Open Asset Import Library. Reads XFiles as well as over 20 other file formats into an in-memory data structure which is pretty easy to use. For XFiles, all three kinds are supported: text, binary and compressed binary. While it might be fun at first to write an model loader, it will be a lot of work in the long run to support all the exporters out there, each with it's own set of bugs you have to work around. And I talk from experience, I'm the developer of the XFile loader of the aforementioned library.

Bye, Thomas

[Edited by - Schrompf on May 18, 2009 1:33:36 PM]

##### Share on other sites
Hey thanks. I will go and try out your methods. Will get back here if i encounter any more problems. Thanks again to all who have helped.

1. 1
2. 2
3. 3
4. 4
frob
15
5. 5

• 12
• 12
• 20
• 12
• 13
• ### Forum Statistics

• Total Topics
632149
• Total Posts
3004453

×