zeux/meshoptimizer

Media & Design

Optimizes, compresses and simplifies 3D meshes and glTF assets so they render faster and take less space.

8,722
740
C++
MIT
10 years old

meshoptimizer is a C/C++ library of algorithms for the data side of real-time 3D rendering: reordering and compressing vertex and index buffers, simplifying meshes, and building clusters for modern rasterization and ray tracing. It targets graphics programmers and engine/tooling developers working with glTF or custom geometry formats, not people looking for a point-and-click mesh editor. The header is C-compatible even though the implementation is C++, so it can also be reached from other languages via FFI, a Rust crate, or a JavaScript package for some algorithms documentation.

What it changes in a workflow

The library organizes its work as an ordered core pipeline: indexing (removing redundant vertices), vertex cache optimization, optional overdraw optimization, vertex fetch reordering, vertex quantization, and index filtering, with optional shadow indexing. Order matters — for example vertex fetch optimization must run on the final index buffer, and shadow indexing after the other vertex/index optimizations pipeline docs. After this, lossless vertex and index codecs are intended to be fed already-optimized and quantized data; feeding unoptimized meshes yields poor compression ratios compression docs.

Simplification is the other major path. meshopt_simplify returns a new index buffer that reuses existing vertices; variants add attribute-aware error weighting, allow collapsing across attribute seams (permissive mode), or update vertex positions in place — the latter overwrites the original vertex buffer, so it must be copied first if the original mesh is still needed simplification docs.

Clusters, mesh shaders and ray tracing

For meshlet-based pipelines, the library builds and partitions clusters for mesh shading or clustered ray tracing, and provides dedicated meshlet and point-cloud codecs plus position-exponent helpers for DXR2-style compressed encoding clusterization docs. Clustered ray tracing is documented as reducing performance for static geometry versus a traditional BLAS, with its benefit being the ability to update individual clusters for deformation or hierarchical LOD ray tracing section.

Requirements and limits

  • Build with CMake or by adding only the needed src/*.cpp files; releases are also packaged for several Linux distributions, vcpkg and Conan, and a current release branch is available on GitHub installing.
  • The bundled gltfpack command-line tool optimizes glTF files; the npm build is noted as less efficient and without texture compression compared with native binaries gltfpack.
  • Non-experimental APIs keep source, binary and behavioral compatibility across updates, but algorithm output is not guaranteed identical; experimental APIs may change or be removed experimental APIs.
  • Encoded data from older versions decodes with newer ones, and newer encodes can decode on older versions when format versions are pinned; meshlet data carries no embedded version header versioning.
  • Custom allocators must throw or abort on out-of-memory — the README explicitly says malloc is not safe for this contract memory management.
  • MIT licensed; the README asks for attribution in user-facing documentation license.

HotRepo's take

Daily-board observations exist for 2026-07-10 through 07-12 and 2026-10-30 (7,985 to 8,718 stars), but the sample is too sparse to call a trend; the project has existed since 2016 regardless repository.

Written by AI from the project's README, updated October 30, 2026. The project's own docs are the source of truth.

Hacker News

Meshoptimizer Version 1.3 Released
▲ 1 · 0 comments · September 30, 2026