FBX Loader not loading some FBX files

Hi everyone, I guess I am the new guy here!

I’ve been working on a project that compiles FBX files into Unity Asset Bundles which currently works fine. I use three.js to display these FBX files on the browser, it works fine most of the time (We use MODO to export / design our models), I have noticed that some models will just not load and will display an this error on the console (Using Chrome, I get a similar error in FireFox):

Uncaught TypeError: Cannot read property ‘traverse’ of undefined

In this case my 3D model was never loaded from the FBX file, yet I am unsure why.

I am currently using revision 90dev.

Here are two working examples:
https://boxelizer.com/renderer.php?mid=5df8bdea3fee477dbcf0f30e55c2e362
https://boxelizer.com/renderer.php?mid=e2229d8d564143ccb1ac6bcc8944885d

And the non-working example:
https://boxelizer.com/renderer.php?mid=08e566c1eb83418687194c3334d8d227

Any suggestions? Have you ever bumped into this?

P.D. I edited the FBXLoader to look for my textures on a different folder (That works fine, and that’s the only thing I have modified) so FBXLoader.js and DexFBXLoader.js are almost the same thing, except for that little variation.

FBXLoader throws an exception when parsing the file of your non-working example:

TypeError: Cannot read property ‘split’ of undefined
at parseImages (https://boxelizer.com/js/loaders/DexFBXLoader.js:209:37)
at THREE.FBXLoader.parse (https://boxelizer.com/js/loaders/DexFBXLoader.js:103:17)
at Object.onLoad (https://boxelizer.com/js/loaders/DexFBXLoader.js:53:23)
at XMLHttpRequest. (https://boxelizer.com/js/three.js:30265:40)

parseImages() uses videoNode.Filename to access the path of the image. The problem is that videoNode only has a FileName property for your FBX file. This could be a problem of the loader (/cc @looeee).

@xedret Apart from that, you should always use the latest version of three.js and FBXLoader. In general, we are not supporting older versions of three.js. However, even the latest version of the loader uses videoNode.Filename.

Hey @Mugen87 thanks a lot, I for some reason my debugger doesn’t get to that point, I will try to fix that myself now that I have a hint on what’s happening (Will also update my files).

Should I submit the fix to the repo?

Also, what browser were you using to get that debug info?

I’m using Chrome.

Let’s see what @looeee thinks about this issue. He knows FBXLoader best.

2 Likes

I’ll take a look in the morning, this does sound like a bug to me.

2 Likes

@xedret is this the file you are having trouble with?

https://boxelizer.scishift.com/3d/assets/33967110dcec4454/b8302273f29150cd.fbx

I can’t get it to download, if you upload the model here I’ll take a look.

@looeee This would be one of the FBX files that I am having issues with:

https://boxelizer.com/assets/08e566c1eb834186/87194c3334d8d227.fbx

I am having a similar issue with some of my fbx files. Here’s the error I am getting on the error callback from the load function:

FBXLoader: FBX binary version: 7300  
TypeError: Cannot read property 'id' of undefined
at parseAnimationCurveNodes (index.js:2181)
at parseAnimations (index.js:2145)
at addAnimations (index.js:2358)
at parseScene (index.js:1516)
at FBXLoader.parse (index.js:100)
at Object.onLoad (index.js:45)
at XMLHttpRequest.<anonymous> (three.module.js:34809)

I’ve attached the fbx file here: atletismo2013.fbx (971.8 KB)

I am using latest threejs (0.108.0) with fbx-loader module (https://www.npmjs.com/package/three-fbx-loader)

My Fbx files should be fine. I have looked at them in Unity and FBX Viewer. Also tried different formats/versions binary/ascii to no avail.

three-fbx-loader - npm

Don’t use this. Use the official three.js loader from the main npm package called “three”.

1 Like

I noticed that my fbx was loading fine but nothing was showing up. I think it’s because my fbx had no animation. I removed the line in the example file, webgl_loader_fbx.html, and it worked after that. It won’t play animation now but it should load static files just fine. There’s a better solution but this is the problem.

// model
var loader = new FBXLoader();
loader.load( 'D9_printcab_1.fbx', function ( object ) {

	//mixer = new THREE.AnimationMixer( object ); // Comment this out

	//var action = mixer.clipAction( object.animations[ 0 ] ); // comment this out
	//action.play(); // comment this out

	object.traverse( function ( child ) {

		if ( child.isMesh ) {

			child.castShadow = true;
			child.receiveShadow = true;

		}

	} );

	scene.add( object );

} );
1 Like

@xedret. The discussion was very interesting. My problem is the part you’ve already solved at the first place! You have mentioned that you were successful in editing the FBXLoader in order to look into your texture path, rather than the current folder as the one the .JS file is located in. Great! Could you help me with your FBXloader modification please? I couldn’t figure out which part should be changed. I have already downloaded the one which is included in the r117. I’m pretty sure it should not be that different from the version you’ve already modified.
And everybody, if there is some other way to make FBXLoader check the texture folder, it’d be greatly appreciated if you let me know about it. FYI, this is the loader’s common reaction to almost any file it’s been given.

I’ll gladly share the modification I made to the loader with you, just send me an email to xedret@gmail.com

Thanks @xedret. I’ve already sent you the email. Many thanks.

I have the same issue like you when loading FBX file into the scene in ThreeJS.

TypeError: Cannot read property ‘attributes’ of undefined
at FBXTreeParser.createMesh (FBXLoader.js:1250)
at FBXTreeParser.parseModels (FBXLoader.js:919)
at FBXTreeParser.parseScene (FBXLoader.js:832)
at FBXTreeParser.parse (FBXLoader.js:175)
at FBXLoader.parse (FBXLoader.js:147)
at Object.onLoad (FBXLoader.js:95)
at XMLHttpRequest. (three.module.js:36508)

Can you share the solution with me? My email address is hilight111@yahoo.com