#GLTFLoader not loading a .glb properly after updating loader

10 messages · Page 1 of 1 (latest)

dawn rock
#

After Updating threejs and GLTFLoader version from threejs r125 -> r156 this glb object is getting imported into the scene without texture and size is getting to large. I mentioned that I updated my threejs version because the model used to load correctly before.😩

  • Some glbs are getting loaded properly
sand sparrow
#

the material is missing because three.js has removed support for the spec/gloss glTF extension. You can update the model to metal/rough PBR by dropping it into https://gltf.report/, accepting the prompt, and then exporting again.

dawn rock
#

is there a way to do this at some step in loading time? The other think is this object getting to large into the scene, is like 1000 times bigger than other objects

sand sparrow
# dawn rock is there a way to do this at some step in loading time? The other think is this ...

Yes, but i think you'll find it's slower than you'd like, as it involves editing your textures. See https://stackoverflow.com/a/75889212/1314762

#

I'm not aware of any reason the scale would be different between those two versions. Fixing the materials might resolve that. But if not... you may just need to scale the model down, I would think it's more likely that newer three.js versions are correct on scaling.

#

If you're using THREE.Box3 or other bounding box methods to scale things, those have been updated in newer versions to support THREE.SkinnedMesh better, and could be related.

dawn rock
#

yes, at some point I am using Box3 var box = new THREE.Box3().setFromObject( model );
let center = new THREE.Vector3();
box.getCenter(center);
this.bounds = {
min: {x: box.min.x, y: box.min.y, z: box.min.z},
max: {x: box.max.x, y: box.max.y, z: box.max.z},
center: {x: center.x, y: center.y, z: center.z}
}

sand sparrow
#

Ok, yeah I think it's likely that the bbox is just accounting for skinning data and wasn't before, if it seems to be incorrect in the latest version of three.js you could file a bug.

#

But in general that's finicky, e.g. the scale of the model (not just it pose) could change when animation is played on a SkinnedMesh... so you may just want to figure out the right scale yourself here.