You have nothing special to do to use the new loader/decoder, just load/use ktx2 files! For GLTF files, you need to use the KHR_texture_basisu extension.
Yo @Deltakosh … How do we use .ktx2 textures for Skybox CubeTexture… i tried setting extension _px_ktx2 … but no luck… looks like the parser does not take into account .ktx2 file extensions
You don’t need to provide a fallback (at least in Babylon context) because the fallback is for gltf loaders that don’t support the KHR_texture_basisu extension.
You can set the BABYLON.KhronosTextureContainer2.JSModuleURL property as you want. By default, the value is https://preview.babylonjs.com/babylon.ktx2Decoder.js.
Depending on the source and transcoded format, there are other files that are downloaded dynamically:
UASTC -> ASTC_4x4_RGBA: the wasm module pointed to by KTX2DECODER.LiteTranscoder_UASTC_ASTC.WasmModuleURL is downloaded (default value: https://preview.babylonjs.com/ktx2Transcoders/uastc_astc.wasm).
UASTC -> BC7_RGBA: the wasm module pointed to by KTX2DECODER.LiteTranscoder_UASTC_BC7.WasmModuleURL is downloaded (default value: https://preview.babylonjs.com/ktx2Transcoders/uastc_bc7.wasm).
other transcoding: the js module pointed to by KTX2DECODER.MSCTranscoder.JSModuleURL (default value: https://preview.babylonjs.com/ktx2Transcoders/msc_basis_transcoder.js) and the wasm module pointed to by KTX2DECODER.MSCTranscoder.WasmModuleURL (default value: https://preview.babylonjs.com/ktx2Transcoders/msc_basis_transcoder.wasm) are downloaded .
For the time being those values can’t be changed because the ktx2 decoder module is imported in worker threads so you can’t access those properties.
Maybe we should provide a way to change the values? @bghgary?
So your saying … i should not put ktx2 stuff on the page and let the loaders auto-magic the loading of any need libs to decode the ktx2 image referenced in the GLTF (i am requiring the basis extension)
Yeah, we should probably provide a way to configure this. I didn’t realize this can’t be changed right now.
Depending on the situation, you might still want to host the files and reconfigure the decoder to point to your own copies. This will prevent newer versions of the decoder from breaking older code.
Babylon Native should be able to consume this as is. There is nothing special about this from the native perspective. The only thing is that Babylon Native currently doesn’t have web workers which will come eventually.