Hello, I have a problem that when loading a model using GLTFLoader, one of the models crashes with an error. new Image() is not available in worker, and I have everything done through offScreenCanvas. Should I remove the special textures from the model or is there a solution?
The EXT_texture_avif
and EXT_texture_webp
glTF extensions are not supported in Web Workers with GLTFLoader
.
If you want to go that route, you need an updated version of the glTF asset that does not use the above extensions. Alternatively, you could use a custom version of GLTFLoader
that implements both extensions with Web Worker support.
@donmccurdy Do you think we still need to explicitly test support for WebP? The detectSupport()
is the one that relies on Image
which isnāt supported in Workers.
According to caniuse, WebP support looks excellent nowadays.
@Mugen87 Iād be fine with removing the WebP check ā yes. I think if users need to support these much older browsers they can create compatible versions of their assets. For AVIF maybe the same is true? Letās just test that on the modern/evergreen browsers, I havenāt done much with AVIF so far.
According to caniuse AVIF is a so called āBaseline Featureā since January 2024. That means all latest devices and major browsers support it.
It seems we can risk removing the check for both WebP and AVIF. If someone complains, we can restore the check for AVIF.
For future readers: The support detection of WebP and AVIF has been removed from GLTFLoader
starting from r176
. Respective PR:
The former usage of the Image
API should not cause any issues in Web Workers anymore.