let's talk about ...
the new formats of the md5mesh and md5anim files
i have take a first look on it and will post here what i have found out, it is not complete
so, start with some excerpts of two example files, i choose the imp:
imp.md5mesh
Code:
MD5Version 10
commandline "mesh models/monsters/imp/animation/cycles/imp.mb -dest models/md5/monsters/imp/imp.md5mesh -game Doom -prefix IMP1_ -keep Lknee Rknee Lelbow Relbow camera Body -keep Rmissile Lmissile -parent Rmissile Rhand -parent Lmissile Lhand -parent Rwing Chest -parent Lwing Chest -parent Hips Body -parent Waist Body -parent camera Head -prefix IMP2_ -prefix IMP_ -align ALL"
numJoints 71
numMeshes 1
joints {
"origin" -1 ( 0 0 0 ) ( -0.5 -0.5 -0.5 ) //
"Body" 0 ( -0.0000002384 0 56.5783920288 ) ( -0.5 -0.5 -0.5 ) // origin
"Hips" 1 ( 3.3494229317 -0.0225959271 62.0168151855 ) ( -0.5 -0.5 -0.5 ) // Body
...
}
mesh {
// meshes: polySurface1
shader "models/monsters/imp/imp"
numverts 891
vert 0 ( 0.8658549786 0.3910109997 ) 1377 2
...
numtris 1346
tri 0 2 1 0
...
numweights 1401
weight 0 47 1 ( 1.5918749571 -0.9465401769 4.3310847282 )
...
}
idle1.md5anim
Code:
MD5Version 10
commandline "anim models/monsters/imp/animation/cycles/idle1.ma -dest models/md5/monsters/imp/idle1.md5anim -game Doom -prefix IMP1_ -keep Lknee Rknee Lelbow Relbow camera Body -keep Rmissile Lmissile -parent Rmissile Rhand -parent Lmissile Lhand -parent Rwing Chest -parent Lwing Chest -parent Hips Body -parent Waist Body -parent camera Head -prefix IMP2_ -prefix IMP_ -align ALL"
numFrames 80
numJoints 71
frameRate 24
numAnimatedComponents 52
hierarchy {
"origin" -1 0 0 //
"Body" 0 6 0 // origin ( Ty Tz )
"Hips" 1 3 2 // Body ( Tx Ty )
"Lupleg" 2 56 4 // Hips ( Qx Qy Qz )
...
}
bounds {
( -12.7120218277 -30.5424346924 -0.7133038044 ) ( 18.
4121990204 41.8222160339 81.8068695068 )
...
}
baseframe {
( 0 0 0 ) ( -0.5 -0.5 -0.5 )
( 2.4760267735 51.5447387695 -3.0239832401 ) ( 0 0 -0.0269656405 )
( 1.0195504427 5.3025918007 3.3494231701 ) ( 0 0 0 )
...
}
frame 0 {
51.5447387695 -3.0239832401
1.0195504427 5.3025918007
0.7355086803 -0.3889687657 0.4772257507
0.0189839788 0.0578746125 -0.5245873928
-0.8296036124 0.3866359591 0.0100788241
0.488070637 -0.3712677062 0.7295016646
-0.0142540894 -0.0333928876 -0.5200206041
0.8724460602 -0.4404397309 0.1936372519
1.0421460867 2.7552113533
-0.1609682292 0.0150111886 0.067597121
6.2155857086 5.6233057976 0.0092875436 -0.037551783 -0.0034615761
-5.4427704811 0.0235444643
6.0652527809
0.0415914208 0.1587915123 -0.0024342418
0.1301603615 0.0321234874 -0.2374467552
0.0672957376 -0.1049735919 0.1197357625
0.0461013205
-6.2936215401 -0.2602182925 0.0192391276 -0.4136874974
0.0191769451 -0.1025890633 0.0379714668
}
...
md5mesh:Joint:Code:
"origin" -1 ( 0 0 0 ) ( -0.5 -0.5 -0.5 )
first the name of the joint
second the index of the parentjoint, -1 == no parent
the next three numers are the position of the joint x y z
the last three numbers are part of the orientation-quaternion
the md5 stores only the x y z components
there are unit quaternions, so there length are 1.0
Code:
1.0 = x^2 + y^2 + z^2 + w^2
so to calc the w component do
Code:
float term = 1.0f - (x*x) - (y*y) - (z*z);
float qw;
if (term < 0.0f)
qw = 0.0f;
else
qw = - (float) sqrt(term);
the position and orientation are also absolute values, no offest to the parent joint
Mesh:beside some ('s and )'s, it's equal to the old format
quick refresh:
verts store the uv texcoords and the startindex and count of the weights
weights store the jointindex and the weight and x y z pos
md5anim:numFrames 80
numJoints 71
frameRate 24
numAnimatedComponents 52
hierarchy:numJoints entries
Code:
"Lrib" 21 59 27 // Chest ( Tx Ty Qx Qy Qz )
first the name of the joint
than the parentjoint index
next the flag that tells whitch components are animated in the frames:
six possible components - translation x y z and orientation x y z
one bit for each component:
bit 0 - 1 => translation x
bit 1 - 2 => translation y
bit 2 - 4 => translation z
bit 3 - 8 => orientation x
bit 4 - 16 => orientation y
bit 5 - 32 => orientation z
ie:
56 => 8+16+32 -> alle three orientation values
6 => 2+4 -> translation y and z
the last number in the hierarchy entry line are the startindex of the animated components in each frame,
the count of animated components are indicated by the preceding flag
bounds:
numFrames entries
min x y z and max x y z
the boundingbox coordinates are relative to the root bone's position ( at the first frame of the animation ?)
baseframe:
position x y z and orientation x y z (part of quaternion, see md5mesh joint description)
i think this are the pos and orientation of the joints as offsets (relative to each parent joint), unlike the absolute values of the md5mesh joints
frame:
numAnimatedComponents entries
my assumption is the the anim.components are also relative values and are used in combination with the baseframe data, but i have not tried it currently, so some tests are necessarily
when you know some more infos or have some corrections please post it
