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

Add support for KTX2 loader #266

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

marwie
Copy link

@marwie marwie commented Jun 30, 2024

This PR adds support for KTX2 loader codegen since currently files with basisu compressed textures can not be loaded with gltfjsx codegen.

It also enables the draco option or meshopt option automatically if the mesh uses draco/meshopt compression.

Output Example:
https://codesandbox.io/p/sandbox/example-gltfjsx-ktx-draco-zq868k?workspaceId=6fd5c640-33c5-4061-bc17-d4030f1a6650

Steps to reproduce:

  1. Load compressed DamagedHelmet
  2. Drop into https://gltf.pmnd.rs/
  3. Observe error

This PR might be actually better suited as an option for drei useGLTF to avoid creating KTX2 loaders for every model (as we do with this PR). It would also simplify codegen again.
Let me know if you'd prefer this as a third bool argument (similar to draco and meshopt) and if so in what fashion (before the loader callback parameter or after) or if you prefer a different solution.

Currently the PR removes useGLTF.preload for files with KTX2 textures and doesnt handle the hasInstances case - happy to apply the necessary changes once it's clear what the preferred solution is :)

@drcmda
Copy link
Member

drcmda commented Jul 13, 2024

yes i think this should be in drei/useGltf

@marwie
Copy link
Author

marwie commented Jul 13, 2024

Is that something you'll be adding or I should make a PR?

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

Successfully merging this pull request may close these issues.

2 participants