8

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?

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220

5 Answers5

8

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.

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220
  • 1
    This is the good answer. Just for people to know though: vertices order may not be preserved when converting from FBX to USDZ using this tool. It may sound harmless at first, but this can break your morphing. – David Peicho Feb 06 '20 at 14:10
  • 3
    Did you manage to do FBX-> USD or SCN preserving morph targets? I tried both Reality Converter and USDZ Tools, but both don't export Morph Targets... – Mane Manero May 15 '20 at 13:15
  • Sorry @ManeManero, I can't say anything about morph targets... – Andy Jazz Jun 16 '20 at 17:23
  • 1
    I couldn't manage to keep morph target. What I did is too pre-process the model with a Blender script exporting the morph targets as separate objects. I then create the morph targets myself. It's not a good solution, but better than nothing – David Peicho Jan 08 '21 at 14:25
  • @AndyJazz , sorry to ask a lame-ass lazy question. If one also has .dae (collada, as they say) files, there's no need at all to bother converting? or would you say it's better to end up with .usdz ? TY for your input! :) Cheers .. – Fattie Jan 11 '23 at 13:18
  • 2
    @Fattie, if you're working with SceneKit, then you shouldn't think about converting DAE to USDZ, because DAE in SceneKit is native, and it has a little bit more functionality than USDZ. In RealityKit, however, a reasonable choice would be to use the REALITY format or USDZ format. – Andy Jazz Jan 11 '23 at 13:36
  • 1
    @AndyJazz - it makes perfect sense, thanks for the generous answer! :) – Fattie Jan 11 '23 at 13:39
  • 1
    @AndyJazz - challenging :/ https://stackoverflow.com/questions/75087078 – Fattie Jan 11 '23 at 17:46
4

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!

vfxdev
  • 678
  • 6
  • 13
2

You can download Reality Converter app from Apple. This allows converting fbx to usdz.

Ozgur Sahin
  • 1,305
  • 16
  • 24
1

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

M Reza
  • 18,350
  • 14
  • 66
  • 71
1

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)

ZAY
  • 3,882
  • 2
  • 13
  • 21