Textures in gLTF sometimes display black, but only on iOS

Thanks @niklasramo! The results of the CodeSandbox are, interestingly, very consistent for me – exactly 10 images load, and any additional images appear as black squares.

That seems like a strong sign that Safari has some kind of memory limit here, and any ImageBitmap textures exceeding that limit are rejected. Another interesting point is that if I add this line to the THREE.ImageBitmapLoader configuration…

const loader = new ImageBitmapLoader()
loader.setOptions({
  imageOrientation: 'flipY',
  resizeWidth: 512,
  resizeHeight: 512
})

…it’ll consistently load all of the textures every time on my iPhone.

Based on all that, I’d be fine with adding an option in GLTFLoader to disable the ImageBitmapLoader use, but I wouldn’t want to do it automatically – we don’t really know if the application is going to hit this memory limit in advance, and if it doesn’t then the performance benefits are probably worthwhile. I think it’d be worthwhile to report this to Apple, if only to find out exactly what is happening.

1 Like