Skip to content

Getting Started

Chuck Walbourn edited this page May 28, 2025 · 3 revisions

The DirectXMesh library provides functions for mesh-processing operations to prepare geometry for rendering by Direct3D. The project includes a C++ library, some optional Utility C++ files, and a program built using the library.

flowchart TD
    A(DirectXMesh C++ Library)
    A-->C
    B(<b>Utilities</b><br />WaveFrontReader)
    B-->C
    C[meshconvert]
Loading

The DirectXMesh library itself consists of a few functional areas:

graph LR

subgraph IB/VB cache optimization
    I[Attribute Sort]
    F[OptimizeFaces]
    L[OptimizeFacesLRU]
    V[OptimizeVertices]
end

subgraph Vertex Buffers
   R[Reader]
   W[Writer]
end

subgraph Input Layouts
    1[D3D11]
    2[D3D12]
end

subgraph Geometry operations
    A[Adjacency]
    C[Clean and validate]
    N[Normals, tangents,<br />and bi-tangents]
    D[Vertex weld]
    T[Concat]
    E[Helper functions]
end
Loading

Command-line Tool

The program meshconvert is a command-line tool for reading geometry data from a Wavefront obj format file, doing various mesh operations, and then writing out a 'runtime' mesh format such as CMO, SDKMESH, or VBO. For example, this reads data from a WaveFront obj file cup.obj, generates normals, and then writes out the result to a VBO.

meshconvert cup.obj -n -ft vbo
  • SDKMESH was created for the legacy DirectX SDK as a replacement for ".X" files used in older samples. The original format was updated with a variant that supports PBR materials. The DirectX Tool Kit supports loading these files. For technical details on the format, see SDKMESH.h.

  • CMO or Compiled Mesh Object was introduced with Visual Studio 2012 in their Mesh Content Pipeline. Note that the mesh pipeline was removed in VS 2022 17.9.3 or later due to security concerns. The DirectX Tool Kit supports loading these files. For technical details on the format, see CMO.h.

  • VBO or Vertex Buffer Object was introduced with Windows 8 era DirectX Samples. It's trivial format containing two counts, a Vertex Buffer in a fixed vertex format, and a 16-bit Index Buffer. The DirectX Tool Kit supports loading these files. For technical details on the format, see VBO.h.

While there are numerous widely-known formats for 3D model data, there is no single format that is considered 'standard' for runtime mesh content. As such, the DirectXMesh library itself does not have any code for saving mesh data to disk. Instead, the meshconvert command-line tool includes code for writing three common formats used in Microsoft samples.

"Hello, World"

TODO

Further reading

DirectXMesh provides details on how to build and link the library

See meshconvert for more details on the command-line tool.

For Use

  • Universal Windows Platform apps
  • Windows desktop apps
  • Windows 11
  • Windows 10
  • Windows 8.1
  • Xbox One
  • Xbox Series X|S
  • Windows Subsystem for Linux

Architecture

  • x86
  • x64
  • ARM64

For Development

  • Visual Studio 2022
  • Visual Studio 2019 (16.11)
  • clang/LLVM v12 - v19
  • GCC 10.5, 11.4, 12.3, 13.3, 14.2
  • MinGW 12.2, 13.2
  • CMake 3.20

Related Projects

DirectX Tool Kit for DirectX 11

DirectX Tool Kit for DirectX 12

DirectXTex

DirectXMath

Tools

Test Suite

Content Exporter

DxCapsViewer

See also

DirectX Landing Page

Clone this wiki locally