Skip to content

Commit 3e9d1ff

Browse files
authored
Merge pull request #855 from zeux/v23
Release 0.23
2 parents fdd22f8 + 7a59d68 commit 3e9d1ff

17 files changed

+65
-25
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if(POLICY CMP0092)
1212
cmake_policy(SET CMP0092 NEW) # Enables clean /W4 override for MSVC
1313
endif()
1414

15-
project(meshoptimizer VERSION 0.22 LANGUAGES CXX)
15+
project(meshoptimizer VERSION 0.23 LANGUAGES CXX)
1616

1717
option(MESHOPT_BUILD_DEMO "Build demo" OFF)
1818
option(MESHOPT_BUILD_GLTFPACK "Build gltfpack" OFF)

README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ The library provides a C and C++ interface for all algorithms; you can use it fr
1313
meshoptimizer is hosted on GitHub; you can download the latest release using git:
1414

1515
```
16-
git clone -b v0.22 https://github.com/zeux/meshoptimizer.git
16+
git clone -b v0.23 https://github.com/zeux/meshoptimizer.git
1717
```
1818

19-
Alternatively you can [download the .zip archive from GitHub](https://github.com/zeux/meshoptimizer/archive/v0.22.zip).
19+
Alternatively you can [download the .zip archive from GitHub](https://github.com/zeux/meshoptimizer/archive/v0.23.zip).
2020

2121
The library is also available as a Linux package in several distributions ([ArchLinux](https://aur.archlinux.org/packages/meshoptimizer/), [Debian](https://packages.debian.org/libmeshoptimizer), [FreeBSD](https://www.freshports.org/misc/meshoptimizer/), [Nix](https://mynixos.com/nixpkgs/package/meshoptimizer), [Ubuntu](https://packages.ubuntu.com/libmeshoptimizer)), as well as a [Vcpkg port](https://github.com/microsoft/vcpkg/tree/master/ports/meshoptimizer) (see [installation instructions](https://learn.microsoft.com/en-us/vcpkg/get_started/get-started)) and a [Conan package](https://conan.io/center/recipes/meshoptimizer).
2222

@@ -557,6 +557,26 @@ Vertex and index decoders (`meshopt_decodeVertexBuffer`, `meshopt_decodeIndexBuf
557557

558558
All functions have bounded stack usage that does not exceed 32 KB for any algorithms.
559559

560+
## Experimental APIs
561+
562+
Several algorithms provided by this library are marked as "experimental"; this status is reflected in the comments as well as the annotation `MESHOPTIMIZER_EXPERIMENTAL` for each function.
563+
564+
APIs that are not experimental (annotated with `MESHOPTIMIZER_API`) are considered stable, which means that library updates will not break compatibility: existing calls should compile (API compatibility), existing binaries should link (ABI compatibility), and existing behavior should not change significantly (for example, floating point parameters will have similar behavior). This does not mean that the output of the algorithms will be identical: future versions may improve the algorithms and produce different results.
565+
566+
APIs that *are* experimental may have their interface change, both in ways that will cause existing calls to not compile, and in ways that may compile but have significantly different behavior (e.g., changes in parameter order, meaning, valid ranges). Experimental APIs may also, in rare cases, be removed from future library versions. It is recommended to carefully read release notes when updating the library if experimental APIs are in use. Some experimental APIs may also lack documentation in this README.
567+
568+
Applications may configure the library to change the attributes of experimental APIs, for example defining `MESHOPTIMIZER_EXPERIMENTAL` as `__attribute((deprecated))` will emit compiler warnings when experimental APIs are used.
569+
570+
Currently, the following APIs are experimental, with the functions marked with `*` being likely to become stable in the future with no changes:
571+
572+
- `meshopt_buildMeshletsFlex`
573+
- `meshopt_computeSphereBounds`*
574+
- `meshopt_encodeVertexBufferLevel`*
575+
- `meshopt_generateProvokingIndexBuffer`*
576+
- `meshopt_partitionClusters`
577+
- `meshopt_simplifySloppy`
578+
- `meshopt_spatialSortTriangles`
579+
560580
## License
561581

562582
This library is available to anybody free of charge, under the terms of MIT License (see LICENSE.md).

gltf/gltfpack.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* gltfpack - version 0.22
2+
* gltfpack - version 0.23
33
*
44
* Copyright (C) 2016-2025, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
55
* Report bugs and download new versions at https://github.com/zeux/meshoptimizer

gltf/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gltfpack",
3-
"version": "0.22.0",
3+
"version": "0.23.0",
44
"description": "A command-line tool that can optimize glTF files for size and speed",
55
"author": "Arseny Kapoulkine",
66
"license": "MIT",

js/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,16 @@ To control behavior of the algorithm more precisely, `flags` may specify an arra
147147
- `'ErrorAbsolute'` changes the error metric from relative to absolute both for the input error limit as well as for the resulting error. This can be used instead of `getScale`.
148148
- `'Sparse'` improves simplification performance assuming input indices are a sparse subset of the mesh. This can be useful when simplifying small mesh subsets independently. For consistency, it is recommended to use absolute errors when sparse simplification is desired.
149149

150+
While `simplify` is aware of attribute discontinuities by default (and infers them through the supplied index buffer) and tries to preserve them, it can be useful to provide information about attribute values. This allows the simplifier to take attribute error into account which can improve shading (by using vertex normals), texture deformation (by using texture coordinates), and may be necessary to preserve vertex colors when textures are not used in the first place. This can be done by using a variant of the simplification function that takes attribute values and weight factors, `simplifyWithAttributes`:
151+
152+
```ts
153+
simplifyWithAttributes: (indices: Uint32Array, vertex_positions: Float32Array, vertex_positions_stride: number, vertex_attributes: Float32Array, vertex_attributes_stride: number, attribute_weights: number[], vertex_lock: Uint8Array | null, target_index_count: number, target_error: number, flags?: Flags[]) => [Uint32Array, number];
154+
```
155+
156+
This function takes an additional `vertex_attributes` buffer that contains all the attributes to be used. The `attribute_weights` array contains a weight for each attribute, which is used to balance the importance of each attribute during simplification. For normalized attributes like normals and vertex colors, a weight around 1.0 is usually appropriate; internally, a change of `1/weight` in attribute value over a distance `d` is approximately equivalent to a change of `d` in position. Using higher weights may be appropriate to preserve attribute quality at the cost of position quality. If the attribute has a different scale (e.g. unnormalized vertex colors in [0..255] range), the weight should be divided by the scaling factor (1/255 in this example).
157+
158+
The optional `vertex_lock` parameter can be used to lock some vertices in place, preventing them from being moved during simplification. This is a binary array of the same length as the number of vertices, where `1` means that the vertex is locked and `0` means that it is free to move. This can be used to preserve seams or other important features of the mesh.
159+
150160
When the resulting mesh is stored, it might be desireable to remove the redundant vertices from the attribute buffers instead of simply using the original vertex data with the smaller index buffer. For that purpose, the simplifier module provides the `compactMesh` function, which is similar to `reorderMesh` function that the encoder provides, but doesn't perform extra optimizations and merely prepares a new vertex order that can be used to create new, smaller, vertex buffers:
151161

152162
```ts
@@ -159,6 +169,16 @@ The simplification algorithm uses relative errors for input and output; to conve
159169
getScale: (vertex_positions: Float32Array, vertex_positions_stride: number) => number;
160170
```
161171

172+
The algorithms `simplify` and `simplifyWithAttributes` work on triangle meshes. `MeshoptSimplifier` additionally provides an algorithm to simplify point clouds, with optional per-point color support:
173+
174+
```ts
175+
simplifyPoints: (vertex_positions: Float32Array, vertex_positions_stride: number, target_vertex_count: number, vertex_colors?: Float32Array, vertex_colors_stride?: number, color_weight?: number) => Uint32Array;
176+
```
177+
178+
`vertex_colors` is an optional buffer containing RGB colors, with 3 values per point; `color_weight` can be used to balance the importance of color preservation with position preservation, and can be set to `1.0` if the input colors are in `[0..1]` range.
179+
180+
The resulting indices can be used to render the simplified point cloud; similarly to triangle simplification, to reduce the memory footprint, the point cloud can be reindexed using the remap table returned by `compactMesh`.
181+
162182
## Clusterizer
163183

164184
`MeshoptClusterizer` (`meshopt_clusterizer.js`) implements meshlet generation and optimization.

0 commit comments

Comments
 (0)