Skip to content
This repository was archived by the owner on Mar 30, 2026. It is now read-only.

UVAtlasComputeIMTFromTexture

Chuck Walbourn edited this page Aug 16, 2025 · 5 revisions
UVAtlas

Calculates per-triangle IMT's from a texture mapped onto a mesh, to be used as input to UVAtlasCreate or UVAtlasPartition.

HRESULT UVAtlasComputeIMTFromTexture(
    const XMFLOAT3* positions, const XMFLOAT2* texcoords, size_t nVerts,
    const void* indices, DXGI_FORMAT indexFormat, size_t nFaces,
    const float* pTexture, size_t width, size_t height,
    DWORD options,
    std::function<HRESULT(float percentComplete)> statusCallBack,
    float* pIMTArray);

Parameters

pTexture: A float array of width * height * 4 in size. This data should be in DXGI_FORMAT_R32G32B32A32_FLOAT format. You can use DirectXTex functions to convert arbitrary format textures to this form.

options: A combination of UVATLAS_IMT flags

  • UVATLAS_IMT_DEFAULT - The default is no wrapping in either U or V.
  • UVATLAS_IMT_WRAP_U - Wrap in the U dimension
  • UVATLAS_IMT_WRAP_V - Wrap in the V dimension
  • UVATLAS_IMT_WRAP_UV - Wrap in both the U and V dimensions. pIMTArray: The resulting IMT data which is passed to UVAtlasCreate or UVAtlasPack which is an array of 3 float values per face.

Returns

This functions will succeed with an S_OK or will return an HRESULT error code (E_INVALIDARG, E_OUTOFMEMORY, E_FAIL, E_POINTER, E_UNEXPECTED, HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW), or HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED)).

If statusCallBack returns false, this function will return E_ABORT.

Exceptions

This function does not throw C++ exceptions, but is not marked noexcept because statusCallBack could generate one.

Remarks

Given a texture that maps over the surface of the mesh, the algorithm computes the IMT for each face. This will cause triangles containing lower-frequency signal data to take up less space in the final texture atlas when parameterized with the UVAtlas functions. The texture is assumed to be interpolated over the mesh bi-linearly.

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 - v20
  • GCC 10.5, 11.4, 12.3, 13.3, 14.2
  • MinGW 12.2, 13.2
  • CMake 3.21

Related Projects

A python wrapper of UVAtlasTool

DirectXMesh

DirectXTex

DirectXMath

Tools

Test Suite

Content Exporter

DxCapsViewer

Clone this wiki locally