I have recently moved my Three.js application from running on the main thread to an offscreen canvas. The lag seems to have improved significantly.
However the issue I am facing is that with loading GLB files into the scene. Since the THREE.GLTFLoader()
kept throwing errors such as "Reference Error: Image not found"
, I have deiced to load the model in the main thread, pass the array buffer (transferable object) into the worker thread and then parse it using gltfloader.parse
. But, on using the .parse function, the onload callback is never executed.
Wanted to understand, if this is in fact a good approach? Or do I need to use a polyfill to fill in some DOM events expected by the gltf loader. Any reference example? Any help will be appreciated.
Thanks in advance!
Edit: I have added a placeholder Image() class in my worker. But now, the error has changed to ‘THREE.GLTFLoader: WebP required by asset but unsupported.’