donmccurdy / glTF-Transform

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

Quantization should preserve sparse accessors #795

Open donmccurdy opened 1 year ago

donmccurdy commented 1 year ago

Tested with the sample from https://github.com/donmccurdy/glTF-Transform/issues/289, I'm observing that using quantization on an asset with sparse accessors results in broken morph target animation. For now the quantize function will simply unset the sparse property from any affected accessors. I can't think of any reason that it shouldn't be possible to use the two together, though, so with some more investigation we may be able to fix this.

Also affects Meshopt compression, which begins with a quantization step.

donmccurdy commented 1 year ago

For anyone interested in investigating, steps would be:

  1. Download this GLB
  2. Remove setSparse(false) on the line below https://github.com/donmccurdy/glTF-Transform/blob/b53c7a26900f2f01a0dc040940dc30cda490acec/packages/functions/src/quantize.ts#L302
  3. Test gltf-transform quantize in.glb out.glb and examine the results