This release contains many improvements to the meshoptimizer library, with a particular focus on simplification algorithms, as well as several new gltfpack features. Highlights:
New simplification function meshopt_simplifyWithUpdate
optimizes vertex positions and attributes for higher-quality LODs, and a new permissive simplification mode enabled via meshopt_SimplifyPermissive
flag allows simplification of faceted meshes with selective preservation of attribute discontinuities. Additionally, meshopt_SimplifyRegularize
flag improves tessellation quality and appearance of deformable meshes, sloppy simplifier (meshopt_simplifySloppy
) implements vertex locking support, and multiple improvements to the main simplification algorithms improve quality at the same triangle count by default.
gltfpack now supports encoding WebP images via -tw
option, which enables further reduction in compressed asset sizes at some memory cost at runtime. Additionally, gltfpack exposes permissive simplification via -sp
option, which can simplify meshes further while preserving appearance much better compared to aggressive simplification.
The majority of the work on the core library in this release has been sponsored by Valve; thank you!
Note: gltfpack development is done in spare time; potential corporate sponsors should feel free to reach out via e-mail.
Library improvements
- New experimental function,
meshopt_simplifyWithUpdate
, enhances attribute-aware simplification by computing optimal positions/attributes for the simplified mesh, allowing to increase quality of lower levels of detail at additional vertex memory cost - New experimental simplification flag,
meshopt_SimplifyPermissive
, allows simplification across attribute discontinuities, with optional support for protecting individual vertices with bit flagmeshopt_SimplifyVertex_Protect
on lock flags specified viavertex_lock
- New experimental simplification flag,
meshopt_SimplifyRegularize
, results in more regular tessellation at some cost to shape preservation, which is particularly valuable for deformable meshes - New experimental function,
meshopt_generatePositionRemap
, creates a table mapping vertices to the canonical vertex with the same position (which can be used to prepare data for various algorithms like simplification and partitioning) - New experimental color filter, exposed via
meshopt_encodeFilterColor
/meshopt_decodeFilterColor
, can be used to further improve compression ratio on quantized RGBA streams meshopt_simplifySloppy
now has an extra argument,vertex_lock
, allowing to lock individual vertices to preserve mesh boundariesmeshopt_analyzeCoverage
,meshopt_computeSphereBounds
,meshopt_encodeVertexBufferLevel
,meshopt_generateVertexRemapCustom
,meshopt_partitionClusters
andmeshopt_spatialClusterPoints
functions are now stablemeshopt_simplifyPrune
function andmeshopt_SimplifyPrune
flag are now stable- Simplification now iteratively removes zero-area triangles that can arise in complex topological cases, reducing the triangle count at no quality impact
- Improve simplification restrictions around certain seam edges which can slightly reduce the overall triangle count
- Improve simplification quality of seam/border edge loops
- Improve simplification of flat (planar) regions resulting in higher quality tessellation
- Improve tracking of component error during simplification which could previously result in insufficient simplification when
meshopt_SimplifyPrune
was enabled - Improve performance of
meshopt_optimizeOverdraw
by ~15% - Rework meshopt_Allocator callback storage to make it compatible with C++20 modules and shared library builds (when
MESHOPTIMIZER_ALLOC_EXPORT
is defined)
gltfpack improvements
- Implement option
-tw
which compresses textures to WebP format, resulting in smaller files at the expense of more memory consumption compared to Basis Universal. - Implement option
-sp
which enables permissive simplification, allowing the simplifier to collapse edges across attribute discontinuities (as a much higher quality alternative to aggressive simplification) - Implement option
-vi
to use interleaved vertices instead of separate streams; this partially disables compression in-cc
mode - Improve simplification quality of deformable (skinned/morphed) meshes
- Target simplification error is now automatically scaled based on mesh size for scenes containing multiple meshes
- Attribute aware simplification is now enabled by default; option
-sv
is no longer necessary but is maintained for compatibility - Fix transparent material optimization when materials are used on meshes with vertex alpha
- Improve cross-platform support for CMake builds (for BSD systems and cross-compilation workflows)
- CMake option for Basis Universal builds has been renamed to
MESHOPT_GLTFPACK_BASISU_PATH
for consistency - Linux release binaries are now built on older Ubuntu versions to improve glibc compatibility
- macOS release binaries are now split between architectures (Intel & Apple Silicon)
JavaScript improvements
- Add support for v1 vertex encoding via
MeshoptEncoder.encodeVertexBufferLevel
- Add
MeshoptClusterizer.computeSphereBounds
andMeshoptSimplifier.simplifyPrune
functions - Add experimental support for color filtering via
MeshoptDecoder.decodeVertexBuffer
andMeshoptEncoder.encodeColor
MeshoptSimplifier
now supports experimentalsimplifySloppy
,simplifyWithUpdate
functions and experimental"Regularize" / "Permissive"
flags forsimplify*
- Fix invalid assertions when calling
simplifyWithAttributes
with no attributes
Thanks to @jopadan and @toge for contributions to this release!