Simplification algorithm, based on meshoptimizer, producing meshes with fewer triangles and vertices. Simplification is lossy, but the algorithm aims to preserve visual quality as much as possible for given parameters.
The algorithm aims to reach the target 'ratio', while minimizing error. If error exceeds the specified 'error' threshold, the algorithm will quit before reaching the target ratio. Examples:
Topology, particularly split vertices, will also limit the simplifier. For best results, apply a weld operation before simplification.
Example:
import { simplify, weld } from '@gltf-transform/functions';
import { MeshoptSimplifier } from 'meshoptimizer';
await document.transform(
weld({ tolerance: 0.0001 }),
simplify({ simplifier: MeshoptSimplifier, ratio: 0.75, error: 0.001 })
);
References:
Made by Don McCurdy • Documented with greendoc • © 2023 MIT License
simplify