Load KTX2 de/transcoder from own server


the ktx2 transcoders are getting downloaded from https://preview.babylonjs.com/.

Is there a way to set it up, that these files are coming from your own server?

You can override that with KhronosTextureContainer2.JSModuleURL set to the full url/path to babylon.ktx2Decoder.js and it will grab the wasm modules from the same place after that


Nice, looks exactly like what I need! KhronosTextureContainer2 | Babylon.js Documentation

Ok it works if I use an absolute path from our server https://website.com/ktx2-decoders/babylon.ktx2Decoder.js, but I can’t use relative paths. Is this expected?

You seem correct on that part. It took me some digging to figure out why and a SO post led me to:


Loading External Scripts

When using these techniques to inline your worker code, importScripts() will only work if you supply an absolute URI. If you attempt to pass a relative URI, the browser will complain with a security error. The reason being: the worker (now created from a blob URL) will be resolved with a blob: prefix, while your app will be running from a different (presumably http:// ) scheme. Hence, the failure will be due to cross origin restrictions.