I'm trying to figure out how to add animations from external files into a GLTF model file, server-side. Currently, I use threeJS to load the GLTF model into a website and FBXLoader to add animation from external files, which works perfectly. To enable use in Web AR like the Google model-viewer, I would like to merge these into a single GLB or GLTF file via script. I was looking into NodeJS gltf-pipeline or Python pygltflib library which looked promising, but I didn't find a way to include animations.
Does anyone have a solution on how to do this with NodeJS or Python, without an app like i.e. Blender?
In my project I'm positioning 3d files using ARKit. I'm able to load .dae and .obj format models.
Is there any way I could load .fbx files?
Updated: 14th January, 2023.
Info about .FBX conversion you can find HERE.
ARKit is not capable of loading 3D models in a scene. It's a job for SceneKit or RealityKit. However both frameworks don't directly support .FBX file format. You can implement a reading of .FBX file format via ModelIO but it's a real challenge for any developer, because you need to figure out how to deal with hierarchies, materials, lighting, animation, etc.
The best way to prepare your model to work in SceneKit and RealityKit is to convert it into .USDZ file via usdzconvert command found in Xcode's command line tools. To convert .FBX file into .USDZ just execute the following command in Terminal:
usdzconvert ~/Desktop/fileName.fbx
There are also additional flags for applying render passes generated in 3D package:
usdzconvert fileName.fbx -diffuseColor albedo.png
-opacity transparent.png
-metallic chrome.jpg
-roughness rough.jpg
-normal bump.png
-occlusion ao.jpg
-emissiveColor emit.png
-clearcoat varnishing.jpg
-clearcoatRoughness ungloss.png
To use this command line conversion tool, download USDZ Tools from Apple developer resource and FBX Python SDK from Autodesk developer resource. Don't forget to setup a global variables in macOS.
If you prefer GUI, use Reality Converter app.
June 2020
To convert FBX to USDZ you need the usdzconvert utility from Apple. To get it to work, read the install instructions carefully.
You will need both the "FBX Python SDK" and the "FBX Python Bindings" from here.
Please note that the current (June 2020) version of the FBX Python SDK is 2020.1, so you'll have to change the following line in USB.command
# export PYTHONPATH=$PYTHONPATH:/Applications/Autodesk/FBX\ Python\ SDK/2019.0/lib/Python27_x86
to
export PYTHONPATH=$PYTHONPATH:/Applications/Autodesk/FBX\ Python\ SDK/2020.1/lib/Python27_ub
To use usdzconvert, double-click /Applications/usdpython/USD.command and type usdzconvert into the terminal that opens up.
That's it!
You can download Reality Converter app from Apple. This allows converting fbx to usdz.
Try using AssimpKit to use your fbx file in a SceneKit scene.
AssimpKit currently supports 29 file formats (including fbx) that allows you to use
these files directly in SceneKit without having to convert these to
any of the files that SceneKit or Model IO supports thereby saving an
extra step in your asset pipeline.
Other supported file formats:
3d, 3ds, ac, b3d, bvh, cob, dae, dxf, ifc, irr, md2, md5mesh, md5anim,
m3sd, nff, obj, off, mesh.xml, ply, q3o, q3s, raw, smd, stl, wrl, xgl,
zgl, fbx, md3
You cannot use FBX directly in XCode/Scenekit (or at least not yet).
You need to convert the file ether to .obj or (what I prefer) .dae
Using i.Ex Blender as conversion tool works usually without any issues.
Then you can, if you desire, convert it to a .scn file from XCode directly. (according to Apple a .scn file has a smaller size and loads faster)
AssetBundle files of unity contain various types of data, such as mesh, texture and animation, etc. I want to export the mesh and animation data from an assetbundle file into common use format such as .fbx, then I can load the data into Android platform and implement the skeletal animation using JAVA. With the help of Unity Studio, I can export the mesh data from assetbundle file into .fbx format file. However, I can not find any animation data from the exported .fbx file. After exporing an assetbundle file using Unity Studio, I found that the animation data that I want to export is stored using animationclip type. However, the Unity Studio only supports exporting the raw file, which is .dat format. I have no idea how to parse this file outside using Java or C++. So my question is, how can I export the animationclip data from assetbundle into ASCII file, or how can I export fbx models from assetbundles with animation? I would be greatly appreciated if someone could help me.
I have been trying to export a skeletal animation, from Maya 2013 to THREE.js for quite some time, and I haven't seen this exact issue come up yet...
After getting frustrated for it not working. I resorted to copy and pasting the monster example then placing it with my model, my model has lost its animations. :( I baked them and everything when I exported in FBX-DAE.
I do get a warning but i don't know if it matters:
could not find transform "visibility" in node joint1.
Have you tried the OpenCOLLADA exporter?
There's a new project under way that might be of interest to you. Export path would be Maya > OpenCOLLADA > gltF > Three.js
Here's the glTF loader for Three.js:
https://github.com/KhronosGroup/glTF/tree/master/loaders/threejs
Do you have to have it in a Collada format? How about if you could export an animation from Maya directly to .JS?
You might be aware that THREE.js comes with an exporter for Maya, but it only works for static models. I have created an updated version that also supports exporting rigged and animated models. It doesn't require any intermediate steps: it just outputs straight to a .JS file. We have a pull request to integrate the updated exporter with the THREE trunk, but if you want to get the new and improved exporter immediately you can get it from this repository: https://github.com/BlackTowerEntertainment/three.js/tree/maya_animation_exporter. The exporter files are in utils/exporters/maya.
Hope this helps.
I have a simply question and hopefully someone can answer this. I need to get an animated model into three.js from Maya. I know currently the only exporter/ converter to the three.js JSON format that supports animations is the blender plugin. Unfortunately, my company works with Maya and Blender doesn't take FBXs. I already figured out that in order to do what I need to do, I need to export out of maya a Collada, import the Collada into Blender, then export out to three.js using the plugin.
But here is my problem. When importing the dae file from maya, I get an error:
Sax FWL Error: Could not resolve sid "**" referenced in skin controller.
for each bone in the rig and nothing is connected properly.
I also tried exporting the fbx from other Autodesk applications but each one gives me the same errors.
Anyone know either how to resolve this error or another way to get a Maya animated rig into blender without error.
It may not answer your question but this two animations from the three.js repository use collada .dae format instead of JSON format supported by the ColladaLoader.js:
http://threejs.org/examples/webgl_loader_collada.html
http://threejs.org/examples/webgl_loader_collada_keyframe.html
I have created an updated version that also supports exporting rigged and animated models. It doesn't require any intermediate steps: it just outputs straight to a .JS file. We have a pull request to integrate the updated exporter with the THREE trunk, but if you want to get the new and improved exporter immediately you can get it from this repository: https://github.com/BlackTowerEntertainment/three.js/tree/maya_animation_exporter. The exporter files are in utils/exporters/maya.