Skip to content

Releases: zeux/meshoptimizer

v0.22

25 Oct 17:26
4affad0
Compare
Choose a tag to compare

This release contains many improvements to the meshoptimizer library and some gltfpack enhancements!

Notably, meshopt_simplifyWithAttributes has seen significant improvements to attribute handling, meshopt_simplify* algorithms now produce results with fewer triangles and better quality on meshes with complex topology, meshopt_buildMeshlets produces slightly more optimal clusterization, and gltfpack will often produce smaller outputs due to geometry deduplication and improved quantization.

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

  • A new algorithm, meshopt_generateProvokingIndexBuffer, generates an index buffer that can be used to efficiently render visibility buffers by using nointerpolate attributes
  • meshopt_simplifyWithAttributes now uses an improved attribute metric that mixes better with positional error and results in more intuitive weighting
  • meshopt_simplifyWithAttributes now properly tracks attribute errors across attribute discontinuities
  • meshopt_simplifyWithAttributes no longer spends time or memory on attributes with weight 0, and allows up to 32 scalar attributes
  • meshopt_simplifyWithAttributes now has better support for vertex_lock if the input lock flags are inconsistent on discontinuities
  • meshopt_simplify* can now collapse some edges that were previously restricted which improves quality and reduces minimum reachable triangle count
  • meshopt_simplify* now support component pruning via a new experimental meshopt_SimplifyPrune option which disregards interior topology and removes components entirely
  • meshopt_simplify* are now ~5-10% faster on large meshes due to better memory access patterns and improved scheduling
  • meshopt_simplify* use more accurate computations to improve quality and convergence
  • meshopt_simplifyPoints uses an improved color metric that results in more intuitive weighting
  • meshopt_buildMeshlets uses improved heuristics to produce up to ~1% fewer meshlets on large meshes with fewer disconnected meshlets
  • meshopt_decodeFilter* and meshopt_encodeFilter* family of functions are now stable
  • meshopt_encodeFilterExp supports an extra experimental mode, meshopt_EncodeExpClamped, which can be used on texture coordinates for a better balance between quality and size

gltfpack improvements

  • Mesh geometry is now deduplicated based on its contents, which can significantly reduce the size of the output in some cases and improve instancing efficiency
  • When quantization is enabled, normals/tangents are quantized before reindexing which can significantly improve the output size/efficiency without affecting quality
  • Optionally keep unused vertex attributes if -kv is specified; together with -vtf this can be used to preserve UV mapping on assets without materials/textures
  • Simplification error can now be specified via a new -se command line option
  • Fix handling of files with Unicode paths on Windows (starting from Windows 10)
  • Fix incorrect mesh merging across scene boundaries for multi-scene assets
  • Fix rare cases where output JSON would be invalid due to Inf/NaN values

JS improvements

  • A new module, MeshoptClusterizer, exposes meshlet clustering and bounds computation functionality (by @JolifantoBambla)
  • simplifyWithAttributes now correctly supports vertex_lock argument and expects it to be Uint8Array (instead of JS array) when specified

Thanks to @JolifantoBambla and @Ono-Sendai for contributions to this release!

v0.21

25 Jun 19:13
Compare
Choose a tag to compare

This release contains improvements to the meshoptimizer library and many gltfpack enhancements! Notably, the introduction of sparse and absolute error simplification options in meshopt_simplify as well as per-vertex locking in meshopt_simplifyWithAttributes improves Nanite-style processing pipelines, meshlet optimization increases rasterization performance further on NVidia hardware, and gltfpack now preserves most data compression / optimization extensions which makes it easier to compose with other glTF processing tools.

Library improvements

  • Introduce experimental meshopt_optimizeMeshlet algorithm that should be used to optimize individual meshlets for rendering efficiency (mostly affects NVidia hardware but can be used for other vendors as well)
  • meshopt_simplifyWithAttributes now takes an additional optional array, vertex_lock, which allows specifying 1 for individual vertices that should not be moved during simplification (note that this is an interface change and will require source changes; the API continues to be experimental and may see further changes in future releases)
  • meshopt_simplify options now support a new flag, meshopt_SimplifySparse, which significantly increases simplification performance when simplifying small subsets of a larger mesh (note that the error in this mode is relative to the subset, as such use of meshopt_SimplifyErrorAbsolute is recommended for consistency)
  • meshopt_simplify options now support a new flag, meshopt_SimplifyErrorAbsolute, which treats target error and the result error as absolute (in mesh coordinate space) instead of relative to mesh extents
  • Simplifier now tries harder to prevent triangle flips at a minimal cost to simplification performance and efficiency
  • meshopt_optimizeVertexCache now needs ~5% less memory and is ~7% faster on Windows
  • MESHOPT_SOVERSION CMake option can be used to customize .so version for shared library builds

gltfpack improvements

  • Implement support for KHR_texture_basisu and EXT_texture_webp extensions in the input files; the extensions and images will be preserved as is regardless of compression flags
  • Implement support for EXT_mesh_gpu_instancing extension in the input files; instanced meshes will be preserved regardless of -mi flag
  • Implement support for EXT_meshopt_compression extension in the input files; files using this extension will be automatically decompressed (and recompressed if -c/-cc is specified)
  • Implement support for KHR_materials_dispersion extension
  • Implement attribute aware simplification: when -sv flag is specified, vertex colors and normals are used during simplification to improve appearance
  • Image names are now preserved when present in the input file
  • Improve texture compression when using UASTC format: textures are now a little smaller by default, and using low quality levels via -tq allows to push compressed size further down at the expense of some quality loss
  • Improve behavior of simplification with extremely low factors (eg -si 0)
  • Improve behavior of quantization when the input file is already quantized
  • Improve behavior for textures that are missing on disk when the output file is a GLB
  • Automatically fix incorrect MIME type for PNG/JPEG input textures
  • Normal attributes are removed for meshes that use unlit materials to reduce size
  • Normals can be optionally stored without quantization by using -vnf flag (only needed for rare edge cases involving morph targets, prefer -vn to increase normal quality)

Thanks to @ruby0x1, @sciecode and @oisyn for contributions to this release!

v0.20

02 Nov 19:53
Compare
Choose a tag to compare

This release contains new algorithms and improvements to the meshoptimizer library, many gltfpack enhancements and JS library updates! Importantly, an experimental meshopt_simplifyWithAttributes algorithm can take attribute information into account for better appearance, and gltfpack now copies texture files to the output folder when the output format is .gltf (which can be disabled via -tr option).

Note that attribute-aware simplification is still in development, and there are some known issues with attribute weighting, discontinuities and geometry preservation, so the interface and behavior is subject to change in future releases. Issue #158 can be tracked for development progress.

Library improvements

  • The default index encoding version for meshopt_encodeIndexBuffer and meshopt_encodeIndexSequence has been updated to 1. Version 1 has been supported since meshoptimizer 0.14 and is the version that is part of glTF EXT_meshopt_compression extension; if legacy version 0 is needed, this can be overridden via meshopt_encodeIndexVersion.
  • Introduce experimental meshopt_simplifyWithAttributes algorithm that takes attribute error into account when running simplification at some cost to geometric error and simplification memory and performance
  • Implement meshopt_dequantizeHalf which can reverse the quantization done by meshopt_quantizeHalf for cases when the data is needed on the CPU
  • meshopt_simplify now requires ~25% less memory for large meshes
  • meshopt_optimizeVertexCache is now ~15% faster for large meshes
  • meshopt_simplifyPoints now consumes less memory and supports per-point colors during simplification; the algorithm is still experimental but will likely be stabilized in a future release. The interface has changed to accommodate optional color attribute input.
  • meshopt_simplify now prevents triangle flipping better in planar regions (although some issues remain, tracked in #346)
  • meshopt_remapVertexBuffer is now up to 4x faster for deinterleaved streams with small stride
  • meshopt_spatialSortRemap is no longer experimental (which means it has a stable API like most other functions)
  • Fixed vertexfilter.cpp compilation with Emscripten when using Wasm SIMD and SIMD emulation flags

gltfpack improvements

  • By default, when targeting .gltf files, gltfpack now copies texture files to the output folder. This can be changed by using the new -tr option (which also allows to keep texture file references when targeting .glb files).
  • Implement support for KHR_materials_anisotropy extension
  • Improve processing performance for large geometry-heavy glTF files
  • Preserve custom integer ID attributes (_ID, _BATCHID and _FEATURE_ID_n)
  • Fix mesh instancing (-mi) transform handling for scenes with non-uniform scale & rotation
  • Improve mesh instancing (-mi) efficiency on some CAD exports by relaxing mesh merging rules
  • Improve animation error analysis for translation tracks when nodes have a large scale
  • Identical texture glTF objects are now merged together, which results in significant size/performance improvements on some exports
  • Improve point cloud optimization and simplification using the library enhancements
  • Implement optional support for floating-point texture coordinate quantization via -vtf; this is occasionally useful on scenes with very large texture tiling factors
  • Improve support for .obj file parsing: vertex colors are now preserved and more data from .mtl materials is preserved

JavaScript improvements

  • Introduce reorderPoints function to MeshoptEncoder; this function is recommended for use with point clouds to reduce data size and improve render locality
  • Improve support for JavaScript minifiers when using MeshoptDecoder and WebWorkers
  • Improve MeshoptDecoder useWorkers behavior: calling the function twice no longer leaks workers, and useWorkers(0) can be used to reclaim WebAssembly instance memory
  • Introduce experimental simplifyPoints and simplifyWithAttributes functions to MeshoptSimplifier; these functions may change interface/implementation significantly in future releases and require setting useExperimentalFeatures to true.

Thanks to @LorenRoosendaal, @1d10t and @Light7734 for contributions to this release!

v0.19

29 Apr 18:36
fbe26ff
Compare
Choose a tag to compare

This release contains several meshoptimizer and gltfpack fixes/improvements as well as tweaks for the JavaScript library. Notably, -vpf mode in gltfpack can simplify integration into applications that are very sensitive to the scene graph structure as it allows to preserve it better than the default quantization mode does without resorting to disabling quantization entirely.

Library improvements

  • Improve meshopt_decodeVertexBuffer performance by 5-10% for Intel/AMD and 15-25% for ARM
  • Improve scoring heuristic for meshopt_buildMeshlets which results in ~2% fewer meshlets with ~5% smaller radius on average
  • Improve meshopt_encodeFilterExp performance by ~3x and make the encoder more flexible with the new mode parameter
  • Fix compilation issues with Android NDK 19c and some Emscripten build configurations

gltfpack improvements

  • Add floating-point position quantization (-vpf) which removes the need for dequantization transforms at some cost to geometry size
  • Add support for border locking during simplification via -slb which can fix gaps between different meshes
  • When using -vpf or -noq, meshes will usually be attached directly to their source nodes without new intermediate nodes
  • Skin names are now preserved when present in the input file
  • Fix material optimization when both a metallic-roughness model and a specular-glossiness model was used with inconsistent transparency

JavaScript improvements

  • Add exports and update type definitions for MeshoptSimplifier
  • Reduce memory consumption of MeshoptSimplifier by 3-4x
  • Add WebWorker support to MeshoptDecoder (via MeshoptDecoder.useWorkers)

Thanks to @donmccurdy, @LilyWangLL, @daemyung, @DavidKorczynski, @rafern, @Kuranes and @mosra for contributions to this release!

v0.18

01 Aug 02:57
e62c41e
Compare
Choose a tag to compare

This release contains several gltfpack fixes/improvements as well as small improvements to the simplifier, and support for simplifier in the JavaScript library.

Importantly, gltfpack now uses basis_universal as a library to implement ETC1S and UASTC texture compression. This means that external executables like basisu/toktx are no longer necessary, and compression of complex scenes is much faster due to support for parallel compression using optimized job pool to maximize resource allocation, but it also means that node.js version of gltfpack can no longer compress textures - native gltfpack binary should be used instead.

Library improvements

  • Add options bitmask to meshopt_simplify that can be used to specify meshopt_SimplifyLockBorder option; this option is useful when multiple chunks of a single mesh are simplified independently, as it makes sure the simplified versions will connect without gaps
  • Fix vertex classification around degenerate triangles which improves simplification quality in rare cases
  • Added MESHOPTIMIZER_ALLOC_CALLCONV build setting (fixes #403)
  • JavaScript version of meshoptimizer library now supports mesh simplification via mesh_simplifier module

gltfpack improvements

  • Add support for KHR_materials_emissive_strength
  • Add support for KHR_materials_iridescence
  • Switch to parallel texture compressor using internal Basis encoder, and stop supporting texture compression via external executables
  • Add command line option -tj that can override the degree of parallelism used during texture compression
  • Add command line option -tl that can limit the texture width/height during texture compression
  • Support texture masks in -tc option which allows to only compress some textures as ETC1S
  • Implement support for normalized attributes during quantization; texture coordinates now use normalized integers, and positions can use normalized integers with -vpn command line option
  • Preserve interpolation type for STEP animation tracks
  • Sort bone influences by weight, not by index, which allows renderers to drop last few bone influences in shader LODs
  • Optimize .obj parsing to reduce memory consumption, yielding 2-3x reduction in total memory consumption for some large .obj files

v0.17

21 Nov 19:44
Compare
Choose a tag to compare

This release contains several gltfpack fixes/improvements as well as small tweaks to the core library, and a new JavaScript package, meshoptimizer.

Library improvements

  • Implement meshopt_encodeFilter* functions that encode floating point data in a format that can be decoded using decode filters; this can be used together with vertex codec and is mostly designed to support EXT_meshopt_compression glTF extension.
  • Improve simplification performance when applied to large meshes with integer coordinates.

gltfpack improvements

  • Preserve texture samplers along with wrap and filter settings
  • Implement support for texture flipping (via -tfy) when using texture compression
  • Implement support for specifying texture compression settings separately for color/normal/attribute maps (e.g. -tu normal now enables UASTC only for normal maps)
  • Update texture compression command line parameters for UASTC to match latest toktx/basisu
  • Optimize materials by removing BLEND mode when it's provably unnecessary to correct for exporters that use BLEND unconditionally
  • Fix default intensity for lights specified via KHR_lights_punctual extension
  • Several fixes to animation compression heuristics fixing scenes that previously resulted in missing animation data
  • Fix mesh merging when some meshes have negative scale
  • Fix quantization processing when KHR_materials_volume extension is used
  • Fix processing for glTF files that are 2 GB or larger
  • Fix decimal separator in glTF output when running on Linux with a non-English locale

meshoptimizer.js

To facilitate integration of meshoptimizer compression into web applications, several algorithms that the library provides, specifically mesh reordering, vertex/index compression as well as attribute filters, are now provided as a standalone JS package available through NPM, meshoptimizer.

The package provides meshopt_decoder module that can be used to decompress meshes, and meshopt_encoder module that can be used to optimize and compress meshes. Both modules are particularly important for applications that work with EXT_meshopt_compression glTF extension.

Note that these JS modules are low-level and are intended to be used in content pipeline tools (like glTF-Transform) or renderers (like three.js or Babylon.js); it's comparatively rare that these would be useful to integrate directly into a web application as opposed to a high-level library dependency.

v0.16

08 Apr 04:10
Compare
Choose a tag to compare

This release features many library changes including a few new algorithms and substantial improvements in existing algorithms, notably making mesh simplification and clusterization better, as well as gltfpack fixes and improvements.

Library improvements

  • meshopt_simplify now has an extra output parameter, result_error, which will contain the relative simplification error (which can be converted to absolute with meshopt_simplifyScale)
  • meshopt_simplifySloppy interface has changed to align with meshopt_simplify: the function now expects a larger output index buffer size and accepts an input error that restricts simpification as well as an output error.
  • meshopt_simplify now tries to avoid simplifications that result in triangle flips; this substantially improves triangulation quality at a moderate performance cost.
  • meshopt_buildMeshlets interface has changed to allow for almost arbitrary meshlet vertex/triangle limits by outputting three separate arrays of meshlet data instead of one; the resulting layout is also more compact and is often more GPU-friendly.
  • meshopt_buildMeshlets now implements a new, more expensive algorithm that generates meshlets that are optimized for a balance of vertex reuse, spatial coherency and cone culling efficiency, controlled with an extra cone_weight parameter. The old linear-time algorithm is still available as meshopt_buildMeshletsScan.
  • Implement a new algorithm, meshopt_generateTessellationIndexBuffer, that can be used to generate a special index buffer that, together with hardware tessellation stage, can efficiently implement crack-free PN-AEN tessellation for arbitrary meshes.
  • Optimize Wasm SIMD variant of meshopt_decodeVertexBuffer, making it ~5% faster
  • Fix SIMD decoder filters (meshopt_decodeFilter*) when vertex count wasn't aligned by 4
  • Fix undefined behavior when decoding some invalid compressed index buffers with meshopt_decodeIndexBuffer

gltfpack improvements

  • Implement support for KHR_materials_variants
  • Implement support for recent versions of PBR-next extensions, including KHR_materials_volume and KHR_materials_specular
  • Fix issues with running texture compression tools (toktx, basisu) in various environments
  • Fix support for older versions of Node.js
  • Fix processing for some scenes with clearcoat materials that didn't have a diffuse texture
  • Fix handling of absolute paths in Node.js builds
  • Fix processing for scenes with KHR_texture_transform extension when quantization is disabled

v0.15

23 Oct 17:39
Compare
Choose a tag to compare

This release focuses on gltfpack improvements and also features small improvements to simplifier to improve quality for some edge cases.

gltfpack highlights

gltfpack improves support for instanced meshes substantially in this release. While previously all instances of the same mesh would be merged together unconditionally which could result in large file sizes and/or memory consumption, by default the instances are kept as is now; -mm can be used to merge the geometry of the instances together, or alternatively -mi can be used to encode the instance data using EXT_mesh_gpu_instancing which, given a compatible loader, can significantly reduce the transmission size and improve loading and rendering performance.

To improve support for large scenes even further, gltfpack is now much more memory efficient, requiring ~40% less memory for processing on average.

The extension that's used by gltfpack to compress geometry, animation and instance data, is now part of glTF and is called EXT_meshopt_compression; gltfpack was changed accordingly to output compressed files conforming the up-to-date specification. This requires loaders to update to the new extension; https://github.com/zeux/meshoptimizer/tree/master/js contains plugins for three.js and Babylon.js and work is underway to integrate these directly upstream.

For texture compression, gltfpack is switching to toktx from KTX-Software; this enables support for super-compressed UASTC textures and support for texture scaling during encoding (via -ts option) which can further reduce the file size. Additionally when using toktx, gltfpack now pads the textures to a multiple of 4 to ensure compatibility with WebGL, and can optionally (via -tp option) pad to a power of 2 for older browsers. basisu command-line tool is still supported for now and automatically used if toktx is not available.

Finally, gltfpack is now available as a JS library in addition to having command-line executables; the library uses a filesystem-like interface. Please refer to gltf/library.js for documentation on the two exposed functions.

gltfpack improvements

  • Improve support for scenes with many instances of the same mesh; -mm is now required to merge these instances together
  • Implement support for EXT_mesh_gpu_instancing via -mi command line option
  • -km can now be used to keep unused materials
  • -ke now keeps extras on nodes in addition to materials
  • Improve memory consumption when packing large scenes by 40% on average
  • node.js version of gltfpack now supports texture compression if basisu or toktx are available
  • Update KTX2 support to track latest KTX2 specification, including DFD changes for ETC1S/UASTC
  • Implement support for various PBR.Next extensions including KHR_materials_transmission, KHR_materials_ior, KHR_materials_specular and KHR_materials_sheen
  • Implement support for toktx when compressing textures
  • Implement support for -ts that can be used to rescale textures to reduce transmission and memory size
  • Instead of using 1-255 range for texture quality, -tq now accepts a level from 1 to 10, which is tuned to balance compression ratio vs quality for both ETC1S and UASTC
  • Fix processing for files with unused texture coordinate 0
  • Implement support for -tp that can be used to rescale images to power-of-two when using texture compression
  • Remove command line option -tb in favor of -tc; the latter uses KHR_texture_basisu which should be more widely supported
  • Remove command line option -te; textures are now automatically embedded into .glb files
  • Implement JSON report via -r option which contains various stats about the resulting glTF scene
  • Fix texture embedding for images with spaces in the URI
  • Fix issues with non-uniform and negative mesh scale
  • Implement support for multiple scenes; all scenes are now preserved along with their own node hierarchy
  • Implement support for higher bitrate colors via -vc option
  • Fix animation range in some cases, in particular starting time is now preserved when it's not 0, and ending time is preserved when animation doesn't have motion

Miscellaneous improvements

  • Improve meshopt_simplify edge analysis to track edge loops more carefully; this fixes simplification for some cases where an open border would previously get collapsed incorrectly
  • Fix a few issues with CMake configuration when meshoptimizer is used as a dependent library
  • Fix compilation for old Apple Clang versions
  • Reduce size of meshopt_decoder.js by 40% before gzip and 5% after gzip
  • meshopt_decoder.js now has an ES6-friendly variant, meshopt_decoder.module.js, that can be imported.

v0.14

18 Apr 01:58
1f15be1
Compare
Choose a tag to compare

This release features several new algorithms, mainly aimed at improving the geometry compression, as well as many gltfpack changes with the same goal.

New algorithms

  • meshopt_optimizeVertexCacheStrip optimizes triangle lists for vertex cache, favoring long triangle strips over vertex transform efficiency. This function is recommended to use as a replacement for meshopt_optimizeVertexCache when reducing the compressed geometry size is more valuable than reducing vertex transform cost, or when using meshopt_stripify to produce shorter triangle strip sequences.
  • meshopt_encodeIndexBuffer now supports the new strip-optimized order better; this required some bitstream changes that can be enabled with meshopt_encodeIndexVersion(1). Version 1 will become the default encoding version in a later release.
  • meshopt_encodeIndexSequence can be used to compress index buffer data that doesn't represent triangle lists; the encoding is recommended for triangle strip or line lists, but can work with any index sequence (it's less efficient than meshopt_encodeIndexBuffer at compressing triangle lists)

When compressing geometry, using meshopt_optimizeVertexCacheStrip and meshopt_encodeIndexVersion(1) is recommended to minimize the distribution size of the resulting meshes; this can make the encoded data ~10% smaller before gzip/zstd compression and up to 20% smaller after gzip/zstd.

Additionally, a set of vertex filters (meshopt_decodeFilterOct, meshopt_decodeFilterQuat, meshopt_decodeFilterExp) was added to support MESHOPT_compression glTF extension; these are not as useful outside of glTF, and are described in detail in the extension draft. Cumulatively these can substantially reduce the geometry and animation data in glTF files compressed using the extension.

gltfpack highlights

gltfpack incorporates the new algorithms and filters to substantially improve the compression ratios for geometry and animation data. For example, Corset model from glTF-Sample-Models repository is 20% smaller, BrainStem model from the same repository is 30% smaller. Most of the changes currently require using a higher compression mode, activated via -cc command-line option; in a future release -cc may replace -c.

The texture compression support was updated to incorporate latest changes in KTX2 / KHR_texture_basisu specification; additionally, gltfpack now supports Basis UASTC encoding via -tu flag. Note that since gltfpack doesn't support UASTC RDO yet, the UASTC compressed files will be much larger (but much higher quality) compared to ETC1S encoded files.

For easier distribution, gltfpack is now available as an npm package.

gltfpack improvements

  • Support all primitive topology modes, except indexed point lists, as an input
  • Support for line lists as an output; line meshes were previously discarded
  • Improve filtering of redundant geometry streams (removing color/morph delta streams as necessary)
  • Implement support for KHR_materials_clearcoat extension
  • Preserve extras data on material instances when -ke flag is used
  • Add fine-grained control over quantization parameters for animations (-at, -ar, -as)
  • Add -noq option that can be used to disable quantization (resulting in much larger files)
  • Improve performance on large scenes with lots of mesh instances
  • Improve validation and error messages for invalid input files
  • Fix invalid output for files with meshes that don't produce any geometry

Miscellaneous improvements

  • meshopt_decodeVertexBuffer now automatically enables SSSE3 SIMD implementation for clang/gcc using __cpuid-based runtime detection without the need to use extra compile flags
  • meshopt_encodeVertexBuffer now works correctly on empty inputs (count = 0)
  • CMake scripts now support CMake versions older than 3.7
  • CMake options are now prefixed with MESHOPT_ (note: this breaks shared library builds, fixed in #129)

v0.13

28 Nov 07:06
Compare
Choose a tag to compare

This release has several new algorithms, SIMD improvements for vertex codec and a lot of gltfpack changes including Basis support.

New algorithms

  • meshopt_simplifyPoints can be used to simplify point clouds. The algorithm is a variant of sloppy simplifier, which means it's fast and not attribute-aware (for now).
  • meshopt_spatialSortRemap and meshopt_spatialSortTriangles can be used to reorder vertices or triangles to increase spatial locality. This is helpful when working with point clouds and triangle meshes with redundant connectivity, and can improve clusterization results.

Performance improvements

  • meshopt_decodeVertexBuffer now has an experimental AVX512 implementation, which is ~10% faster than SSSE3 implementation (it uses 128b vectors and as such carries no extra power cost). It requires AVX512-VBMI2 and AVX512-VL (available on Ice Lake CPUs).
  • meshopt_decodeVertexBuffer now has an experimental WebAssembly SIMD implementation, which is ~3x faster than scalar implementation. It requires a compatible WebAssembly implementation with SIMD enabled (Chrome Canary was used for testing).
  • WebAssembly decoders are now compiled using upstream Emscripten compiler backend, which results in ~5% faster decoding across the board.

Miscellaneous improvements

  • All allocations now use allocation callbacks that can be set through meshopt_setAllocators; previously, allocations from meshopt_IndexAdapter were using global operator new/delete.
  • CMake build system now supports BUILD_SHARED_LIBS
  • CMake build system now can install gltfpack and libmeshoptimizer upon request

gltfpack highlights

This change includes a lot of work on extension specification. As a result, MESHOPT_quantized_geometry extension that was being used before got replaced with a new KHR_mesh_quantization extension (extension PR), and the details of MESHOPT_compression extension have changed substantially to allow for fallback data (extension PR), requiring updates to GLTF loaders. Both three.js (r111) and Babylon.JS (4.1) can be used to load these files, with a custom demo/GLTFLoader.js for three.js and an extension demo/babylon.MESHOPT_compression.js for Babylon.JS.

As a result, gltfpack-produced files now validate cleanly with the most recent glTF validator build (2.0.0-dev.3.0 (November 2019)).

gltfpack also now supports Basis Universal texture supercompression. Encoding files with these textures requires basisu executable which can be built from the official repository. Two container format options are provided:

  • .basis - native container format for Basis; this is supported by three.js and Babylon.JS today, but is likely to be removed in the future because this is not compatible with glTF specification
  • .ktx - KTX2 container format from Khronos that supports Basis supercompression; this is not supported by any renderer at the time of this writing, but this is the route that is being specified (spec PR).

In addition, there were a lot of changes aimed at increasing efficiency and extending feature support, with the full list below.

gltfpack improvements

  • Switch from MESHOPT_quantized_geometry to KHR_mesh_quantization
  • gltfpack-produced files now validate cleanly with the most recent build of glTF validator (PR)
  • Update MESHOPT_compression specification, requires updating JSON loaders (GLTFLoader.js)
  • Implement support for arbitrary number of input bone influences (largest 4 weights are preserved)
  • Implement degenerate triangle filtering (5% triangle/size savings on some models)
  • Use 8-bit morph target deltas when possible (depending on the model, up to 2x memory savings, ~3% size savings); requires three.js r111 to work correctly
  • Add -cf command line option to support compressed data fallback; files produced with this option don't require MESHOPT_compression extension, but loaders that support it will not need to load uncompressed data
  • Add -si R and -sa flags that simplify the meshes using default/aggressive (sloppy) simplification
  • By default, gltfpack now produces normalized normals/tangents; this results in larger but specification-compliant files. This will be improved later, for now you can use -vu to get better compression by using unnormalized normals/tangents.
  • Impement support for Basis / KTX2 compression (-tb to compress textures using basisu into .basis container; -tc to compress textures using KTX2 container which requires extra extensions and isn't supported by renderers yet)
  • Implement support for embedding texture files into buffers (-te flag)
  • Implement support for point clouds
  • Improve animation compression efficiency for translation/scale data by reducing output precision slightly.
  • Improve efficiency of bone influence encoding (~1% size savings)
  • A few correctness fixes, including non-uniform scale handling and quantized color/weight data parsing
  • Morph target names are now preserved using extra.targetNames JSON array