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

Additional UV sets being removed with --transform, no option to make sure these are preserved #235

Open
Prungus opened this issue Nov 30, 2023 · 3 comments

Comments

@Prungus
Copy link

Prungus commented Nov 30, 2023

When processing gltf or glb models that contain meshes with multiple UV sets, they are always removed without any way to ensure they stay. I have tested all flags with transform and there does not seem to be a way to keep multiple UV sets on the meshes. This is especially burdensome as Three.js has included proper support for multiple UV sets via texture channels as of r153

@donmccurdy
Copy link
Member

The keepAttributes: false option passed to glTF Transform here is responsible for removing unused UVs:

prune({ keepAttributes: false, keepLeaves: false }),

As you note, gltfjsx doesn't expose an option to override that today. One workaround would be to pre-process the file with glTF Transform first, and skip --transform.

npx @gltf-transform/cli optimize input.glb output.glb --compress meshopt --texture-compress webp --texture-resize 2048

glTF Transform is configurable, and this is not exactly the same set of optimizations as gltfjsx has chosen, but you can try different options with the CLI to see what you prefer.

npx @gltf-transform/cli --help
npx @gltf-transform/cli optimize --help

@hichemfantar
Copy link

hichemfantar commented Sep 21, 2024

I'm having the same issue with normals being stripped from attributes.
we really need a way to override this behavior

@donmccurdy do you mind adding a flag to configure keepAttributes?

related issue #278

@donmccurdy
Copy link
Member

@hichemfantar The flag is now exposed in the glTF Transform CLI to enable/disable keepAttributes, and could be changed for gltfjsx here if you'd like to make a pull request:

prune({ keepAttributes: false, keepLeaves: false }),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants