Trying to load multiple fbx in a function, i try different ways to do that in same function, separate functions, same loader, different loaders, etc. but nothing seems to work and the result is same it only loads the first .fbx. This is the code that i have:
function loadModels(){
//model1
var loader1 = new THREE.FBXLoader();
loader1.load( 'models/model1.fbx', function ( model1 ) {
scene.add( model1 );
} );
//model2
var loader2 = new THREE.FBXLoader();
loader2.load( 'models/model2.fbx', function ( model2 ) {
scene.add( model2 );
} );
animate();
}
i'd made a post on stackoverflow and after some answers, i realize that its a problem on the last version released, because on the r93 and r94 i can load more than one object. This is a problem for me cause i need the animation too and in older version is not included.
This should already be fixed in the latest dev version of FBXLoader. See the respective PR: #14607
Please try it with: https://github.com/mrdoob/three.js/blob/dev/examples/js/loaders/FBXLoader.js
Ok i didnt see that, sorry. But now it loads all the model but they arent animated. Also some of the materials arent good.
This is with r95 FBXLoader in the right lower corner you can see the arrow which is another fbx:
https://imgur.com/uhoG1C0
And this is with the new version that you pass me, the arrow is in the right corner but animation is really slow and the materials of the obj are not right:
https://imgur.com/ERaoUf1
Can you share your models?
Cant, but seeing that the only thing that im doing is changing the FBXLoader version it shouldnt be a problem on the models.
Unfortunately there's not much I can do based on the information you have provided so far, but if you can find a model that shows the problem and that you can share, I'll take a look.
After some testing of loading differents .fbx and .obj. could be the cameras of the .fbx that make this effect https://imgur.com/ERaoUf1 ?
Some of the fbx has his own camera.
Seems unlikely, since the cameras are not used by default. How about you make a version of the file with just one pipe or boiler, verify that it still has the problem, and share that?
camara.FBX.zip
The problem seems to be this fbx that iluminate all the place.
Thanks! I'll take a look in the morning.
@turkoz14 there's nothing except for a camera in that file. As I already mentioned, the camera is unlikely to be an issue here. Please share a model that illustrates the bug.
put another object, no matter which one it would be iluminated cause of the camera.
There's also an ambient light, perhaps that's the problem? However the FBXLoader has been creating ambient lights for a while now, that hasn't changed since the last release.
Does it look correct to you if you don't add the ambient light to your scene?
Yes, I just saw that. I remove it and now is looking good. Thanks.
Now I'm having a problem with this animated FBX
Arrows.zip
Im using OrbitControls to zoom in/out and when i tried to zoom in really near they disappear. Is not a problem of the near parameter of camera cause i have another object on the scene and it renders ok. Also add frustumCulled = false, renderOrder = 100 and set the material of the objects to THREE.DoubleSide and nothing seem to change that.
Is there another thing to check ?
test.zip
here i upload a test project so you can check it.
Thanks!
Make a post on the forum and we can discuss this there: https://discourse.threejs.org
I'm closing this issue now since the original problem was solved.