Awesome
xatlas
A cleaned up version of thekla_atlas.
Mesh charting, parameterization and atlas packing. Suitable for generating unique texture coordinates for baking lightmaps.
Changes from thekla_atlas
- Smaller code size - from about 18 KLOC to 8 KLOC
- Easier to integrate and build - a single source/header file pair instead of around 120 files and 10 directories.
- Atlas resolution option for outputting multiple atlases.
- Flexible data description API for input meshes.
- Better tolerance of bad input geometry. Zero length edges and zero area faces are ignored.
How to use
- Create an atlas with
xatlas::Create
. - Add one or more meshes with
xatlas::AddMesh
. Mesh geometry should be manifold. - Call
xatlas::ComputeCharts
. Meshes are segmented into roughly disk-shaped charts. - Call
xatlas::ParameterizeCharts
. Charts are flattened into 2D parameterizations. - Call
xatlas::PackCharts
. Charts are packed into one or more atlases. You can callxatlas::PackCharts
multiple times to tweak options like unit to texel scale and resolution. - The
xatlas::Atlas
instance created in the first step now contains the result: meshes with a new UV channel that cross-reference input meshes. The number of vertices has likely increased compared to the input meshes, as the new UV channel duplicates some vertices that were previously shared between triangles. The number and coherence of indices remain unchanged, some are changed to reference vertices that were duplicated. - Cleanup with
xatlas::Destroy
.
TODO
- Adding meshes: check for overlapping and intersecting geometry
- Charting: simplified/faster code path for dealing with co-planar connected faces
- Parameterization: use a better hole filling argorithm for non-planar holes
- Packing: bilinear-aware rasterization
- Packing: faster brute-force packing
Links
Ignacio Castaño's blog post on thekla_atlas
Ministry of Flat - Commercial automated UV unwrapper.
Lightmapper - Hemicube based lightmap baking. The example model texture coordinates were generated by thekla_atlas.
aobaker - Ambient occlusion baking. Uses thekla_atlas.
Gazebo model by Teh_Bucket
Tunnel scene by LMHPoly