Skip to content
Chuck Walbourn edited this page May 6, 2015 · 46 revisions

http://go.microsoft.com/fwlink/?LinkId=226208

The Samples Content Exporter was shipped as a sample in the legacy DirectX SDK. It makes use of the Autodesk FBX SDK to import an FBX file and then export the data as an SDKMESH. The SDKMESH format is a runtime geometry format supported by the DirectX Tool Kit and DXUT, and is used in the Windows 8 Store app sample Marble Maze.

See Samples Content Exporter (May 2015), Samples Content Exporter Update (April 2012), and DirectXMesh.

Disclaimer: .SDKMESH has a long-time samples runtime geometry format for Microsoft since the retiring of the legacy .X file format. It has a number of limitations, and we don't recommend using it as a your production solution for meshes. It is, however, very useful for samples and itself serves as an example of such file containers. The documentation on the format can be found here.

Overview

The exporter implements a broad set of features designed for game-related content export tasks, including the following:

  • Parses FBX and other file formats supported by the Autodesk FBX SDK.
  • Parses and exports full scene data, including transform frames (nodes), lights, and cameras.
  • Exports rigid and skinned meshes, complete with subset information, several vertex compression options, multiple UV channels, and texture tangent space creation.
  • Parses common material information (diffuse, normal map, and specular textures) extracted from all types of materials, regardless of their construction.
  • Provides a sampling-based, adjustable precision animation track converter that stores linear keyframes with quaternions for orientation.
  • Provides a texture map conversion and compression, including optional texture bundling for Xbox 360.
  • Offers advanced content conversion and generation options, including UV atlas generation, poly mesh to Catmull-Clark subdivision surface translation, and more.

The exporter was originally designed as an internal support tool for samples development, but the decision was made to release the source code in hopes that title developers would find it useful.

Building

Remember to set the FBX_SDK environment variable to the location of the Autodesk FBX SDK installed on your system (such as C:\Program Files\Autodesk\FBX\FbxSdk\2016.0) before launching Visual Studio. You are free to use either the DLL or static library version of the Autodesk FBX SDK, but would recommend using the DLL version which keeps the content exporter tool itself to around 1 MB instead of being nearly 7 MB.

Visual Studio 2010 users must install the standalone Windows 8.1 SDK as well.

Example Usage

Open a Command Prompt, and change to the directory containing ContentExporter.exe (i.e. ...\ContentExporter\ImportFBX\Release_2013 if you use VS 2013 to build it).

contentexporter <path-to-your-scene-files>\test.fbx

This will load the test.fbx file and then create a test.sdkmesh output file in the same directory, along with .dds files for any materials referenced.

Options

  • -help, -? Shows the exporter usage help and command line options.

  • -outputpath path Sets the output path for the exporter. If this option is not specified, the output path is the path of each input file. XATG files will appear in scenes\ and textures\ subdirectories of the output path.

  • -verbose Shows more detailed output during export. Equivalent to -loglevel 4.

  • -xatg Uses the XATG file format, equivalent to -fileformat xatg.

  • -sdkmesh Uses the SDKMESH file format, equivalent to -fileformat sdkmesh.

  • -xbox360 Sets a group of options for an Xbox 360 target. This macro option is equivalent to the following options:

-endian ppc -packmeshdata+ -bundletextures+ -useexistingbundle+ -compressvertexdata+ -compressednormaltype float16_4 -fileformat xatg

  • -windowsd3d9 Sets a group of options for a Windows Direct3D 9 target. This macro option is equivalent to the following options:

-endian intel -bundletextures- -useexistingbundle- -compressvertexdata- -compressednormaltype float16_4 -fileformat sdkmesh

  • -windowsd3d10 Sets a group of options for a Windows Direct3D 10 target. This macro option is equivalent to the following options:

-endian intel -bundletextures- -useexistingbundle- -compressvertexdata- -compressednormaltype float16_4 -fileformat sdkmesh

  • -windowsd3d11 Sets a group of options for a Windows Direct3D 11 target. This macro option is equivalent to the following options:

-endian intel -bundletextures- -useexistingbundle- -compressvertexdata- -compressednormaltype float16_4 -fileformat sdkmesh

  • -collisionmesh Sets a group of content filtering options to export collision meshes. Collision meshes consist of a 32-bit index buffer and vertex positions only. This macro option is equivalent to the following options:

-exportanimations- -exportcameras- -exportlights- -exportmaterials- -compressvertexdata- -computevertextangents- -exportnormals- -exportcolors- -exportbinormals- -exportboneweights- -force32bitindices+ -maxuvsetcount 0 -bundletextures- -useexistingbundle- -meshnamedecoration CollisionMesh

  • -animation Sets a group of content filtering options to export animations. Only animation tracks are exported, and no meshes, frames, lights, cameras, or materials are exported. This macro option is equivalent to the following options:

-exportanimations+ -exportmeshes- -exportframes- -exportcameras- -exportlights- -exportmaterials- -compressvertexdata- -computevertextangents- -exportnormals- -exportcolors- -exportbinormals- -exportboneweights- -force32bitindices- -maxuvsetcount 0 -bundletextures- -useexistingbundle- -packmeshdata- -renameanimations+

  • -character Sets a group of content filtering options to export characters. Only frames, meshes, and materials are exported, and no animations, cameras, or lights are exported. This macro option is equivalent to the following options:

-exportanimations- -exportcameras- -exportlights- -exportmeshes+ -exportframes+ -exportmaterials+

  • -subd11 Sets a group of content filtering options to export content for the SubD11 sample. This macro option is equivalent to the following options:

-windowsd3d11 -compressvertexdata- -convertmeshtosubd+ -exportbinormals- -forceboneweights+ -maxuvsetcount 1

  • -subdxbox Sets a group of content filtering options to export content for the Xbox 360 SubD sample. This macro option is equivalent to the following options:

-xbox360 -compressvertexdata+ -convertmeshtosubd+ -exportbinormals- -forceboneweights+ -maxuvsetcount 1

  • -savesettings filename Saves the current settings to the specified file. In order to capture all settings, ensure that this option is used last on the command line.

  • -loadsettings filename Loads settings from the specified file. Subsequent settings commands override those loaded from the file.

  • -filelist filename Loads a list of input content file names from the specified file.

  • -loglevel [1-10] Shows progress messages during the export operation. Higher numbers show more messages (defaults to 1).

For additional options, see Options

File Formats: XATG and SDKMESH

The content exporter can generate two different output file formats: XATG and SDKMESH. XATG was designed for use in Xbox 360 samples, and SDKMESH was designed for use in Direct3D 10 samples. While these two file formats are reasonably full featured, they do not necessarily demonstrate best practices for run-time formats for use in game development. Certain compromises have been made in each format to ease sample development, and these compromises may not make sense for a retail game title.

XATG File Format

The XATG file format is a hybrid XML and binary format, designed for easy human readability and easy editability with XML or text editors, while maintaining reasonably fast load speeds for complex content. Since it is XML based, the layout of the data is reasonably flexible, and evolution of the XATG format does not necessarily mean that older XATG files become obsolete. The format supports transform frames, meshes with multiple subsets, materials with general parameters, lights, cameras, and animation tracks with timestamped linear keyframes. Mesh data (vertex and index buffers) can either be inlined as text in the XML file, or packed into a separate binary PMEM (physical memory) file, and simply referenced by offset in the XML data. Inlined text data is easier to inspect and edit by hand, but it greatly increases load times.

XATG requires a fixed directory structure; XATG and PMEM files must exist in a scenes subdirectory, and all textures must exist in a textures subdirectory parallel to the scenes directory. Textures can either be provided as a single texture bundle file (generated by using the Bundler tool), or as individual texture files.

SDKMESH File Format

The SDKMESH file format is a binary format consisting of memory-mapped structures, designed for quick loading. While it is not as flexible or readable as XATG, it is much quicker and simpler to load. Since it consists of memory mapped structures, most changes to the file format require old content to be re-exported, as the structures would no longer line up. SDKMESH supports transform frames, meshes with multiple subsets, materials with fixed parameters, and animation tracks with regularly spaced linear keyframes. Animation data is exported into a parallel SDKMESH_ANIM file.

SDKMESH does not place any restrictions on texture file locations. In practice, the SDKMESH file is in the same directory as all textures referenced in the file. SDKMESH files always reference individual texture files.

Material and Texture Conversion

The content exporter is able to parse many types of materials and extract common material properties, including diffuse textures, normal map textures, specular map textures, and transparency. Material nodes are recursively parsed in search of these material properties. If more than one texture of a particular type is found, the second through final textures are labeled with a number, such as "DiffuseTexture2". Note that the SDKMESH file format only supports one texture of each type.

The content exporter automatically copies and converts source textures from their source locations to a location in the output path. DirectXTex is used to load textures, so the exporter supports all of the input file formats supported by that API, including BMP, TGA, JPG, PNG, and more. The input scene data usually specifies an absolute path for the texture files, and the exporter starts by looking in that location for each texture file. If a texture is not found in its source location, or the source location is unavailable, the exporter looks for a texture with the same filename in the same location as the source scene file. If the texture is not found in that location, the exporter gives up on converting that texture and shows a warning.

Bounding Volumes and Light Range Values

The content exporter generates bounding volumes for models, and computes ranges for point lights and spot lights. Model bounding volumes are generated by computing three bounds types (axis aligned box, oriented box, and sphere) for the mesh within a model, and choosing the bound with the smallest volume. The bounds are exported as part of the scene file, and are specified in object-relative coordinates.

Light ranges are a bit less straightforward, since DCC packages like Maya have no concept of a light range—just a falloff designated by the light type. In this case, a bounding range value must be computed from the intensity of the light and the falloff type. Therefore, to increase the range of a light in the exported content, increase the light intensity. The following table describes how the light range is computed for various light falloff settings.

Falloff Type   Range Computation
No Decay       4 * Intensity
Linear         4 * Intensity
Quadratic      2 * Sqrt( Intensity )
Cubic/Other    20 (fixed value)

Notable Changes

  • This version no longer makes use of D3DX or any component of the legacy DirectX SDK.
  • It no longer supports compressing normals to the "dec3n" format as there is no DXGI equivalent to that Direct3D 9 format.
  • This version supports new features such as vertex cache optimization

For Use

  • Windows desktop apps
  • Windows 11
  • Windows 10
  • Windows 8.1
  • Windows 7 Service Pack 1

For Development

  • Visual Studio 2019

Related Projects

DirectX Tool Kit for DirectX 11

DirectX Tool Kit for DirectX 12

DirectXMesh

DirectXTex

UVAtlas

DirectXTKModelViewer for DirectX 11

DirectXTKModelViewer for DirectX 12

DxCapsViewer

Clone this wiki locally