How to make ktx2Decoder on local, request it takes too long

I changed the model with gltfpack, but I found that the request for these files took a long time. These files were all on https://preview.babylonjs.com. My babylon.js is located in the place. Although it is large, but it takes a short time.

Is there any way to use the local babylon.ktx2decoder.js and MSC_BASIS_TRANSCODER.JS when loading the model?

How did you set up your local project? npm?

You can change the KhronosTextureContainer2.URLConfig KhronosTextureContainer2 | Babylon.js Documentation
i.e. KhronosTextureContainer2.URLConfig.jsDecoderModule = "https://somewebsite.com/babylon.ktx2Decoder.js".

However I wasn’t able to get the files relatively from the local project, it has to be an absolute path. As described in this Thread. I now set the paths by getting document.location.origin and adding to that.

3 Likes

Using relative urls should be possible. The code just doesn’t call Tools.GetAbsoluteUrl before storing the url. We do this for the Draco module, for example. Feel free to file a GitHub issue for this.

thanks for help