I am having an issue with the fbx loader and some models that I downloaded off the web…
as best I can tell, it is something to do with the scaling of the mesh against the bones that they are rigged with for animations … I imported some of the models that I’m having issues with into Blender and rescaled the mesh and bones, then after doing this for 3 models in a row I realized something cannot be right… so I downloaded 3dsMax, and the model rendered like this
and this is the code that I am using… I would be really grateful if someone could tell me the fix for the models, because there are over 300 of them and I dont think manually scaling all of them is the correct answer …
function LoadAnimatedModel(name) {
console.log(“LoadAnimatedModel”);
var loader = new FBXLoader()
.load(DigimonObjects[name].FilePath, function (object) {
console.table(object);
console.log(“object ^^^”);
// get required animation
console.log(object.animations)
// console.log("Available Animation ^^^")
for (var animateKey in object.animations) {
if (object.animations[animateKey].name.toLowerCase().indexOf("idle") > -1) { break; }
}
mixer = new THREE.AnimationMixer(object);
var action = mixer.clipAction(object.animations[animateKey]);
action.play();
object.traverse(function (child) {
if (child.isMesh) {
//add shadows
child.castShadow = true;
child.receiveShadow = true;
//make model solid
child.material.transparent = false;
}
});
object.scale.set(100, 100, 100);
object.position.set(0, 0, 0);
// object.name = name;
digimonObject = object;
scene.add(digimonObject);
});
}
also as a side question, I would be interested is anyone has any ideas on the fire effect on his wings, I have set “material.transparent = false” with obviously means that the fire is now solid…not the desired outcome
I didnt quite understand how to get the FBX2GLTF to work so I ended up just converting it online for now, just to test the theory … which seems to work when looking at the gltf-viewer
When I convert the model with FBX2GLTF I get this warning:
node /RootNode/prefab uses unsupported transform inheritance type 'eInheritRrSs'.
This is the same issue that I linked above. I think this is not possible to support in three.js, at least with reasonable effort. Mas0490 do you have any idea what program was used to create the FBX files?
The converted model looks fairly correct in the viewer.
However, there’s a whole lot of errors related to NaN values.
One other issue is that there are ten or so animations with this model, but it seems like one “spin” animation is playing constantly when I try to play the others so it’s hard to view them. This might be an issue in the viewer. @donmccurdy if you have some spare time would you be able to check out this model?
Good that it’s working! But checking out your converted model, you have a whopping 1486 errors in the viewer! The textures are gone too. The one I converted with FBX2GLTF has 86 so that’s a little better, and textures too.
You can download the latest FBX2GLTF here. Then drop the file in the same folder as your FBX file, open a command prompt and run this command (on windows):
.\FBX2glTF-windows-x64.exe -i .\chr776.fbx -b
For mac download the FBX2glTF-darwin-x64 instead of FBX2glTF-windows-x64.exe.
I’m not 100% sure but based on a comment made on the site I got the models from about the fact the .fbx files are all ASCII;
“This is the known issue for Unity Studio as it can only exports the models in ASCII fbx file format.”
I’m guessing Unity Studio? … but I also noticed in the viewer the spin animation issue, I worked out that if you tick and un-tick the first animation it stops playing, and then you can view the other animations… I dont experience any issue like it in threejs, so I think its something to do with the viewer?
yeah that was my bad with the online converter that I was using, I didnt zip the texture files in with .fbx file, thus losing the that
your the best, thank you for the how to on the converter, that worked perfectly…
I am curious though, it seems to not like the transparent fire on his wings, sword etc… is there extra parameters that I need/could add to get around this?
I think the cause is glTF-Viewer#194, when multiple animations have the same name the UI has some issues. If you first enable then disable the first attack01 animation, it behaves normally after that.
I tried using alpha test, it wasn’t until I set it to “child.material.alphaTest = 1;” that it removed some of the black lines around the wings, but seemed to completely ignore the sword etc still
so I ended up just, doing this, which seems to work for the most part