-
Notifications
You must be signed in to change notification settings - Fork 150
UVAtlasTool
This UVAtlas sample is an implementation of the uvatlas command-line sample from the legacy DirectX SDK using UVAtlas, DirectXTex, and DirectXMesh rather than the deprecated D3DX library. This tool imports geometry and generates an isochart mesh.
The original tool imported from legacy X files. This version imports from WaveFront Object (OBJ) or VBO files.
UVAtlas.exe
uses the following command syntax:
uvatlas [-r]
[-q <level>] [-n <number>] [-st <float>] [-g <float>]
[-w <number>] [-h <number>]
[-ta | -ga] [-nn | -na | -ne] [-tt | -tb] [-cw] [-c] [-t] [-it <filename>]
[-iv <channel>] [-sdkmesh | -cmo | -vbo | -wf] [-nodds]
[-flip] [-flipu] [-flipv] [-flipz]
[-o <filename] [-l] [-y]
[-ib32] [-fn <format>] [-fuv <format>] [-fc <format>]
[-nologo] [-flist <filename>]
<file-name(s)>
The optional command-line switches are described in the following table.
-r: Input file names can contain wildcard characters (?
or *
). If this switch is used, subdirectories are also searched.
The legacy DirectX SDK sample used
-s
. We use-r
to be more consistent with other command-line tools.
-q level: sets quality level to DEFAULT, FAST or QUALITY. With DEFAULT, the tool uses QUALITY for meshes below a threshold, and FAST otherwise.
-n number: sets the maximum number of charts to generate. The default of 0 uses max-stretch as the limit. Note this is a soft limit.
-st float: sets the maximum amount of stretch 0.0..1.0, defaulting to 0.16667
-g float: is the the gutter width between charts in texels, which defaults to 2.0
-w, -h: number texture width/height for the atlas, defaults to 512x512.
-ta: when generating adjacency use topological adjacency (the default)
-ga: when generating adjacency use geometric adjacency (uses epsilon of 1e-5f)
-nn: generate normals weighted by angle
-na: generate normals weighted by area
-ne: generate normals weighted equally
-tt: generate tangents.
-tb: generate tangents and bi-tangents (aka bi-normals).
-cw: faces are clockwise (defaults to counter-clockwise) for generating normal
-c: generate mesh with colors showing charts (replaces the materials set and attributes in the output).
-t: generates a separate mesh with uvs as position information to allow visualization of the isochart. Output name has _texture
appended.
-it filename: calculates IMT for the mesh using this texture file using dds
, tga
, hdr
, or a WIC-supported format (bmp
, jpg
, png
, jxr
, etc.).
-iv channel: calculates IMT using per-vertex data where channel is NORMAL, COLOR, or TEXCOORD
-sdkmesh: output an SDKMESH
file (the default)
-sdkmesh2: output an SDKMESH
file with PBR materials
-cmo: output a Visual Studio CMO
file (requires normals, tangents and texture coordinates)
-vbo: output a VBO
file (requires normals and texture coordinates)
-wf: output a WaveFront Object OBJ
file
-nodds: prevents extension renaming in exported materials. By default, texture filenames are converted from an existing image extension to .dds assuming they are going to be processed by 'texconv'. This flag prevents the renaming and leaves the original extension.
-flip: reverses the winding of faces
-flipu: inverts the u texture coordinate
-flipv: inverts the v texture coordinate (Direct3D vs. OpenGL image orientation)
-flipz: negates the z component (RH vs. LH view systems)
-o filename: specifies output filename which is otherwise generated from the input file name. Use of this switch supports only one input file.
-l: Forces the output path & filename to all lower-case. Windows file system is case-insensitive by default, but some programs like git are case-sensitive.
-y: overwrite existing output file if any. By default, the tool will abort if the output file already exists.
-ib32: Forces the use of 32-bit indices for SDKMESH
output. By default it will attempt to write 16-bit indices if possible. This switch is not supported by CMO
or VBO
.
-fn format: Sets the format for writing vertex normals/tangents/bi-normals for SDKMESH
output: float3
(the default), float16_4
, or r11g11b10
(x2 biased). This switch is not supported by CMO
or VBO
.
-fuv format: Sets the format for writing vertex texture coordinates for SDKMESH
output: float2
(the default) or float16_2
. This switch is not supported by CMO
or VBO
.
-fc format: Sets the format for writing vertex color for SDKMESH
output: bgra
(the default), rgba
, float4
, float16_4
, rgba_10
or r11g11b10
. This switch is not supported by CMO
or VBO
.
-nologo: suppress copyright message.
-flist filename: Uses the provided filename as a text file containing a list of input files (one per line). Ignores lines that begin with #
(used for comments). Does not support providing additional command-line arguments or the use of filename wildcards.
uvatlas cup.obj -t -c
This loads the geometry in a Wavefront OBJ file 'cup.obj', generates normals (using weight by angle), generates an isochart, and then writes the result to cup.sdkmesh
as well as a visualization to cup_texture.sdkmesh
both using a material set that colors each face by which chart it belongs to in the atlas.
Support for OpenEXR (EXR
) can be added to the uvatlas utility for the -it
switch. Uncomment #define USE_OPENEXR
in the source, and add the DirectXTex auxiliary module to the project. See Adding OpenEXR for more details including building the OpenEXR library.
All content and source code for this package are subject to the terms of the MIT License.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
- Universal Windows Platform apps
- Windows desktop apps
- Windows 11
- Windows 10
- Windows 8.1
- Xbox One
- Xbox Series X|S
- Windows Subsystem for Linux
- x86
- x64
- ARM64
- Visual Studio 2022
- Visual Studio 2019 (16.11)
- clang/LLVM v12 - v18
- GCC 10.5, 11.4, 12.3
- MinGW 12.2, 13.2
- CMake 3.20