Introduction
IQE is the text form of an Inter-Quake Model: an
easily written export format that the IQM compiler turns into the binary file. It
was published on 20 April 2010 as version 0; the vx command was added on
11 January 2012. The Blender exporters of the IQM kit write it when the output name
ends in .iqe.
Structure
A file is a series of lines, each one command followed by its arguments, separated by white space. The first line must be
# Inter-Quake Export
with nothing but optional white space before #; anything after
Export is ignored. A line beginning with # is a comment.
The compiler also ignores leading white space and unknown commands. A name argument
is a run of characters without spaces, or any text between double quotes.
Vertex attributes
Each command appends one element to its own array. Every array must be absent or as long as the others; the commands may be interleaved in any order.
| Command | Meaning | Defaults |
|---|---|---|
vp X Y Z W | Position | X, Y, Z 0; W 1 |
vt U V | Texture coordinate | 0, 0 |
vn X Y Z | Normal | |
vx X Y Z W | Tangent, with W the sign of dot(cross(normal, tangent), bitangent) | Used with four or fewer values |
vx X Y Z A B C | Tangent X Y Z and bitangent A B C | Used with more than four values |
vb Ai Aw Bi Bw Ci Cw Di Dw … | Pairs of joint index (from 0) and weight | Missing places unused; more than four pairs may be given and the four largest kept and renormalised |
vc R G B A | Colour | R, G, B 0; A 1 |
v0…v9 X Y Z W | Custom attributes 0 to 9 | 0 |
vs N | Smoothing index of the vertex; see Smoothing |
The compiler discards weights of 0.001 or less.
vertexarray
vertexarray TYPE COMPONENT SIZE NAME
Chooses how an attribute is stored in the IQM file. Without it each array uses the type recommended for IQM, positions with 3 components (W ignored) and colours with 3 (alpha ignored). A custom attribute with no declared format is not used.
TYPE:position,texcoord,normal,tangent,blendindexes,blendweights,color, orcustom0tocustom9. Other values are ignored.COMPONENT:byte,ubyte,short,ushort,int,uint,half,floatordouble. Other values are ignored.SIZE: 1 to 4 components. Other values are ignored.NAME: name of a custom attribute; the type name if omitted.
Meshes and triangles
| Command | Meaning |
|---|---|
mesh NAME | Starts a mesh; the name defaults to empty |
material NAME | Material of the current mesh; defaults to empty |
fa A B C … | Face from vertex indices counted from the first vertex of the file, at 0 |
fm A B C … | Face from indices counted from the first vertex after the last mesh command |
Negative indices count back from the last vertex defined, which is −1. More than
three indices make a convex, planar polygon, which the compiler splits into a fan
around the first. If the file has any face command, each mesh consists of the faces
up to the next mesh; if it has none, each three vertices of a mesh form
a triangle.
Smoothing
Where normals are not given they are generated. Two triangle corners at the same position share a normal if they pass every kind of smoothing test in use. Smoothing works across meshes. The first three commands apply to the triangles that follow.
| Command | Meaning |
|---|---|
smoothuv N | N > 0: smooth corners whose texture coordinates match; N ≤ 0 turns this off, the default |
smoothgroup N | Triangles with the same key are smoothed; the default key is −1 |
smoothangle ANGLE | Largest angle in degrees between face normals that are smoothed; default 180; 0 makes everything faceted |
fs A B C … | Flags 0 or 1 for the edges of a face, each edge starting at the corresponding corner of an fa or fm: 1 smooths with neighbours across it. The number of fs commands and values must match the face commands |
vs N | Per vertex: corners whose vertices have the same index are smoothed. If used, every vertex needs it; it serves to record the original vertex of copies made by an exporter |
Skeleton and poses
joint NAME PARENT
Adds a joint. PARENT is the index of the parent in the list of joints,
from 0; negative or omitted means a root.
A pose is the transform of one joint, applied as (input × scale), rotated, plus
translation. Poses before the first animation command are the base pose,
the nth belonging to the nth joint.
| Command | Rotation given as |
|---|---|
pq Tx Ty Tz Qx Qy Qz Qw Sx Sy Sz | Quaternion; an omitted Qw is computed, taken negative |
pm Tx Ty Tz Ax Ay Az Bx By Bz Cx Cy Cz Sx Sy Sz | 3×3 matrix with rows A, B, C; it may contain scaling |
pa Tx Ty Tz Rx Ry Rz Sx Sy Sz | Angles about x, y and z in radians |
The scale values are optional and default to 1.
Animations
| Command | Meaning |
|---|---|
animation NAME | Starts an animation; without a name it gets an unused one |
loop | The current animation loops |
framerate N | Frames per second of the current animation |
frame | Starts a new keyframe |
Poses after animation belong to its current frame. Each frame should
have one pose per joint.
Comment section
Everything from the line after a comment command to the end of the file
is copied unchanged into the comment block of the IQM file.
Worked example
One triangle bound to one joint, with a two-frame animation:
# Inter-Quake Export
joint "root" -1
pq 0 0 0 0 0 0 -1
mesh "plate"
material "plate.tga"
vp 0 0 0
vt 0 0
vb 0 1
vp 1 0 0
vt 1 0
vb 0 1
vp 0 1 0
vt 0 1
vb 0 1
fm 0 1 2
animation "lift"
framerate 10
loop
frame
pq 0 0 0 0 0 0 -1
frame
pq 0 0 1 0 0 0 -1
Divergence from the specification
The IQM compiler behaves as follows.
- A
pqquaternion with a given Qw is normalised, and every pose quaternion is stored with w zero or negative. - A new mesh is begun by the next face after
meshormaterialonly when the name or material has changed. - A second
commentsection, as when several files are combined, is not read. - A negative
framerateis taken as 0. - It reads lines into a 512-byte buffer.
In the explorer
A dropped .iqe file shows every line in the byte tree. The model is drawn
in 3D with every triangle; a file without normals gets them by its smoothing
commands. The skeleton has views of its own, the animations can be played and every
frame opens as a pose.
Tables list the meshes, vertices, triangles, joints, poses, animations, frames, vertex array formats, smoothing commands, comments and the comment section. Materials name separate files: the names are shown and no textures are applied. Vertex colours are drawn without their alpha value, which has no effect in the format maker’s demo either. An animation without a frame rate has the rate as an option of the animated views, 24 frames a second to begin with. Files up to 256 MB are read.
Links
Software
- IQM Developer Kit – the compiler from IQE to IQM and the Blender exporters (C++, Python)
Reference
- iqe.txt – the format description
- iqm.cpp – the compiler’s IQE reader
- Inter-Quake Model – the home page of IQM and IQE