Sign in to follow this  

MD5 (Doom3) format assembling

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 this post

Link to post
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

Share this post

Link to post
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.pos
use the bitflags from the joint hierarchy to see what's being changed
build a matrix from that

if there isn't a parent
joint.pos = pos;
joint.mat = builtMat;
D3DXVec3TransformCoord(jointpos, Vector:zero, joint.mat);

joint.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.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this