Mesh optimization library that makes meshes smaller and faster to render
This release contains a number of fixes and improvements for vertex codec, substantially improves performance of several algorithms in Debug builds and introduces support for decompressing vertex/index data from JavaScript.
New algorithms:
meshopt_generateVertexRemapMulti
, that generates the same remap table as meshopt_generateVertexRemap
for indexing a mesh, but supports vertex data stored as multiple independent streams (deinterleaved)meshopt_generateShadowIndexBufferMulti
, that can generate a second index buffer that shares the vertex data with the original index buffer, but supports vertex data stored as multiple independent streams (deinterleaved)Improvements:
meshopt_decodeVertexBuffer
, making it 1-2% fastermeshopt_decodeVertexBuffer
, fixing compilation issues on ARM64, MSVC ARM, and clang for Windowsmeshopt_encodeVertexBuffer
that resulted in incorrectly encoded data on platforms where char
is unsigned
(this mostly affected ARM hosts such as Android)meshopt_analyzeVertexCache
is 6x fastermeshopt_optimizeVertexCache
is 4.7x fastermeshopt_analyzeOverdraw
is 3.9x fastermeshopt_optimizeOverdraw
is 1.4x fastermeshopt_simplify
is 1.3x fasterJavaScript support:
js/decoder.js
that contains a WebAssembly version of vertex and index decoders with a JavaScript-friendly interface. The decoders run at 200-400 MB/s on modern desktop CPUs.tools/OptMeshLoader.js
that contains an example mesh loader for THREE.js that uses vertex/index codecs for compression and quantizes vertex data for efficient storage; the meshes for this loader can be produced by tools/meshencoder.cpp
using .OBJ files as an input.This release substantially improves mesh simplification and introduces experimental algorithms for advanced GPU mesh rendering (cone culling, meshlet construction). The library can also now be used from Rust via https://crates.io/crates/meshopt.
Interface changes:
meshopt_simplify
has an extra argument, target_error
, that can be used to limit the geometric error introduced by the simplifierNew algorithms:
meshopt_buildMeshlets
, that can create meshlet data from index buffer that can be used to efficiently drive the mesh shading pipeline in NVidia RTX GPUsmeshopt_computeClusterBounds
and meshopt_computeMeshletBounds
, that can compute bounding sphere and bounding normal cone for use in GPU cluster culling.meshopt_generateShadowIndexBuffer
, that can generate a second index buffer that shares the vertex data with the original index buffer, but is more efficient when a subset of vertex attributes is needed.Improvements:
meshopt_simplify
to improve simplification quality, including error metric improvements, attribute-guided collapse that preserves UV seam structure better, and other tweaksmeshopt_simplify
, making it ~4x fastermeshopt_generateVertexRemap
, making it 1.25x fastermeshopt_decodeVertexBuffer
for platforms without SIMD support, making it 1.1x fastermeshopt_encodeVertexBuffer
This release introduces vertex buffer encoder and a stable version of index buffer encoder.
New algorithms:
meshopt_encodeVertexBuffer
and meshopt_decodeVertexBuffer
. The algorithm typically provides 1.5-2x compression ratio for quantized vertex data, and the resulting data can be compressed further by a general purpose compressor like zstd. Decoding is highly optimized using SSSE3/NEON and runs at 2 GB/s on a modern desktop CPU.meshopt_encodeIndexBuffer
and meshopt_decodeIndexBuffer
. The algorithm typically encodes index buffers using ~3-4 bits per index, and the resulting data can be compressed further by a general purpose compressor like zstd, yielding ~2-3 bits per index for most meshes. Decoding is highly optimized and runs at 2 GB/s on a modern desktop CPU for 32-bit indices (1 GB/s for 16-bit indices).meshopt_optimizeVertexFetchRemap
; it generates a remap table that can be used with meshopt_remapVertexBuffer
/meshopt_remapIndexBuffer
and helps optimizing meshes with several vertex streams.Improvements:
meshopt_optimizeOverdraw
, making the function 10% fastermeshopt_analyzeVertexCache
and meshopt_analyzeVertexFetch
results for sparse vertex buffers (with unused vertices)meshopt_remapVertexBuffer
This release has large interface changes and introduces several new algorithms and tweaks to existing algorithms.
Interface:
meshopt
namespace and gained meshopt_
prefix to simplify documentation & interfacemeshopt_
prefix to avoid name conflictsmeshopt_quantizeX
functions now use function arguments instead of template parameters for better compatibilitycache_size
argument has been removed from meshopt_optimizeVertexCache
and meshopt_optimizeOverdraw
; to perform optimization for a FIFO cache of a fixed size, use meshopt_optimizeVertexCacheFifo
New algorithms:
meshopt_encodeIndexBuffer
and meshopt_decodeIndexBuffer
. The algorithm typically encodes index buffers using ~3-4 bits per index, and the resulting data can be compressed further by a general purpose compressor like zstd, yielding ~2-3 bits per index for most meshes.meshopt_stripify
and typically produces buffers with around 60-65% indices compared to triangle lists, and a 5-10% ACMR penalty on GPUs with small caches.meshopt_quantizeFloat
, that can reduce the precision of a floating-point number while keeping the floating-point representation. This can be useful to generate vertex data that can be compressed more effectively using a general purpose compression algorithm.Improvements:
meshopt_analyzeOverdraw
) now uses a pixel center fill convention to match hardware rendering more closely.meshopt_analyzeVertexCache
) now models cache that matches real hardware a bit more closely, and requires additional parameters to configure (namely, primitive group size and warp/wavefront size).meshopt_optimizeVertexCache
) has been tuned to generate better output that performs well on real hardware, especially given meshes that have topology similar to that of a uniform grid as an input.This release has significant interface changes and introduces several new algorithms and tweaks to existing algorithms.
Interface:
meshoptimizer.hpp
has been renamed to meshoptimizer.h
accordingly. Templated functions are still available in namespace meshopt
for C++.optimizeVertexFetch
, optimizeOverdraw
and analyzeOverdraw
parameter order has changed - make sure to revise existing calls to these functions.New algorithms:
cache_size
parameter of optimizeVertexCache
to 0. It generally takes ~3x longer to optimize meshes but usually produces more efficient output with the exception of regular grids.meshopt::simplify
. This is an early version of the algorithm - expect to see performance and quality improvements in future versions.Fixes:
remapVertexBuffer
now correctly handles indexed vertex buffers where some vertices are not referencedoptimizeOverdraw
now correctly handles index buffers with degenerate trianglesoptimizeOverdraw
is able to preserve the vertex cache efficiency much betterThis is the first release of meshoptimizer library. Features:
All algorithms have been optimized for both runtime performance (it's actually practical to run them at load time!) and efficiency of the resulting meshes.