XMF File format
Home Up XMF File format XSF Skeleton format XRF file format XAF file format XPF Morph format Rotations

 

Morph Targets

XMF Mesh file format

Note that this information is based on my examination of actual XMF files. Since then I have obtained further information from a description of the CAL3D formats, but that information isn't repeated here.

Header record, a solitary tag (it ends in />), probably ignored:

<HEADER MAGIC="XMF" VERSION="910" />

Start of Mesh section. All the data in this file is located between this tag and its corresponding closing tag.

<MESH NUMSUBMESH="1">

Submesh tag, multiple submeshes are allowed each located between an opening and closing tag.

Submeshes are typically used when a mesh uses multiple textures as each submesh can have its own texture.

NUMVERTICES is the number of points (vertices) that make up the submesh

NUMFACES is the number of triangles (faces) that make up the submesh

MATERIAL is the number of the texture used on the object.

NUMLODSTEPS are a facility for reducing the detail on a complex mesh. It's present in some example meshes but I don't think IMVU implement it, and I haven't analysed it.

NUMSPRINGS are a facility for simulating cloth. I haven't seen an IMVU example with this greater than zero

NUMMORPHS is an extension that I can find no information about, the line NUMMORPHS="0" shows up in some meshes. It is likely that non-zero values would be found in avatar head meshes.

TEXCOORDS are locations on a texture map. So far I've seen this set to one or two. It is not clear to me how a vertex could have multiple texture coordinates but since the example mesh with two texture coordinates also had a material with an opacity map its possible that the first set of coordinates refer to a location on the Diffuse Color map and the second coordinates refer to a location on the opacity map. It's possible that non-textured objects may exist with a TEXCOORDS of zero.

    <SUBMESH NUMVERTICES="24" NUMFACES="12" MATERIAL="0" 
           NUMLODSTEPS="0" NUMSPRINGS="0" NUMTEXCOORDS="1">

The start of a VERTEX section. The data making up each vertex (point) on the mesh is located between this and a closing vertex tag

        <VERTEX ID="0" NUMINFLUENCES="1">

ID is the number of the vertex starting from zero. All the examples I've seen number from zero in straight sequence with no gaps.

NUMINFLUENCES is the number of skeleton "bones" that the vertex is weighted (attached) to. Vertices of hard objects are usually attached to only one bone, but vertices near joints on a soft object may be weighted to bones either side of the joint in order to soften the joint. It is possible that your 3D tools may be able to export a mesh with no influences at all, however it is unlikely that IMVU could process it.

Under normal circumstances all the influence weights should add up to one.

A position record.

            <POS>200 -200 400</POS>

Coordinates are X, Y, Z. Using the default view in the previewer X coordinates extend to the right, Y coordinates away from the screen into the room and Z coordinates extend upwards.

As a rough guide to scale I'd put the avatar height at approximately 1140 to the top of the female avatar's head and the seat of a standard chair about 320 above the floor.

Coordinates are often specified to excessive accuracy, many designs will display well using only integers.

A "Normal" record.

            <NORM>0 0 0</NORM>

A normal is a "vector" pointing out of the surface of the mesh. It is used to determine lighting. If the object is not meant to use vertex lighting then the normal may be zero, otherwise it would normally have a length of 1.

The advantage of Normal Lighting over other methods is that it takes into account the orientation of the object when shading it.

A Colour record.

            <COLOR>1 1 1</COLOR>

Note the US Spelling. Colour records are rare, originally IMVU recommended the use of vertex colours for lighting but these days "Normal" lighting is more common. I'm told that the colour values range from zero to one and that the values are for Red, Green and Blue.

Thanks Nerseus.

A Texture coordinate

            <TEXCOORD>0.0 0.5</TEXCOORD>

This represents a location on the texture map. I think top left is 0,0 and bottom right is 1,1. Values above 1 wrap around so a material can repeat across a mesh.

This may be duplicated, however in the one case I've seen with two texture coordinates they were identical.

An Influence ID

            <INFLUENCE ID="1">1</INFLUENCE>

The ID is the number of the bone that the vertex attaches to. The quantity between the tags is the weight. Warning: The Influence tag usually appears on one line, but some programs may split it across three lines:

            <INFLUENCE ID="1">
                1
            </INFLUENCE>

the above is legitimate XML and recognised by IMVU, but may trip up some programs. The one line form should be the preferred format.

Closing Vertex Tag, remaining Vertices and Faces

        </VERTEX>
        <VERTEX ID="1" NUMINFLUENCES="1">
            <POS>200 -200 0</POS>
            <NORM>0 0 0</NORM>
            <TEXCOORD>0.0 1.0</TEXCOORD>
            <INFLUENCE ID="1">1</INFLUENCE>
        </VERTEX>
        <VERTEX ID="2" NUMINFLUENCES="1">
            <POS>200 200 400</POS>
            <NORM>0 0 0</NORM>
            <TEXCOORD>0.25 0.5</TEXCOORD>
            <INFLUENCE ID="1">1</INFLUENCE>
        </VERTEX>
        <VERTEX ID="3" NUMINFLUENCES="1">
            <POS>200 200 0</POS>
            <NORM>0 0 0</NORM>
            <TEXCOORD>0.25 1.0</TEXCOORD>
            <INFLUENCE ID="1">1</INFLUENCE>
        </VERTEX>
        <VERTEX ID="4" NUMINFLUENCES="1">
            <POS>200 200 400</POS>
            <NORM>0 0 0</NORM>
            <TEXCOORD>0.25 0.5</TEXCOORD>
            <INFLUENCE ID="1">1</INFLUENCE>
        </VERTEX>
        <VERTEX ID="5" NUMINFLUENCES="1">
            <POS>200 200 0</POS>
            <NORM>0 0 0</NORM>
            <TEXCOORD>0.25 1.0</TEXCOORD>
            <INFLUENCE ID="1">1</INFLUENCE>
        </VERTEX>
        <VERTEX ID="6" NUMINFLUENCES="1">
            <POS>-200 200 400</POS>
            <NORM>0 0 0</NORM>
            <TEXCOORD>0.50 0.5</TEXCOORD>
            <INFLUENCE ID="1">1</INFLUENCE>
        </VERTEX>
        <VERTEX ID="7" NUMINFLUENCES="1">
            <POS>-200 200 0</POS>
            <NORM>0 0 0</NORM>
            <TEXCOORD>0.50 1.0</TEXCOORD>
            <INFLUENCE ID="1">1</INFLUENCE>
        </VERTEX>
        <VERTEX ID="8" NUMINFLUENCES="1">
            <POS>-200 200 400</POS>
            <NORM>0 0 0</NORM>
            <TEXCOORD>0.50 0.5</TEXCOORD>
            <INFLUENCE ID="1">1</INFLUENCE>
        </VERTEX>
        <VERTEX ID="9" NUMINFLUENCES="1">
            <POS>-200 200 0</POS>
            <NORM>0 0 0</NORM>
            <TEXCOORD>0.50 1.0</TEXCOORD>
            <INFLUENCE ID="1">1</INFLUENCE>
        </VERTEX>
        <VERTEX ID="10" NUMINFLUENCES="1">
            <POS>-200 -200 400</POS>
            <NORM>0 0 0</NORM>
            <TEXCOORD>0.75 0.5</TEXCOORD>
            <INFLUENCE ID="1">1</INFLUENCE>
        </VERTEX>
        <VERTEX ID="11" NUMINFLUENCES="1">
            <POS>-200 -200 0</POS>
            <NORM>0 0 0</NORM>
            <TEXCOORD>0.75 1.0</TEXCOORD>
            <INFLUENCE ID="1">1</INFLUENCE>
        </VERTEX>
        <VERTEX ID="12" NUMINFLUENCES="1">
            <POS>-200 -200 400</POS>
            <NORM>0 0 0</NORM>
            <TEXCOORD>0.75 0.5</TEXCOORD>
            <INFLUENCE ID="1">1</INFLUENCE>
        </VERTEX>
        <VERTEX ID="13" NUMINFLUENCES="1">
            <POS>-200 -200 0</POS>
            <NORM>0 0 0</NORM>
            <TEXCOORD>0.75 1.0</TEXCOORD>
            <INFLUENCE ID="1">1</INFLUENCE>
        </VERTEX>
        <VERTEX ID="14" NUMINFLUENCES="1">
            <POS>200 -200 400</POS>
            <NORM>0 0 0</NORM>
            <TEXCOORD>1.00 0.5</TEXCOORD>
            <INFLUENCE ID="1">1</INFLUENCE>
        </VERTEX>
        <VERTEX ID="15" NUMINFLUENCES="1">
            <POS>200 -200 0</POS>
            <NORM>0 0 0</NORM>
            <TEXCOORD>1.00 1.0</TEXCOORD>
            <INFLUENCE ID="1">1</INFLUENCE>
        </VERTEX>
        <VERTEX ID="16" NUMINFLUENCES="1">
            <POS>200 -200 400</POS>
            <NORM>0 0 0</NORM>
            <TEXCOORD>0.00 0.0</TEXCOORD>
            <INFLUENCE ID="1">1</INFLUENCE>
        </VERTEX>
        <VERTEX ID="17" NUMINFLUENCES="1">
            <POS>200 200 400</POS>
            <NORM>0 0 0</NORM>
            <TEXCOORD>0.00 0.5</TEXCOORD>
            <INFLUENCE ID="1">1</INFLUENCE>
        </VERTEX>
        <VERTEX ID="18" NUMINFLUENCES="1">
            <POS>-200 -200 400</POS>
            <NORM>0 0 0</NORM>
            <TEXCOORD>0.25 0.0</TEXCOORD>
            <INFLUENCE ID="1">1</INFLUENCE>
        </VERTEX>
        <VERTEX ID="19" NUMINFLUENCES="1">
            <POS>-200 200 400</POS>
            <NORM>0 0 0</NORM>
            <TEXCOORD>0.25 0.5</TEXCOORD>
            <INFLUENCE ID="1">1</INFLUENCE>
        </VERTEX>
        <VERTEX ID="20" NUMINFLUENCES="1">
            <POS>-200 -200 0</POS>
            <NORM>0 0 0</NORM>
            <TEXCOORD>0.25 0.0</TEXCOORD>
            <INFLUENCE ID="1">1</INFLUENCE>
        </VERTEX>
        <VERTEX ID="21" NUMINFLUENCES="1">
            <POS>-200 200 0</POS>
            <NORM>0 0 0</NORM>
            <TEXCOORD>0.25 0.5</TEXCOORD>
            <INFLUENCE ID="1">1</INFLUENCE>
        </VERTEX>
        <VERTEX ID="22" NUMINFLUENCES="1">
            <POS>200 -200 0</POS>
            <NORM>0 0 0</NORM>
            <TEXCOORD>0.50 0.0</TEXCOORD>
            <INFLUENCE ID="1">1</INFLUENCE>
        </VERTEX>
        <VERTEX ID="23" NUMINFLUENCES="1">
            <POS>200 200 0</POS>
            <NORM>0 0 0</NORM>
            <TEXCOORD>0.50 0.5</TEXCOORD>
            <INFLUENCE ID="1">1</INFLUENCE>
        </VERTEX>
 

Face tags (not paired)

        <FACE VERTEXID="0 1 2" />
        <FACE VERTEXID="3 2 1" />
        <FACE VERTEXID="4 5 6" />
        <FACE VERTEXID="7 6 5" />
        <FACE VERTEXID="8 9 10" />
        <FACE VERTEXID="11 10 9" />
        <FACE VERTEXID="12 13 14" />
        <FACE VERTEXID="15 14 13" />
        <FACE VERTEXID="16 17 18" />
        <FACE VERTEXID="19 18 17" />
        <FACE VERTEXID="20 21 22" />
        <FACE VERTEXID="23 22 21" />

Each face is a triangle. The numbers are the IDs of the vertices at each point of the triangle. This greatly reduces the amount of calculation required compared to specifying each corner individually.

Note the order of the vertices is important. If they are arranged in clockwise sequence then the face is facing away from the viewer and will not be drawn (unless "two sided" is enabled).

Optional Morph targets

Close of the submesh tag

    </SUBMESH>

Close of the Mesh tag

</MESH>
 

Home Up XMF File format XSF Skeleton format XRF file format XAF file format XPF Morph format Rotations