Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lack of extensions or so... #34

Closed
tigrazone opened this issue Nov 4, 2023 · 1 comment
Closed

lack of extensions or so... #34

tigrazone opened this issue Nov 4, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@tigrazone
Copy link

Hello!
Thank you for fastgltf. It's impressive but not open all files from https://github.com/gkjohnson/3d-demo-data.git which use and can open https://github.com/gkjohnson/three-gpu-pathtracer.git
For example, I try to open https://raw.githubusercontent.com/gkjohnson/3d-demo-data/main/models/pathtracing-bathroom/modernbathroom.glb and fastgltf_gl_viewer fails with error

Loading c:\msys64\home\user\from-git\3d-demo-data\models\pathtracing-bathroom\modernbathroom.glb
Failed to load glTF: One or more extensions are required by the glTF but not enabled in the Parser.
Failed to parse glTF.

I find here is extension list and extend it to all possible

fastgltf::Parser parser(fastgltf::Extensions::KHR_mesh_quantization);

with change to
fastgltf::Parser parser((fastgltf::Extensions)~0);

After change fastgltf_gl_viewer fails with error

Loading c:\msys64\home\user\from-git\3d-demo-data\models\pathtracing-bathroom\modernbathroom.glb
Failed to load glTF: The glTF is either missing something or has invalid data.
Failed to parse glTF

Can you fix this error?

@spnda
Copy link
Owner

spnda commented Nov 4, 2023

Hi, thanks for the report.
First of all, the gl_viewer example simply does not support the EXT_meshopt_compression. I want to keep the example at a bare minimum and only support the core glTF specification. While some extensions are widely used, I will not add code to support them to the example. KHR_mesh_quantization was the only one I added because it required no additional code.

As for the parsing error you experienced after enabling the extensions in the parser, it turns out there was a part of the spec for EXT_meshopt_compression that I seem to have missed. It adds the concept of so-called fallback buffers which are buffers with a byteLength property but they contain no data. The code currently throws an error in this case because it expects to either have a uri property or use the GLB buffer, which is why you're getting that error.

I've now changed the code in an upcoming commit that adds a new (empty) data source called ´Fallback` that is used whenever the library detects the extension is enabled (and required by the asset) and a buffer has no data. It is then the users responsibility to always use the compressed buffer version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants