Hi everyone,
I have to load a quite large GLB file (7 MB) which only contains KTX2 compressed textures.
It works fine in most browser, but the following error occurs on certain (mostly older) Android devices in Chrome:
Uncaught DOMException: Failed to execute 'postMessage' on 'Worker': Data cannot be cloned, out of memory
Fortunately I found a solution here in this thread (thanks @Evgeni_Popov), which suggests me to decrease the amount of workers for the KTX2 loader.
The thing is I don’t want to set the number of workers hardcoded to 1, because it drastically increases the loading times for most of the other devices / browsers, which would work with the default amount of workers anyway.
I could use something like the userAgent
to detect certain constellations though, but it feels not very convenient in general to overrule BabylonJSs default algorithm for evaluating the amount of workers for this specific constellation.
// => from BabylonJS source ()
// Use 50% of the available logical processors but capped at 4.
return Math.min(Math.floor(navigator.hardwareConcurrency * 0.5), 4);
My question is if someone has experienced similar issues concerning loading KTX2 textures in Android / Chrome and what could be possible solutions, besides explicitly setting the BABYLON.KhronosTextureContainer2.DefaultNumWorkers
variable to 1.
I didn’t append the GLB file to this thread in the first place because it contains potentially confidential data from a certain customer. If it’s required for the analysis I can clarify if I may upload it here into the forum.
Best regards and thanks for your support!