Joins compatible Primitives and reduces draw calls.
Primitives are eligible for joining if they are members of the same
Mesh or, optionally, attached to sibling Nodes
in the scene hierarchy. For best results, apply dedup and
flatten first to maximize the number of Primitives that
can be joined.
NOTE: In a Scene that heavily reuses the same Mesh data, joining may
increase vertex count. Consider alternatives, like
instancing with EXTMeshGPUInstancing.
Joins compatible Primitives and reduces draw calls. Primitives are eligible for joining if they are members of the same Mesh or, optionally, attached to sibling Nodes in the scene hierarchy. For best results, apply dedup and flatten first to maximize the number of Primitives that can be joined.
NOTE: In a Scene that heavily reuses the same Mesh data, joining may increase vertex count. Consider alternatives, like instancing with EXTMeshGPUInstancing.
Example:
import { PropertyType } from '@gltf-transform/core'; import { join, flatten, dedup } from '@gltf-transform/functions'; await document.transform( dedup({ propertyTypes: [PropertyType.MATERIAL] }), flatten(), join({ keepNamed: false }), );