How use ktx texures with gltf

Hi! I want converted my gltf for use ktx textures.
I use gltfpack like this gltfpack -i model.gltf -o 2model.gltf -tc
and use KTX2Loader like this:
const ktxLoader = new KTX2Loader()
ktxLoader.setTranscoderPath( ‘/basis/’ ); // in my catalog with models
gltfLoader.setKTX2Loader(ktxLoader);

then, I get error like this:
GLTFLoader.js:2590 THREE.GLTFLoader: Couldn’t load texture IKT4l.ktx2

What did I do wrong?

Do you mind sharing the optimized glTF asset in this thread?

One option would be to output a .glb instead of a .gltf … it sounds like some of the files this depends on are in the wrong location, perhaps? Can you tell if the requests in the network tab are finding that file?

Unfortunately I can not (

Yes, the requests find that file

If you convert glb to glb:

Perhaps I am not using the transcoder correctly?
i copied the directory
image
and add it like this ktxLoader.setTranscoderPath (’/ basis /’);

It’is my mistake!
need set this :


const ktxLoader = new KTX2Loader()
ktxLoader .setTranscoderPath( ‘js/libs/basis/’ )
ktxLoader .detectSupport( renderer )

Thanks to all!

Ah ok, sorry that wasn’t a very clear error message. Future versions should warn about this: KTX2Loader: Warn on missing call to detectSupport() by donmccurdy · Pull Request #22519 · mrdoob/three.js · GitHub

2 Likes