This release introduces a major new feature, voxel remeshing, in addition to normal generation, a number of simplification enhancements and several smaller improvements.
The first meshoptimizer commit was made on September 8, 2016, a little over ten years ago. Consider this a slightly belated 10-year anniversary release. A decade ago, the library started from a small collection of optimization algorithms that I happened to need at the time, and I definitely did not think it would grow into what it is today. It's now used broadly across the industry, in game engines, content pipelines and tools, and its compression formats are part of glTF. Along the way, many old algorithms had to be studied and improved upon and some new ones - invented. I'm very happy with where the library is today, and looking forward to the next ten years. Thank you to everyone who has used meshoptimizer, reported issues, contributed patches, or supported its development!
A new voxel remesher voxelizes the input mesh at a given resolution, with each voxel storing an approximation of the mesh surface; it then generates a new mesh from the grid, disregarding the original mesh topology and exact vertex positions. The result of meshopt_remesh is a closed mesh with a uniform tessellation that can be used directly or as a base for further simplification. Features closer than a voxel may get merged, gaps smaller than a voxel may get closed, and the interior of the mesh will be filled by default. For best appearance, meshopt_RemeshSolve option optimizes vertex placement to align with the features of the original mesh. Unlike traditional distance field based approaches, this remesher preserves thin sheets at any voxel resolution, although wires (thin one-dimensional geometry) may get erased. This remesher is still experimental and may be improved in future releases; in particular, thin features may have self-intersections and require backface culling for correct rendering.
While this remesher can unlock a variety of use-cases, one possible application is generating a low-poly textured proxy that merges all source meshes, materials and textures into one; an online remesher demo that implements a remesh→simplify→unwrap→retexture pipeline (among other options) is provided as an example.
Since remeshing discards all input attributes, the output needs newly generated normals for lighting. A function to create them, meshopt_generateNormals, is now available; it implements automatic smoothing group detection using a crease angle cutoff and supports optional post-processing that smooths the normals across the neighboring triangles. While particularly useful with remeshed meshes, it's a general purpose algorithm that can be used for any mesh, similarly to meshopt_generateTangents.
Several simplification enhancements improve the behavior of existing functions automatically or add new options to control simplification further. Permissive mode (meshopt_SimplifyPermissive) has been improved, with a few bug fixes and a significant improvement of simplification around geometric borders; this was the final improvement that was needed to make permissive mode stable, which it now is - no further breaking changes are expected. To improve simplification behavior on double-sided geometry (which can occur in remeshed meshes), meshopt_SimplifyPreserveFolds option can be enabled to reduce erosion of sharp creases or edges of double-sided sheets. To improve attribute-aware simplification, both in terms of collapse ordering and the error returned by the simplifier for input geometry with significant attribute variance, meshopt_SimplifyErrorClamped option can be enabled; this option changes LOD selection to be less conservative and is recommended for any uses of attribute-aware simplification. Finally, clusterlod.h has seen an introduction of a new option, simplify_dilate_borders, that can noticeably improve simplification of foliage; the other simplification improvements were applied to clusterlod.h as well, with clamped errors enabled by default.
The majority of the work on the core library in this release has been sponsored by Valve; thank you!
Library improvements
- New experimental voxel remesher,
meshopt_remesh, allows generating a new mesh at a given voxel resolution, using an existing mesh as a source but disregarding its topology and exact vertex positions - New experimental function for generating normals,
meshopt_generateNormals, allows generating normals with automatic smoothing group detection using a crease angle cutoff and optional smoothing post-processing - New experimental simplification flag,
meshopt_SimplifyPreserveFolds, reduces erosion of boundaries on double-sided geometry - New experimental simplification flag,
meshopt_SimplifyErrorClamped, adjusts attribute error to prevent excessive reported error in areas of high attribute variance meshopt_SimplifyPermissivemode ofmeshopt_simplify*is now stablemeshopt_opacityMap*functions, as well asmeshopt_generateTangents,meshopt_filterIndexBuffer*andmeshopt_computePositionExponentare now stable- Improve handling of geometric borders and collapse scoring when using permissive simplification
- Reduce the overly conservative worst-case bound returned by
meshopt_encodeVertexBufferBound - Improve performance of
meshopt_decodeIndexBufferby ~15% when using Clang/GCC - Improve performance of
meshopt_buildMeshletsSpatialby ~15% for large meshes - Improve performance of
meshopt_partitionClustersby ~10% - Improve support for
meshopt_generateVertexRemapfor strides that aren't divisible by 4 - Fix a rounding error in
meshopt_encodeFilterExpwhen bits=24
Additional improvements
- Add border dilation to
clusterlod.hto improve foliage simplification viaclodConfig::simplify_dilate_borders - Improve cluster error estimates in
clusterlod.hwhen attributes are used, to make LOD selection less conservative - Significantly reduce the number of allocations in
clusterlod.h - Fix cases where
clusterlod.hwould produce empty clusters during simplification - Implement simplification with position/attribute update in
gltfpackwhen requested via-svargument - Implement normal generation in
gltfpackwhen requested via-gnargument - Improve vertex reindexing in
gltfpackwhen quantization is disabled, resulting in more compact output meshes - Fix UV quantization in
gltfpackon materials that used texture transform extension - Fix mesh deduplication in
gltfpackon meshes with identical geometry but different quantized UV ranges
Note: in preparation for Apple and GitHub deprecating support for macOS/Intel, official macOS binary builds for gltfpack are now AArch64-only. You can still build gltfpack for Intel Macs manually.
