Merge Static Meshes#
Key: merge
The merge static meshes operation replaces multiple meshes that share common properties with a single merged mesh. This reduces scene prim count and can improve overall stage performance.
Spatial clustering can further subdivide merges to keep merged meshes a reasonable size. The supported spatial modes are: None (no spatial grouping), BoundingBox (group meshes within a distance threshold, capping cluster size), VertexCount (cap the vertex count per merged mesh), and CoincidentBoundary (only merge meshes that share a seam).
In CoincidentBoundary mode two meshes are merged only when they share at least boundaryMinSharedVertices boundary vertices that coincide in world space within boundaryTolerance, where a boundary vertex is one lying on a boundary edge (an edge used by exactly one face). Connectivity is transitive, so a chain of abutting meshes collapses into one, while meshes that share no seam are left untouched. This targets bad CAD output where a single part is exported as several abutting pieces, such as a washer split into two half-rings.
Recommended pipelines#
Merge then computeExtents (to author bounds on the new prims); merge then shrinkwrap to turn a
group of parts into one watertight shell.
Starting configurations#
Merge everything by material:
[{"operation": "merge", "considerMaterials": true}]
Spatial merge capped by vertex count:
[{"operation": "merge", "spatialMode": 2, "spatialVertexCount": 50000}]
Merge boundaries#
mergePoint selects the boundary that meshes are grouped under. Only meshes sharing a boundary are
merged with each other, and the result is written under that boundary. Callers driving the operation
from JSON, the CLI or the API pass the integer value.
Value |
UI label |
Merge boundary |
|---|---|---|
0 |
Stage |
The pseudo-root, so the whole stage is a single boundary (default) |
1 |
Parent Xform |
The first parent typed |
2 |
Kind: Assembly |
The first parent of kind |
3 |
Kind: Group |
The first parent of kind |
4 |
Kind: Component |
The first parent of kind |
5 |
Kind: Model |
The first parent of kind |
6 |
Kind: Subcomponent |
The first parent of kind |
7 |
Root Prim |
Each root prim, that is each direct child of the pseudo-root |
8 |
Parent Prim |
The first parent, whatever its type |
9 |
Original Prim |
Each mesh itself, with results written beside the original rather than under it |
Kinds are matched through the kind registry, so a mode also matches any kind derived from the one it
names. The values above are elective boundaries layered on top of the structural boundaries that
always apply: the pseudo-root, prims that are not def, prims composed into an instanceable prim,
prims that reset the xform stack, and prims with a time sampled transform or visibility.
Arguments#
Static Meshes to Merge#
Optional list of prim paths to consider for merging
Name:
meshPrimPathsType:
[string]Default Value:
[]
Keep Materials Separate#
Whether separate mesh prims will be created for each material that can be merged. When off, meshes with differing materials can be merged under a single mesh prim using GeomSubsets for each material.
Name:
considerMaterialsType:
boolDefault Value:
False
Compute Display Colors#
Set display color and opacity to values computed from the bound material
Name:
materialAlbedoAsVertexColorsType:
boolDefault Value:
False
Original Mesh Handling#
What to do with any meshes in the original scene that were split or merged
Name:
originalGeomOptionType:
intDefault Value:
1
- Enum Values:
0: Ignore
1: Delete
2: Deactivate
3: Hide
Merge Boundary#
The boundary of where to merge meshes, for example, only merge meshes within a model
Name:
mergePointType:
intDefault Value:
0
- Enum Values:
0: Stage
7: Root Prim
8: Parent Prim
1: Parent Xform
9: Original Prim
2: Kind: Assembly
3: Kind: Group
4: Kind: Component
5: Kind: Model
6: Kind: Subcomponent
Output Name#
The output name to use for newly created merged meshes
Name:
rootPathType:
strDefault Value:
""
Strict Attribute Mode#
When enabled all additional attributes on prims must match for them to be merged
Name:
considerAllAttributesType:
boolDefault Value:
False
Allow Single Meshes#
When enabled means a single mesh will still be run through the merge process
Name:
allowSingleMeshesType:
boolDefault Value:
False
Spatial Clustering Mode#
Enable spatial clustering of meshes by choosing a clustering method
Name:
spatialModeType:
intDefault Value:
0
- Enum Values:
0: None
1: Bounding Box
2: Vertex Count
3: Coincident Boundary Vertices
Spatial Threshold#
Maximum distance at which to consider meshes neighbors
Name:
spatialThresholdType:
floatDefault Value:
10
Spatial Max Size#
Maximum size that clustered meshes can be grouped in
Name:
spatialMaxSizeType:
floatDefault Value:
0
Spatial Vertex Count#
Maximum number of vertices that to cluster together
Name:
spatialVertexCountType:
intDefault Value:
10000
Boundary Tolerance#
Maximum distance, in world units, at which boundary-edge vertices are considered coincident when merging meshes that share a seam
Name:
boundaryToleranceType:
floatDefault Value:
1e-05Min Value:
0.0