Babylonjs Offline Support

Hi,
I need to run a project developed using babylonjs in offline. In that project the draco compressed 3d models has been used as glb format. While run this with internet connection, it is running perfectly. But, while run this in offline, The 3d model doesn’t get loaded. It shows an error with the draco_decoder_gltf.wasm , Kindly have a look into the error message given below and help me on this.

https://preview.babylonjs.com/draco_decoder_gltf.wasm net::ERR_NAME_NOT_RESOLVED

By default the files used by the Draco decompressor are downloaded from preview.babylonjs.com. You will need to host them locally and change the urls to point to those files.

The urls can be found in DracoCompression.Configuration:

public static Configuration: IDracoCompressionConfiguration = {
    decoder: {
        wasmUrl: "https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js",
        wasmBinaryUrl: "https://preview.babylonjs.com/draco_decoder_gltf.wasm",
        fallbackUrl: "https://preview.babylonjs.com/draco_decoder_gltf.js"
    }
};

So, do something like:

BABYLON.DracoCompression.Configuration.decoder.wasmUrl = "local url to draco_wasm_wrapper_gltf.js";
BABYLON.DracoCompression.Configuration.decoder.wasmBinaryUrl = "local url to draco_decoder_gltf.wasm";
BABYLON.DracoCompression.Configuration.decoder.fallbackUrl = "local url to draco_decoder_gltf.js";
4 Likes

@Evgeni_Popov Thanks for your reply. I am sorry to say that, I don’t know where I can see that DracoCompression.Configuration . Can you please share a live demo.

Look at the browser console in this PG:

3 Likes

Thanks a lot @Evgeni_Popov . It is working.

1 Like