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

GLTFExporter: Add support for signed data types. #25297

Merged

Conversation

spearwolf
Copy link
Contributor

@spearwolf spearwolf commented Jan 17, 2023

Fixed #20474
Fixed #25310

Description

Within the GLTFExporter only the buffer attributes types float, uint, ushort and ubyte are supported.
All other types cancel the export with an error: An error happened during parsing Error: THREE.GLTFExporter: Unsupported bufferAttribute component type.

What is missing are the signed data types: byte, short and int. These are also valid data types according to the KHR_mesh_quantization extension.

With this fix the signed data types are now also supported in the GLTFExporter.

This will allow the export of meshes that have already been quantized (e.g. with tools like gltf-transform):

@LeviPesin
Copy link
Contributor

Related: #20762

@donmccurdy
Copy link
Collaborator

Thanks @spearwolf!

These are also valid data types according to the KHR_mesh_quantization extension.

I think we'll need to detect when these types are used, and add the KHR_mesh_quantization extension to the export. Do you mind including that change here as well?

@Mugen87
Copy link
Collaborator

Mugen87 commented Jan 18, 2023

Yeah, #20762 was closed since KHR_mesh_quantization wasn't added at that time and without the extensions the PR was incomplete.

@spearwolf
Copy link
Contributor Author

ok, I added a simple check that adds the KHR_mesh_quantization extension to the required (and used) list when non-standard vertex attribute data types are used 🕵🏻

Copy link
Collaborator

@donmccurdy donmccurdy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple bits of feedback, but would love to get this merged in soon – thank you!

examples/jsm/exporters/GLTFExporter.js Outdated Show resolved Hide resolved
examples/jsm/exporters/GLTFExporter.js Outdated Show resolved Hide resolved
examples/jsm/exporters/GLTFExporter.js Outdated Show resolved Hide resolved
@mrdoob mrdoob modified the milestones: r149, r150 Jan 26, 2023
@spearwolf
Copy link
Contributor Author

@donmccurdy so have your feeback implemented - hope it fits so

Copy link
Collaborator

@donmccurdy donmccurdy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Tested with #25354.

@Mugen87 Mugen87 merged commit 0d4735c into mrdoob:dev Jan 29, 2023
@Mugen87 Mugen87 changed the title GLTFExporter: add support for signed data types GLTFExporter: Add support for signed data types. Jan 29, 2023
@spearwolf spearwolf deleted the feat-gltfexporter-signed-webgl-data-types branch January 29, 2023 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants