X File Exporter Updates

Microsoft has defined a mesh file format called the ".X" file format. In my spare time, I've been looking for a standard, comprehensible file format which may get widespread support for a while, and it seems like this file format may fit the bill.

However, this file format is only in revision 2 (as of DirectX 9). As with all things Microsoft, they don't get good until the third time around. Here's a list of some things I find missing in the current revision of the file format and the bundled tools:

  • The mesh viewer only shows check boxes for the most basic vertex components (texture, position, normal, color). If you open, say, a skinned mesh, and bring up the options dialog, and then press OK, the mesh will get destroyed. Don't save after you do this!
  • The 3ds Max exporter requires Physique from Character Studio to export skinned meshes. However, most art developers who have upgraded to Max version 5 or higher, now use the built-in Skin modifier, rather than the Physique modifier. From an SDK perspective, the Skin modifier makes a whole lot more sense than Physique, too. However, the X file max exporter doesn't know about the modifier, and won't build unless you install the Character Studio SDK (or cut out the Physique parts).
  • The exporter also does not export the mesh as found at the top of the modifier stack; instead, it only looks at the base mesh and the optional physique modifier. Most artists I know will work with, save, and check in their Max files with a modifier stack a mile deep (well, at least with some XForm, Unwrap UVW, Paint Vertices, and FFD modifiers in the mix). Having to collapse before exporting is a major pain.
  • The documentation for the X mesh library does not really indicate how the mesh will be delivered to the vertex program, especially in cases such as a skinned mesh with an applied normal map and corresponding tangent basis. In fact, it's un-clear even how the file format supports this feature. The skinning information, as exporter, for example, contains of a list of all the vertex indices that are affected by each bone, iterated by bone. It's unclear how this gets turned around into a per- vertex vector of bone index and weight information, to pass to a skinning vertex shader.
  • The material support is unbelievably lame. It only supports a single texture name per material, plus a few old-skool parameters such as global emissive, ambient, diffuse and specular colors, and a global specular power.
  • The exporter clamps all UV mapping to the range 0-1. Yes, that's right, the exporter will screw your carefully mapped, tiling tree trunks and brick walls into a mess of solid edge pixels. This kind-of makes me doubt anyone with an actual game to build actually used this tool.

I'm looking into the feasibility of fixing up the exporter to deal with these problems. However, as this is still a "spare time" project, I don't know how far I'll get before I give up in disgust (my own file format and exporter already supports these features, but is only used by me).

You can check out my patch to use ISkin.