Page 1 of 1

Read MD5MESH to model?

Posted: Sun Feb 07, 2010 6:24 am
by Netwatcher
hi guys, long time no C, mostly Haskell and LISP(R5RS scheme actually).
at any ratio...
I've made a little MD5MESH loader(to a data structure for now), and I've been wondering how I should go about getting each vertex of the model in place:
A.) there are vertices and weights(I don't get what these are), they should go together somehow, but I'm not sure how really...
B.) there is probably a certain order in which the vertices should be drawn, is it that the one they are already ordered in the file as, or is there a special index for that?


here are the MD5MESH file specifications.
http://www.modwiki.net/wiki/MD5MESH_%28file_format%29
I might be missing something there...

Thankz for your helpz in advancez,
Adar. ;)

Re: Read MD5MESH to model?

Posted: Sun Feb 07, 2010 11:23 am
by zeid
I personally haven't made an .MD5 model loader, but have scratch written an .OBJ loader, which is considerably easier.

A.) Weights refer to the amount that a 'joint' associated with a vertex influences it. It is related to animation, as .MD5 uses skeletal animation. Each of the vertices can have multiple weights associated with different joints (e.g. A vertex close to the forearm and the hand might have a weighting of 40% towards the wrist bone and 60% towards the forearm bone, thus when the bones move it's new position is calculated by the changes and the weights it has).

B.) Triangles are used to index the order in which the vertices are drawn in. The reasoning is that you don't want to repeat vertices (with the same x,y,z) in order to draw correctly. You can either reformat the data using the 'triangles' and 'vertices' data provided so that repeated vertices exist and it is all ordered by which vertex will be drawn first to last, or use API functions to help in the drawing (the second option is no doubt more optimized).

Re: Read MD5MESH to model?

Posted: Sun Feb 07, 2010 11:51 am
by Netwatcher
yea the weights are pretty self-explanatory...
I was mostly wondering why doesn't the vertices has an XYZ and only tex coords, and weighs has an XYZ?
the first thing that pops to my head when I think of a vertex is a location and texcords, can someone explain why they are separated to these two different terms(weights and vertices).

Thanks zeid, you cleared a lot of things up :)

P.S.
There is the function DrawIndexedPrimitive(D3D) for that, so the API helps me there :)

Re: Read MD5MESH to model?

Posted: Thu Feb 18, 2010 6:54 pm
by M_D_K
here's the spec also there is also sample code; it's for GL though.