donmccurdy / glTF-Transform

glTF 2.0 SDK for JavaScript and TypeScript, on Web and Node.js.
https://gltf-transform.dev
MIT License
1.3k stars 145 forks source link

Set maximum size exceeded #1341

Closed RyugaRyuzaki closed 3 months ago

RyugaRyuzaki commented 3 months ago
donmccurdy commented 3 months ago

On the v4 alpha release, this has been fixed with a fast path for weld tolerance=0. I'd recommend tolerance=0 for most use cases starting with v4, where it will be the default.

To install the alpha release:

npm install --save @gltf-transform/core@next @gltf-transform/extensions@next @gltf-transform/functions@next

Also note the reorder, quantize, and meshopt steps can all be combined into one:

await doc.transform(
      weld(),
      simplify({simplifier: MeshoptSimplifier, ratio: 0.75, error: 0.001}),
      meshopt({encoder: MeshoptEncoder, level: 'high'}),
      sequence()
);

Then explicitly calling doc.createExtension(EXTMeshoptCompression) is not required.