SuperWangKai / xatlas

Mesh parameterization library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

xatlas

Travis CI Build Status License: MIT

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.
  • Can output 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

  1. Create an atlas with xatlas::Create.
  2. Add one or more meshes with xatlas::AddMesh. Mesh geometry should be manifold.
  3. Call xatlas::ComputeCharts. Meshes are segmented into roughly disk-shaped charts.
  4. Call xatlas::ParameterizeCharts. Charts are flattened into 2D parameterizations.
  5. Call xatlas::PackCharts. Charts are packed into one or more atlases. You can call xatlas::PackCharts multiple times to tweak options like unit to texel scale and resolution.
  6. 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.
  7. Cleanup with xatlas::Destroy.

TODO

  • Check for overlapping and intersecting geometry
  • Use a better hole filling argorithm for non-planar holes
  • glTF support in the viewer

Links

Ignacio Castaño's blog post on thekla_atlas

Microsoft's UVAtlas

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

About

Mesh parameterization library

License:Other


Languages

Language:C++ 66.4%Language:C 30.5%Language:Lua 2.0%Language:Scala 0.8%Language:SuperCollider 0.4%Language:Batchfile 0.0%