Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FBXLoader failure #11973

Closed
makc opened this issue Aug 17, 2017 · 34 comments · Fixed by #12004
Closed

FBXLoader failure #11973

makc opened this issue Aug 17, 2017 · 34 comments · Fixed by #12004
Assignees

Comments

@makc
Copy link
Contributor

makc commented Aug 17, 2017

TypeError: Cannot read property 'children' of undefined
    at parseMaterial (http://super/3d/js/loaders/FBXLoader.js:434:43)
    at parseMaterials (http://secret/3d/js/loaders/FBXLoader.js:403:20)
    at THREE.FBXLoader.parse (http://web/3d/js/loaders/FBXLoader.js:120:20)
    at http://server/3d/js/loaders/FBXLoader.js:59:23
    at XMLHttpRequest.<anonymous> (https://cdnjs.cloudflare.com/ajax/libs/three.js/86/three.js:29871:21)

I am trying to find what file was that.

@makc
Copy link
Contributor Author

makc commented Aug 18, 2017

They say it was this one.

@takahirox
Copy link
Collaborator

I don't really wanna sign up that site.
Can you (personally) share the file with us?

@makc
Copy link
Contributor Author

makc commented Aug 19, 2017

Let's see... looks like I can: Dentist's office.FBX.zip

@takahirox
Copy link
Collaborator

Thanks. I confirmed. I'll look into...

@takahirox
Copy link
Collaborator

I ran into the same error even I converted the file to ascii with Autodesk FBX Converter.
So probably it isn't a binary parser issue.

Seems like missing some connection data.
Can the file be loaded with other libs/viewers?

@makc
Copy link
Contributor Author

makc commented Aug 19, 2017

I asked them if the file may be truncated (as in: broken download). They said:

I tried the model on the desktop 3D viewer on windows and it opened fine

I tried the same to confirm, and my autodesk viewer does not claim any error:
screen shot 2017-08-19 at 11 09 00

@takahirox
Copy link
Collaborator

OK, I see.

I speculate the file includes unused materials which don't have any connections.
Probably we can ignore them.

Would you please try FBXLoader in my branch that I updated?

https://github.com/takahirox/three.js/blob/FixFBXLoader/examples/js/loaders/FBXLoader.js

@makc
Copy link
Contributor Author

makc commented Aug 19, 2017

Can't test the project atm, but FBXLoader does now call onLoad with the file, at the very least.

var loader = new THREE.FBXLoader;
loader.load ('Dentist\'s%20office.FBX', function (done) {
	console.log (done);
}, undefined, function (crap) {
	console.log (crap);
});

Btw, getting a bunch of warnings here

THREE.MeshBasicMaterial: 'emissiveIntensity' is not a property of this material.
THREE.FBXLoader: No implementation given for material type unknown in FBXLoader.js. Defaulting to basic material.

@looeee
Copy link
Collaborator

looeee commented Aug 19, 2017

These two at least are very common and pretty self explanatory.

No implementation given for material type unknown in FBXLoader.js. Defaulting to basic material

THREE.MeshBasicMaterial: 'emissiveIntensity' is not a property of this material.

However given how common this is I think it would be more useful if the default was something other than MeshBasicMaterial.

@looeee
Copy link
Collaborator

looeee commented Aug 19, 2017

By the way I've tried importing this into 3ds max and then re-exporting and it loads

dentists-chair

Both files are the same FBX version (7400), however interestingly the re-export is much larger (44mb vs 22mb)

I can't attach the re-exported file here as it's too big (it says there's a limit of 10mb, so how did @makc attach the original? 🤔 ).

@makc
Copy link
Contributor Author

makc commented Aug 19, 2017

@looeee Idk, I just dropped the zip into the input field. maybe you are emailing it, and it's your email limit?

@makc
Copy link
Contributor Author

makc commented Aug 19, 2017

@looeee still, I cant get textures on 20 mb model:
screen shot 2017-08-19 at 18 26 56

they are loaded but do not show up. was it the same for you before you re-exported?

@looeee
Copy link
Collaborator

looeee commented Aug 19, 2017

@makc nope, was uploading on github on Chrome. It popped up an error saying I should try again with a file less than 10mb.

If you want I can share the file with you via Dropbox.

As for loading the original file, I was testing it on my loader here. It showed the same errors as you, then spewed a few more errors, something about textures but it crashed my console window before I could copy them.

From memory they were something like

Data64:blablabla..... Couldn't load texture someurl/door-fexture.jpg

@takahirox
Copy link
Collaborator

About default material, agreed.
I think MeshStandardMaterial would be better.

@makc
Copy link
Contributor Author

makc commented Aug 19, 2017

@takahirox and what about textures? how come they are loaded (network tab says so) but do not make it into materials? is it because the property name is not 'map' (for MeshBasicMaterial) ?

@takahirox
Copy link
Collaborator

What are the texture names?

@makc
Copy link
Contributor Author

makc commented Aug 19, 2017

There are too many of them:
screen shot 2017-08-20 at 1 56 13

it also says this a lot:
screen shot 2017-08-20 at 1 57 24

(this is with the loader from your repo fork)

@takahirox
Copy link
Collaborator

What I wanna know are not image files but texture names like "3dsMax|maps|texmap_reflectionGlossiness"

@makc
Copy link
Contributor Author

makc commented Aug 20, 2017

those I can only see in warnings, I did not make the file :) there are:

  • 3dsMax|maps|texmap_reflection
  • 3dsMax|maps|texmap_diffuse
  • 3dsMax|maps|texmap_bump
  • 3dsMax|maps|texmap_reflectionGlossiness

on repeat, not sure if I missed others

@makc
Copy link
Contributor Author

makc commented Aug 20, 2017

missed 3dsMax|maps|texmap_refraction

@takahirox
Copy link
Collaborator

Oops, they aren't texture names but parameters in connection that we call relationship. Anyways, they're what I wanted to know, thanks.

Currently we recognize the valid textures by using perfect match with only some types.

Probably we'd be better to do partial match with more types.

@takahirox
Copy link
Collaborator

takahirox commented Aug 20, 2017

I've update FBXLoader in my branch. Would you please try again?

Not sure how reflection[Glossiness] should be handled tho.
Is that for roughness? Or envMap?
I handle it as envMap so far.

And I ignore refraction so far.
If I'm right, it'd be for refraction of env map but Three.js doesn't support refractionMap yet both reflection and refraction at a time but just either one.

@makc
Copy link
Contributor Author

makc commented Aug 20, 2017

env map but Three.js doesn't support refractionMap

then what do you think are these:

THREE.CubeRefractionMapping
THREE.EquirectangularRefractionMapping

@takahirox
Copy link
Collaborator

They aren't texture settings.

@makc
Copy link
Contributor Author

makc commented Aug 20, 2017

ORLY?

@takahirox
Copy link
Collaborator

Ah, I meant they aren't textures themselves but texture mapping parameters.
I'm not sure how to apply the textures which indicates 'refraction'.

For examples, the bump textures should be set to material.bumpMap but where refraction textures set to?

@makc
Copy link
Contributor Author

makc commented Aug 20, 2017

The answer was in the same demo :)

The property names might differ for different materials, check the docs.

@takahirox
Copy link
Collaborator

takahirox commented Aug 20, 2017

Wait, doesn't a material have both reflection and refraction textures in FBX file?
I already set reflection texture to envMap so I'm not where refraction texture set to.
reflection is not for envMap but for others? (roughness?)

Can you list up what textures each material uses in the FBX file? Like

  • material1
    • 3dsMax|maps|texmap_reflection
    • 3dsMax|maps|texmap_diffuse
  • material2
    • 3dsMax|maps|texmap_reflection
    • 3dsMax|maps|texmap_refraction
      ...

@makc
Copy link
Contributor Author

makc commented Aug 20, 2017

Now that, I think, 3js does not support ootb. @mrdoob or anyone feel free to correct me.

@takahirox
Copy link
Collaborator

What's ootb?

@makc
Copy link
Contributor Author

makc commented Aug 20, 2017 via email

@takahirox
Copy link
Collaborator

Updated my comments above to clarify.

@makc
Copy link
Contributor Author

makc commented Aug 21, 2017

Can you list up what textures each material uses in the FBX file? Like

no, I am not fbx wizard or anything ) I see the same file you do, and have no more information about this file than you have.

@takahirox
Copy link
Collaborator

Can you open another issue for FBX texture handling enhancement?
I wanna fix the original "loading failure" issue and close this thread for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants