Archived

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

aker_jus

MD2 vertex dance problem

Recommended Posts

aker_jus    122
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
JuNC    236
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
aker_jus    122
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
yzzid    146
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
JuNC    236
Yeh, sounds like that is the case, try loading it into max or milkshape or something and see if tweaking it helps.

Share this post


Link to post
Share on other sites
yzzid    146
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 this post


Link to post
Share on other sites
jitspoe    122
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
aker_jus    122
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 this post


Link to post
Share on other sites
Maximus    124
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