Draco Decoder Urls - Offline (local "file://") Inline as base64 BLOB URL.createObjectURL implementation fails

Hello!

I need a one file html file for a customer to use the BABLYON 3D Viewer for glb files. Must run offline as well. (Just one File, not multiple files in the same folder, and no Webserver) The Customer must receive the File, open it and sees the 3D Object. (there are some custome HTML GUI, Infotexts etc. so a Windows 3D Viewer doenst help) (He want to show it at events whithout internetConnection on the computer)

I already accomplished to base64 convert the GLB FIles, Javascripts, Images, Environment dds, etc.
The only problem is now the Draco Decoder URLS:

var draco = `var DracoDecoderModule=function(){var r=“undefined”!=ty… // whoe js file minified copied here
let dracoUrl = “data:application/octet-stream;base64,” + btoa(draco);
let dlob =await fetch(dracoUrl,)
.then(resD => resD.blob())
.then(blobD => {
let dUrl = URL.createObjectURL(blobD);
BABYLON.DracoCompression.Configuration.decoder.wasmUrl = dUrl;
console.log('drace set: ',BABYLON.DracoCompression.Configuration.decoder.wasmUrl ); // → seems alrigt blob:null/e7…

(tried all 3 decoders: wasmBinaryUrl, fallbackUrl, wasmUrl)

I can load the File with: BABYLON.Tools.LoadFile(dUrl, (data → and get teh Data from the string.
But if I try to load a model Ill get a

Not allowed to load local resource: blob:null/e7bc538a-9971-4830-b4ec-fc9751f5fee8
Uncaught DOMException: Failed to execute ‘importScripts’ on ‘WorkerGlobalScope’: The script at ‘blob:null/e7bc538a-9971-4830-b4ec-fc9751f5fee8’ failed to load.
at onmessage (blob:null/bf090157-7588-428d-a5ed-9f645c60c84e:1:1529)

the URL is file://C:/…index.html Implementing the GLB File and DDS File was done the same way without errors. So I wonder if there is some kind of bug. I havent understoot how the draco thing is working:

I tried to turn off Browser Security, Start browser with a

chrome.exe --allow-file-access-from-files.
but nothing helped.

I am not sure to understand… is the wasm not loading and the draco data from within a model file ?

A repro in the playground would help.

You see, that the draco wasmUrl is now included via a string (which contains the JS file) over a blob - URL.
Works great with a server, but not offline without a server so url is something file://…
(here you see the draco js files he’s loading - and if there is no internet connection the viewer doesnt work)

why using draco ??? it is slowing down your experience if there are no network involved ?

1 Like

Thanks for pointing it out. So how can I not use draco? just export as gltf and the file loader does not need the draco ?

1 Like


image