Different texture format settings for different GLTFs


I would like to use KTX textures for some but not all of my models.
Is it possible to set a different texture format for every GLTF?

The only setting I found is at engine level and since textures are loaded asynchrously,
I fear that if I switch the format before loading a specific model
it could effect existing queued textures which have not been loaded yet.

Do you mean changing the texture file format in the gltf? Or loading different textures afterward?

I would like to for example first load a GLTF scene with KTX compressed textures,
then create some Meshes with JPG or PNG Textures from external sources
and then I would like to dynamically load one or more GLTF objects and for each of them I need to decide whether to use KTX textureFormat or not.

ping @trevordev

@tortru I don’t think this is currently supported but the loader is designed to fallback if no ktx file exists so could you enable ktx formats and when loading ktx files it will succeed on the first try but for non ktx gltf’s it will fallback and still succeed or does that not work for you?

I hoped I could avoid these unnecessary 404 requests.
A possible workaround would be to have the models which do not have KTX textures to be loaded as GLBs. In that case no extra requests will be made.

BTW: Is it possible to use KTX textures inside GLB files?

Yea, avoiding 404s seems like a good idea so I’d like to solve that at some point but I might not get to it for a while (If you have any good suggestions on how to solve this let me know, PRs are welcome). Also GLBs currently don’t support KTX without a custom extension so what you have right now is likely the best you can do in the current state.

1 Like

Thank you. I think this workaround should be sufficient for now.

In future I think a good solution would be to support the CTTF extension once it hat been specified.

1 Like