# MD5 (Doom3) format assembling

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

## Recommended Posts

I can read in all the MD5 data, but I have no idea how to turn it into physical coordinate data I can use to render in directx. What I've gathered is that each tri has an index, and 3 indices. However, I don't know if those indices come from the verts, or the weights. I've basically gathered bits and pieces of information, but haven't been able to put any of it together.

##### Share on other sites
well, doom 3 uses a skinning system, which is just skeletal animation. iirc there are "vertexs" which are really just the texture coordinates, but they have indexs into the "weights" which are the actual coordinates relative to each bone, so what you would do, is first get that vertex index and find the correct weights, then you would take each weight and multiply it by the bone's matrix then multiply that by the respective weight and then add them all together, and thats the vertex, do that for every vertex and then render it using the tex coords that are described by the "vertex" and your set, of course, there are indices (the triangle stuff) just stick all those indices one after the other into an index buffer and render in triangle mode, by the way, iirc the first number of just about everything in the md5 file is the index of that particular element, ie: this vertex looks like 0 { 1.00000 0.54307 } 4 5 that means "this is vertex 0, its texture coordinates are 1.0 and 0.54307, it uses vertices 4 to 4 + 5 (vertices 4 to 9) to get its final position

hope that helps
-Dan

##### Share on other sites
Thanks a lot, now that I got that working I of course can't get the animation working... Here's psuedocode of what I do:

for all joints{pos = baseframe.posuse the bitflags from the joint hierarchy to see what's being changedbuild a matrix from thatif there isn't a parentjoint.pos = pos;joint.mat = builtMat;D3DXVec3TransformCoord(jointpos, Vector:zero, joint.mat);elsejoint.mat = buildMat * parent.mat;D3DXVec3TransformCoord(jointpos, pos, parent.mat);joint.pos += parent.pos}

This gets me a distorted mesh that somewhat animates, but not correctly at all.

1. 1
2. 2
Rutin
21
3. 3
JoeJ
18
4. 4
5. 5

• 14
• 39
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631719
• Total Posts
3001882
×