|
|
XMF Mesh file formatNote 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:
Start of Mesh section. All the data in this file is located between this tag and its corresponding closing tag.
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.
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
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.
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.
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.
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
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
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:
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
Face tags (not paired)
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 targetsClose of the submesh tag
Close of the Mesh tag
|