GLTF Loader couldnt load texture

Hi!

Im trying to allow users to upload glb file and then display it in a three.js scene. However, this error keeps popping up: “THREE.GLTFLoader: Couldn’t load texture” “blob:https://cdpn.io/3e9a4c4e-00c9-42ff-b21a-81f9e229aed7

I’ve tried uploading the same glb file on other glb/gltf viewers online, and they work fine. What seems to be the problem here?

Codepen: https://codepen.io/cwee/pen/eYozaQW

Thanks!

It’s possible the texture is compressed. To make a robust GLTF loader, you will need to augment the loader with DRACO support, Meshopt support, and KTX2 texture compression support. Check out these links:

https://threejs.org/docs/#examples/en/loaders/DRACOLoader

https://threejs.org/docs/#examples/en/loaders/KTX2Loader

There is a way to set up your GLTFLoader to support all of these things, by including the correct loaders and extending the GLTFLoader with them.

I see, thanks! will definitely check those links out. Do you have any hacky suggestions to accomplish this though?

Look through the source here: or perhaps consider embedding that viewer into your app instead of rolling your own?