pmndrs / react-three-offscreen

📺 Offscreen worker canvas for react-three-fiber
https://offscreen.pmnd.rs
MIT License
456 stars 19 forks source link

Error while loading glb #5

Closed samevision closed 1 year ago

samevision commented 1 year ago

Hi,

I encountered an error while migrating my scene to offscreen. The error appears if I try to load a glb via useGltf. It is glb specific since I can load some other models without any issues.


react-reconciler.development.js?1cbc:19034 Uncaught Error: Could not load /mesh.glb: Image is not defined)
    at eval (webpack-internal:///(app-client)/./node_modules/@react-three/fiber/dist/index-bb759d07.esm.js:1667:36)
    at _onError (webpack-internal:///(app-client)/./node_modules/three-stdlib/loaders/GLTFLoader.js:72:9)

Unfortunately I cannot share the model.

Any ideas?

Best

drcmda commented 1 year ago

i saw that, when i used gltfjsx with compression. when exporting directly out of blender it worked. im guessing it still relies on something that does not exist in the context of a worker, but would need a deeper study to see if it can be shimmed.

drcmda commented 1 year ago

should be semi-fixed. i shimmed the Image class which three uses to detect webp and/or avif support. im guessing that if either of those isn't supported it will fail anyway.