I am using a
.basis texture, and when I inspect the network waterfall in the Dev Tools, I see Babylon make a request to
https://preview.babylonjs.com/basisTranscoder/basis_transcoder.js. I was wondering since these resources are loaded from the web, does it mean Babylon can only load
.basis files while offline. And if so is there a way to manually link these dependencies?
I am using a
You can set the file loader to load those files from your local server, thus making it available offline. You will need to deliver the files locally somehow though (a local webserver?) because they are needed in order to decode the data
And how do you do that exactly
BasisTools has two parameters you can change:
/** * URL to use when loading the basis transcoder */ public static JSModuleURL = "https://preview.babylonjs.com/basisTranscoder/basis_transcoder.js"; /** * URL to use when loading the wasm module for the transcoder */ public static WasmModuleURL = "https://preview.babylonjs.com/basisTranscoder/basis_transcoder.wasm";
These are the URLs used when loading both files. Those can be any valid URL you wish (even a base64 data URL).
I am not sure how you project is setup, so it is hard for me to say how you should do that in your own project, but either import BasiscTools or set BABYLON.BasiscTools.??? to be the right local URL
Oh thanks a lot, now I can just have those files within my project. And it automatically works even offline
And by the way shouldn’t this be documented here, maybe someone tried loading a basis texture and failed because of a bad internet connection. Maybe it should be mentioned in the docs somewhere. Maybe here
It’s documented in the API of BasisTools - BasisTools | Babylon.js Documentation (babylonjs.com) , but I agree that there is room for improvement in the .basis support section
We accept PRs!
@PirateJC FYI regarding docs
Maybe I can help