FBXLoader could not load material

My artist give me a box in FBX format, and I put it in unity and see it looks OK,
but when I load the FBX file using FBXLoader, the box shows all black like this:

I don’t know much about FBX format, but in unity, the material is reference a 01.psd picture, which is beside the fbx file, so maybe three.js does not suporte .psd format file ?

Right, three.js can’t process PSD files. Try to use image formats like JPEG or PNG (if you need transparency).

1 Like

Another thing I want to know is , when I loaded the fbx model, then I call object.geometry.computeBoundingBox(), and then scene.add(object) , the model whill disappear :astonished:
if I remove the computeBoundingBox() line, everyting works fine, but I could not get my model size this way

That is surprising — are there no errors in the JS console? Could you create a demo or share code?

I could not upload the fbx file, but I can confirm the geometry property is undefined when the model is loaded.
I use code:

             new THREE.FBXLoader().load( 'model/2.fbx', function ( object ) {
				console.log("PaiTai0 loaded")
				console.log(object) // see below
				console.log(object.geometry) //undefined 
				scene.add( object );

			} );

the object is print as below:

So, does it means the original fbx file does not contains geometry ?

there is also a SO question from other people https://stackoverflow.com/questions/28614101/mesh-doesnt-have-geometry-three-js

Your ‘object’ variable is a THREE.Group rather than a THREE.Mesh. This group has mesh as children which you can see in the children array.

You will need to traverse your model in order to find the node that are Meshes with geometry before calculating the bounding boxes. on them.

1 Like

But I found the boundingBox 's size is not changed when I scale the mesh, with your code, before or after I set mesh scale, the result is the same, so, am I lost something ?

The bounding box for the geometry will not change as the scale changes. You would need to multiply your bounding box by your scale in order to get the new value.

It sounds like what you really want is a BoxHelper, which you add your base object to and it calculates the box around the object and it’s children, taking the transforms into account:

1 Like