Skip to content

Geometry formats

Chuck Walbourn edited this page Apr 27, 2022 · 14 revisions

The DirectXMesh library does not include file I/O operations for reading or writing geometry, and is focused on processing memory buffers of indices and vertices. The primary reason for this design decision is that there are numerous geometry formats all of which have various pros and cons, and it is extremely difficult to write a policy-neutral, generally useful mesh library that presumes specific formats are in use.

There are a number of geometry container formats that are in common use with Direct3D:

Autodesk FBX

The Autodesk FBX file format is an interchange format for 3D assets. It is extremely useful as a source file format, but makes a poor runtime format as it's far too heavy-weight. The most common use of the FBX SDK is to create exporters that extract the needed data and writing to the a custom runtime format.

FBX SDK

Samples Content Exporter

CMO

Compiled Mesh Object (CMO) is a simple runtime format that is supported by the Visual Studio content pipeline (introduced in VS 2012). This support provides the ability for Visual Studio to build a CMO from an Autodesk FBX, Collada DAE, or Wavefront OBJ file.

CMO is supported as a runtime format for DirectXTK's Model class.

Visual Studio Starter Kit

Visual Studio content pipeline

DirectX Tool Kit

Meshconvert

To aid in debugging, here is a simple console program for dumping out the content of a CMO in a human-readable form.

Collada DAE

Collada DAE is a interchange format for 3D assets that is useful as a source format, but makes a poor choice as a runtime format.

glTF

GL Transmission Format 2.0 is an open source 3D asset format that consist of a JSON text file and binary blob files. It's gaining adoption in game engines due to the fact that it natively uses a Physically Based Rendering (PBR) shader model.

Khronos

GitHub

Microsoft glTF Tool Kit

Art Pipeline for glTF

SDKMesh

The SDKMesh format is a sample runtime format that was created for Direct3D 10 as a replacement for the legacy X File format for use in the DirectX SDK samples.

SDKMESH is supported as a runtime format by DXUT's CDXUTSDKMesh loader class and DirectXTK's Model class.

SDKMESH v2 was introduced for use with the DirectX Tool Kit for DX11 / DX12 to support PBR materials definitions instead of traditional diffuse/specular materials.

DXUT for Direct3D 11

Samples Content Exporter

Meshconvert

To aid in debugging, here is a simple console program for dumping out the content of a SDKMESH/SDKMESH_ANIM file in a human-readable form.

See SDKMESH

VBO

Vertex Buffer Object (VBO) is an extremely simple mesh format originally defined by the Windows 8.0 Resource Loading sample.

VBO is supported as a runtime format for DirectXTK's Model class.

Windows 8 app samples

DirectX Tool Kit

Meshconvert

To aid in debugging, here is a simple console program for dumping out the content of a VBO in a human-readable form.

See VBO

Wavefront OBJ

Alias Wavefront OBJ is a text-based geometry format. It's simple format makes it simple to parse, and is useful as a simple source file format. The parsing costs make it a poor choice for a runtime format.

The Visual Studio content pipeline supports this as a source format for creating CMO files.

Wikipedia article

Example Code

See the Utilities folder in the distribution.

X File

The X file format refers to files with the .x file name extension. X files were introduced with DirectX 2.0. A binary version of this format was subsequently released with DirectX 3.0, which is also described in this documentation. DirectX 6.0 introduced interfaces and methods that enable reading from and writing to .x files. Support was maintained through Direct3D 9, but was deprecated for Direct3D 10 and later.

The XFile APIs are only supported by the legacy DirectX SDK in the D3DX9 DLL.

The binary version of X files were intended as a runtime format, but the text version of X files have become a source file used by various community model libraries, and is supported by various freeware tools.

See Microsoft docs