Jump to content
  • Advertisement
Sign in to follow this  

MD5 (Doom3) format assembling

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

If you intended to correct an error in the post then please contact us.

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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!