warrenm / GLTFKit2

A glTF 2.0 asset loader and exporter for Objective-C and Swift.
MIT License
150 stars 26 forks source link

Implement EXT_meshopt_compression decompression #22

Closed berbschloe closed 8 months ago

berbschloe commented 1 year ago

I'm having an issue loading a GLB file that is compressed with Meshopt (EXT_meshopt_compression).

Smilies_20220815.glb.zip

It is crashing on the load step. Screen Shot 2022-08-17 at 11 08 38 AM

Would it be possible get support for loading these files (similar to Draco)?

If not, is there a way to check if a compression is used on a GLB file so I can pop up an alert saying "unsupported"? Thanks in advance for any support.

warrenm commented 1 year ago

Sorry about the crash. We should definitely be better about checking required extensions so we don't blow up in cases like this.

Much like Draco, I'm not interested in taking meshoptimizer on as a hard dependency, but I imagine a similar plugin approach would work. If you have opinions on what that should look like, I'm open to proposals.

I don't have any bandwidth to actually fix this this month, though, just to set expectations.

warrenm commented 1 year ago

Required extension validation is implemented in 382b798.

berbschloe commented 1 year ago

Thanks for getting back to me, for the time being I'm filtering out any GLTFAsset that have any extensionsRequired and throwing an error.

donmccurdy commented 1 year ago

Much like Draco, I'm not interested in taking meshoptimizer on as a hard dependency, but I imagine a similar plugin approach would work. If you have opinions on what that should look like, I'm open to proposals.

Unlike Draco, it is very possible to implement Meshopt decompression without any dependencies. The project provides an unoptimized "reference" implementation in 300 lines of JavaScript:

https://github.com/zeux/meshoptimizer/blob/master/js/meshopt_decoder_reference.js

warrenm commented 1 year ago

Hey @donmccurdy, thanks for the note. This makes me more comfortable with including meshopt decompression in GLTFKit2 core. Will investigate for future implementation.

warrenm commented 8 months ago

EXT_meshopt_compression is supported as of ebfee4a.

warrenm commented 8 months ago

This issue will be closed as completed in seven days if no further feedback is received.

warrenm commented 8 months ago

Closing as complete.