Setting the value 0 to the DefaultNumWorkers from DracoCompression throw an Engine error since 6.21.1 version

I’m using the line : “BABYLON.DracoCompression.DefaultNumWorkers = 0;”. To force the Engine to use the default js script and not the wasm one because of an incompatibility with JS Obfuscator. But since the 6.21.1 version, the line throw this error : “Engine must be provided in the buffer constructor in order to create”.

Everything worked fine before the last version.

ping @bghgary

Thanks for the report! I will investigate.

@Kidsarow Can you send a PG? I don’t repro.

I cannot reproduce it in the PG. I’m using Babylon.js in Electron with Webpack to bundle the whole. Maybe it come from it. I still not figured out why but It seems that the worker cannot access the engine.

Can you put up an example repo?

@bghgary @Kidsarow Greetings, I am also having this exact error but only on the Native side not on the BabylonJS side.

its coming from here:

As stated above, was working fine before prior to the upgrade to latest (6.21.1). Was there an update to the draco decoder or something? Obviously the worker does not see the Engine. I’ll see what I can do for a repro in the Native Example app.

Yes, I made some changes. I added this error. I need a repro. :slight_smile:

got it lol. Working on a repro as we speak :slight_smile:

1 Like

here is a draco compressed .glb we’re trying to load.
https://playground.babylonjs.com/#JUKXQD#5381. This loads fine in the PG with no errors.

so using the NativeExample app, modify this line below. https://github.com/BabylonJS/BabylonNativeExamples/blob/main/Apps/ConsoleApp/Win32/App.cpp#L171

with this

   std::array<Asset, 4> assets = {
        Asset{"BoomBox", "https://dl.dropbox.com/scl/fi/6q83qhg74lxbfyvwdbrmh/BoomBox.glb?rlkey=j0qj1sf6mntbyshnympl1delp"},
        Asset{"DRCHat", "https://dl.dropbox.com/scl/fi/t1i9nvc0o0it06lqtz4rg/exterior-1.glb?rlkey=knvmokfrism9q6sksmxbzxzxp"}
    };

the DRCHat asset fails with an error:

Unhandled exception at line 62, column 5 in app:///Scripts/index.js
0x800a139e - JavaScript runtime error: Unable to load from https://dl.dropbox.com/scl/fi/t1i9nvc0o0it06lqtz4rg/exterior-1.glb?rlkey=knvmokfrism9q6sksmxbzxzxp: Unable to get absolute URL. Override BABYLON.Tools.GetAbsoluteUrl to a custom implementation for the current context.

also in index.js you can add this to make sure the draco decoder is set up correctly…

`
    // draco decoder settings
    var decoder = {
        wasmUrl: "https://cdn.spectrumcustomizer.com/babylon/draco_decoder_gltf.js",
        wasmBinaryUrl: "https://cdn.spectrumcustomizer.com/babylon/draco_decoder_gltf.wasm",
        fallbackUrl: "https://cdn.spectrumcustomizer.com/babylon/draco_wasm_wrapper_gltf.js",
    };
    BABYLON.DracoCompression.Configuration = { decoder };
`

i realize this error is different than the one im getting in our app… but perhaps its is a step forward or related? :confused: I’ll keep digging.

BabylonNativeExamples has not been updated with my latest changes, so maybe that’s why. I’ll try it.

@bghgary sorry I did update the example app to use BabylonJS 6.21.1 and latest native (latest commit in native

commit 4b8b9e69d0bf59bb1912a638f761013eb9045646 (HEAD -> master, origin/master, origin/HEAD)
Author: Gary Hsu <bghgary@users.noreply.github.com>
Date:   Wed Sep 13 13:13:23 2023 -0700

)

I don’t think Draco works in native. There are some issues with loading scripts that make it not work. This hasn’t changed recently. Did Draco work for you before and now it’s not working?

@bghgary we got draco working. But im having a hard time replicating this exact issue on the Example App. Plan B will be to figure out how to get you our actual app so you can debug through it.

This PR has the fix. Sorry for the troubles!

Better fix for recent Draco changes by bghgary · Pull Request #14351 · BabylonJS/Babylon.js (github.com)

1 Like