• Announcements

Archived

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

MD2 vertex dance problem

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 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 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 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 on other sites
I do that. Maybe it is just the animation faulty, not the code...

Share on other sites
Yeh, sounds like that is the case, try loading it into max or milkshape or something and see if tweaking it helps.

Share on other sites
OK. If the source of your MD2 models is anything other than Quake 2 assets then I would question the validity of the model files.

-dizzy

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 on other sites
That is what I thought from the start.

Bah.. should I throw away MD2 support? Then my engine would have no 3D format and I would have to start over.

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

• Partner Spotlight

• Forum Statistics

• Total Topics
627677
• Total Posts
2978589

• 11
• 12
• 10
• 12
• 22