Error KTX2Loader: .transcodeImage failed

I’m trying to load a gltf with some ktx2 textures. With some models it works correctly, but with others it throws the following error:

I tried https://gltf-viewer.donmccurdy.com/ viewer from @donmccurdy and it works as expected. I use the following code to load the gltf:

  const loader = new GLTFLoader();
  const loaderKTX2 = new KTX2Loader();
  loaderKTX2.setTranscoderPath('scripts/basis/');
  loaderKTX2.detectSupport(renderer);
  loader.setKTX2Loader(loaderKTX2);

  const loadedData = await loader.loadAsync(modelUrl);

  loaderKTX2.dispose();

Any suggestions will be greatly appreciated! :slight_smile:

I haven’t seen this error before and am not quite sure what to make of it. Would you be able to share a demo?

If you’re loading more than one model, it might be worth trying to reuse the same KTX2Loader across all of them.

I was debugging and I saw that the ktx file was incorrectly uploaded to the server. Now it’s working perfectly, thank you!

1 Like