Skip to content

Library API

Matthew Scott edited this page Nov 21, 2026 · 1 revision

Library API

using UVBake.Core;
using UVBake.IO;

Mesh mesh = MeshIo.Read("model.obj");   // .obj or .fbx
UvMesh result = UVBaker.Generate(mesh, new UVBakeOptions { Resolution = 2048, GutterPixels = 8 });

// Hard gates: overlap = 0, no flipped triangles, full coverage.
if (result.Validation.IsValid)
{
    MeshIo.Write(result.Mesh, "model.uv.obj");   // .obj, .fbx or .gltf
}

UVBaker.Generate also has an overload taking IProgress<string> (per-phase progress) and a CancellationToken. Output is deterministic for fixed options.

Clone this wiki locally