Improvements to glTF scatter export #95
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR makes some improvements to our glTF scatter export. As glTF is probably our most important export format (it's the most widely supported, including what's supported by CoSpaces), it makes sense to try and optimize our glTF export as much as possible. This PR makes a few improvements, some to overall glTF export and some for scatter exports in particular:
short
values - that is, 2-byte integers rather than 4-byte. If the maximum index in any of the triangles in a given mesh is less than 2^16 = 65,536, we can export the indices with 2 bytes per value and reduce the output filesize. This PR updates our glTF utility method to allow using short integers, and uses this when appropriate in our scatter export.gltf-transform
rather thangltf-pipeline
andgltfpack
. This package includes both Draco and Meshoptimizer compression, as well as some other stuff as well.points_per_mesh
parameter to the layer export method, which allows us to determine whether we want to optimize for filesize or performance. I'm pretty sure that combining meshes together is what some of the optimization extensions do, but it's also nice to offer this for users who need their files to be displayed in a context that doesn't support glTF extensions.