Lagrange
Loading...
Searching...
No Matches
Options.h
1/*
2 * Copyright 2026 Adobe. All rights reserved.
3 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License. You may obtain a copy
5 * of the License at http://www.apache.org/licenses/LICENSE-2.0
6 *
7 * Unless required by applicable law or agreed to in writing, software distributed under
8 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9 * OF ANY KIND, either express or implied. See the License for the specific language
10 * governing permissions and limitations under the License.
11 */
12#pragma once
13
14#include <cstdint>
15#include <string_view>
16#include <vector>
17
18namespace lagrange::xatlas {
19
28{
30 float max_chart_area = 0.f;
31
34
38
40 float roundness_weight = 0.01f;
41
44
47 float normal_seam_weight = 4.f;
48
50 float texture_seam_weight = 0.5f;
51
53 float max_cost = 2.f;
54
57 uint32_t max_iterations = 1;
58
61 bool use_input_mesh_uvs = false;
62
64 bool fix_winding = true;
65};
66
71{
74 uint32_t max_chart_size = 0;
75
77 uint32_t padding = 0;
78
82 float texels_per_unit = 0.f;
83
86 uint32_t resolution = 0;
87
90 bool bilinear = true;
91
93 bool block_align = false;
94
96 bool brute_force = false;
97
100
102 bool rotate_charts = true;
103};
104
111enum class MultiAtlasPolicy {
114 NormalizePerTile,
115
118 Udim,
119
121 ErrorIfMultiple,
122};
123
128{
131
134
140 std::string_view input_uv_attribute_name;
141
145
147 MultiAtlasPolicy multi_atlas_policy = MultiAtlasPolicy::NormalizePerTile;
148
151 std::string_view output_uv_attribute_name = "@uv";
152
154 std::string_view output_atlas_attribute_name = "";
155
157 std::string_view output_chart_attribute_name = "";
158
162};
163
168{
171
173 std::string_view input_uv_attribute_name;
174
178
180 MultiAtlasPolicy multi_atlas_policy = MultiAtlasPolicy::NormalizePerTile;
181
184 std::string_view output_uv_attribute_name = "@uv";
185
187 std::string_view output_atlas_attribute_name = "";
188
190 std::string_view output_chart_attribute_name = "";
191
195};
196
201{
204 std::vector<float> per_instance_importance;
205};
206
207} // namespace lagrange::xatlas
Chart computation options.
Definition Options.h:28
float normal_seam_weight
Weight applied to crossing input normal seams.
Definition Options.h:47
uint32_t max_iterations
Maximum number of segmentation iterations.
Definition Options.h:57
float max_chart_area
Maximum chart area, in input units squared. Set to 0 (default) to disable the limit.
Definition Options.h:30
bool use_input_mesh_uvs
If true, treat the input UV attribute as the chart layout (faces with the same UV island belong to th...
Definition Options.h:61
float texture_seam_weight
Weight applied to crossing input UV seams (when use_input_mesh_uvs is true).
Definition Options.h:50
float max_cost
Maximum allowed chart cost. Faces whose addition would exceed this cost are not merged.
Definition Options.h:53
float straightness_weight
Weight applied to chart boundary straightness. Higher values prefer straight cuts.
Definition Options.h:43
bool fix_winding
If true, fix triangle winding so all charts have a consistent orientation.
Definition Options.h:64
float normal_deviation_weight
Weight applied to normal deviation when growing charts.
Definition Options.h:37
float roundness_weight
Weight applied to chart roundness. Higher values prefer compact (disk-like) charts.
Definition Options.h:40
float max_boundary_length
Maximum chart boundary length, in input units. Set to 0 (default) to disable the limit.
Definition Options.h:33
Packing options.
Definition Options.h:71
float texels_per_unit
Texel-to-world-unit ratio.
Definition Options.h:82
bool block_align
If true, align charts to 4-pixel blocks (useful for compressed texture formats like BCn).
Definition Options.h:93
bool rotate_charts
If true, allow xatlas to rotate charts during packing (in addition to axis alignment).
Definition Options.h:102
uint32_t max_chart_size
Maximum chart size, in pixels.
Definition Options.h:74
uint32_t padding
Empty pixels of padding to leave around each chart. Useful for mip-map filtering.
Definition Options.h:77
bool bilinear
If true, leave a 1-pixel safety margin so bilinear filtering doesn't sample neighbouring charts.
Definition Options.h:90
bool rotate_charts_to_axis
If true, rotate each chart so that its longest principal axis aligns with the U or V axis.
Definition Options.h:99
bool brute_force
If true, use brute-force search to find optimal chart placement (significantly slower).
Definition Options.h:96
uint32_t resolution
Atlas tile resolution, in pixels (square).
Definition Options.h:86
Options controlling a repack (existing UVs → new packing, no chart computation).
Definition Options.h:168
std::string_view output_uv_attribute_name
Output indexed UV attribute name.
Definition Options.h:184
std::string_view output_atlas_attribute_name
Output corner attribute name for the per-corner xatlas atlas tile id (only written when attribute nam...
Definition Options.h:187
std::string_view input_chart_attribute_name
Optional per-facet chart id attribute name.
Definition Options.h:177
MultiAtlasPolicy multi_atlas_policy
Multi-atlas encoding policy for the output UV attribute.
Definition Options.h:180
bool enable_sharing_uvs_between_instances
Whether to share generated UVs between instances of the same scene mesh.
Definition Options.h:194
PackOptions packing
Packing options.
Definition Options.h:170
std::string_view input_uv_attribute_name
Input indexed UV attribute name. Must be an indexed float or double UV attribute.
Definition Options.h:173
std::string_view output_chart_attribute_name
Output corner attribute name for the per-corner xatlas chart id (only written when attribute name is ...
Definition Options.h:190
Scene-specific options for unwrap_scene / repack_scene.
Definition Options.h:201
std::vector< float > per_instance_importance
Optional per-instance importance weights.
Definition Options.h:204
Options controlling a full unwrap (segment + parameterize + pack).
Definition Options.h:128
std::string_view output_uv_attribute_name
Output indexed UV attribute name.
Definition Options.h:151
std::string_view output_atlas_attribute_name
Output corner attribute name for the per-corner xatlas atlas tile id (only written when attribute nam...
Definition Options.h:154
MultiAtlasPolicy multi_atlas_policy
Multi-atlas encoding policy for the output UV attribute.
Definition Options.h:147
bool enable_sharing_uvs_between_instances
Whether to share generated UVs between instances of the same scene mesh.
Definition Options.h:161
std::string_view input_normal_attribute_name
Optional input per-vertex normal attribute name.
Definition Options.h:144
PackOptions packing
Packing options.
Definition Options.h:133
ChartOptions chart
Chart computation options.
Definition Options.h:130
std::string_view input_uv_attribute_name
Optional input UV attribute name.
Definition Options.h:140
std::string_view output_chart_attribute_name
Output corner attribute name for the per-corner xatlas chart id (only written when attribute name is ...
Definition Options.h:157