Archived

This topic is now archived and is closed to further replies.

MD2 vertex dance problem

This topic is 5533 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 have a fully functioning MD2 renderer in my engine, but I have this problem: With some models, the vertices seem to jump around a little bit. I know this is a problem cause MD2 stores its vertices as unsigned chars and not as floats like all modern formats. Has anyone tackled this problem? Thanks

Share this post


Link to post
Share on other sites
Make sure you are lerping between frames and not just switching frames (ie linearly interpolating between each vertex in one frame to the corresponding vertex in the next). I guess you could try doing some quadratic or more interpolation between more frames, but that might not work well.

Share this post


Link to post
Share on other sites
Yup, of course i linear interpolate between current frame and next frame. This ''jumping'' is not noticable in all models, so it is not a problem of my code.

Maybe if I convert somehow the unsigned char to float? I dont know. Any ideas?

Share this post


Link to post
Share on other sites
You need to multiply the xyz coords by the frame scale factor and translate by the frmae translation to get your floating point xyz values.


  
float x = xyzs[index].v[0] * frames[0].scale[0] + frames[0].translate[0];
float z = -(xyzs[index].v[1] * frames[0].scale[1] + frames[0].translate[1]);
float y = xyzs[index].v[2] * frames[0].scale[2] + frames[0].translate[2];


-dizzy

[edited by - yzzid on October 20, 2002 8:10:43 AM]

Share this post


Link to post
Share on other sites
It''s a problem with the md2 files, most likely. You can see it in quake2 as well (just watch the idle gun animations, the verts jiggle all over the place). I''ve heard it''s due to some kind of "compression" in the file format. I personally think it''s lack of precision. Either way, there''s nothing you can do about it.

Share this post


Link to post
Share on other sites
Its the compression in the md2 format that is the base of its lack of precision. The xyz floating point values are compressed into a 16bit (iirc) value for writing with just a simple division and rounding off of the decimal places.

-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else''s drivers, I assume it is their fault" - John Carmack

Share this post


Link to post
Share on other sites