Current status of iqm/md5 models?

Actually most of the IQM support for ioquake3 was done by gimhael (bugzilla #4965).

Yes quirkychirps, Xreal supports MD5 models.

Viability of IQM in ioquake3

Last month I made a IQM exporter for my fork of Misfit Model 3D. (I haven’t released or fully completed the exporter yet. I haven’t managed to build Misfit Model 3D for Windows yet either.) It allowed me to export my Turtle Arena player model as IQM which renders and animates correctly in ioquake3.

Adding the turtle IQM in ioquake3 opengl1 on q3dm1 using the testModel command causes my frames per-second to drop from 550 to 450. About 30% of ioquake3 CPU time is in RB_IQMSurfaceAnim(), the next highest function uses only 5%. I would not recommend releasing a game using animated IQM models until ioquake3 IQM performance is improved.


Screenshot of Turtle Arena (Spearmint engine) with IQM bone drawing (not committed yet) and player drawing hacked up to use a IQM model for whole body (missing torso animation blending).

Here is the turtle IQM test model I used (missing tag_torso, etc). Add to baseq3 and use ioquake3 commands testmodel models/players/raph/raph.iqm, prevframe, and nextframe to view it in-game.

If you have MD5 models you want to test use iqm.exe in command prompt from IQM development kit to convert .md5 and .md5anim files to a single IQM file.

Advantages of IQM

I think the only advantage the MD5 format has over IQM is that MD5 supports more than 4 bone weights per-vertex (unlimited?). However I think IQM has many advantages over MD5.

  1. IQM is faster to load because it’s a binary format.

  2. There is less processing to do when loading the model because IQM usually contains vertex normals, vertex tangents (useful for normal maps), and triangle adjacency (useful for shadows, but ioq3 doesn’t use it). Most of the data in IQM format is optional. If storing normals, tangents, and triangle adjacency seems like a waste of space, you can modify the exporter to leave them out or make a program to remove them. (Though ioq3 assumes that normals and tangents always exist in IQM.)

  3. IQM stores the bone joint quaternion W component to minimize animation jitter.

  4. IQM may have better vertex lighting in-game due to using the vertex normals created in the 3D model software instead of auto-generated smoothed normals.

  5. IQM supports animating the scale of bones in addition to position and rotation.

IQM Animation

Animations can be stored in the IQM file. There is no need to use .md5anim. Using IQM in ioquake3 animation frames are accessed by frame number like MD3. IQM can contain a list of animations similar to the information listed in quake3 player animations.cfg (animation name, start frame, number of frames, frame rate, and whether the animation loops). There isn’t a way to access list of animations in ioquake3 though.

It’s possible to use separate IQM models for meshes and animations. This allows sharing the animations with multiple models (if they have the same skeleton). Though I wouldn’t recommend putting each animation in a separate file like .md5anim. (If you’re going to load all the animations anyway, using a single file is less file system access.) Separate IQM meshes and animations are support by Spearmint but not ioquake3 because it requires changing the CGame/UI API.

ioquake3 IQM implementation needs to be improved :man_shrugging:

The major issue with ioquake3’s IQM support is that calculating the vertex positions for rendering animated IQM models is abysmally slow. Though I’m not sure if MD5 would be any faster. Doom 3 uses SIMD optimization for better performance calculating joints and vertex positions on CPU (see Fast Skinning and other Doom 3 docs by Mr. Elusive, includes code licensed as LGPL v2.1 or later which can be used with ioq3).

Performance could be improved in the opengl2 renderer by calculating the vertex positions on the GPU (using GLSL vertex skinning) instead of the CPU. GLSL vertex skinning is probably fairly easy to add and a huge performance improvement. Would still benefit from using SIMD for converting relative-to-parent joints to absolute joints.

2 Likes