11

Apple AR Quick Look apparently only supports .usdz files. Is there a way to convert an .obj or .stl to .usdz?

I googled this first but the most popular result was to use a free tool called Vectary, but when I actually tried to use it, it wasn’t free.

General Grievance
  • 4,555
  • 31
  • 31
  • 45
yogurtsyum
  • 348
  • 1
  • 2
  • 17
  • Possible duplicate of [How to create a USDZ file?](https://stackoverflow.com/questions/50686813/how-to-create-a-usdz-file) – jlsiewert Sep 15 '19 at 09:02

6 Answers6

9

With iOS 13 & Reality Kit, Apple has released a USDZ converter that does not require Xcode; the converter is a Python based tool. I have been using it the last few days to convert various files gltf, obj files.

Download link:

https://developer.apple.com/download/more/?=USDPython

Example usage:

usdzconvert someobject.obj  

You will want to edit paths for your environment variables.

Or double click the file which is in the top level of the folder:

USD.command

to launch a shell with the environment variables set.

And within Xcode 11, you can export SCN files to USDZ files.

It is well worth watching the WWDC 2019 video; it is just over 30 minutes:

https://developer.apple.com/videos/play/wwdc2019/602/

M. Bedi
  • 1,087
  • 10
  • 15
  • On the usdpython and macOS Big Sur it doesn’t work with the env variable double clicking on the usd.command. I got pxr module error and env var PaTh not set up. Any help? – Alberto Tono Jan 15 '21 at 03:47
4

If you're using Xcode 12 and Xcode 11, you can utilise the following command in Terminal:

usdzconvert ~/Desktop/file.obj

usdzconvert command is a Python script that converts .obj, .gltf, .fbx, .abc, .usda, .usdc, and .usd assets to usdz.

And if you wanna use this command in Terminal, you need to download usdz Tools from HERE.

enter image description here


In case you're using Xcode 10, type the following command in Terminal:

xcrun usdz_converter ~/Desktop/file.obj ~/Desktop/file.usdz

For further details look at THIS POST and THIS POST.

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220
  • Is it possible to you the Python script in Linux, is there a way to try it without having the Apple Developer account? – Alberto Tono Jan 13 '21 at 07:30
  • Hi @AlbertoTono. What for? – Andy Jazz Jan 13 '21 at 07:44
  • To run on a server and offer it as conversion service?! – Alberto Tono Jan 13 '21 at 07:49
  • Yes, you can try it without having Apple Developer's account but only for testing purpose. There's no way to distribute it. – Andy Jazz Jan 13 '21 at 07:57
  • How can I download it without an Apple developer account, on devices not iOS, I am trying on my Linux machine and I am having issues. – Alberto Tono Jan 13 '21 at 08:00
  • Download what? I don't entirely understand what you mean... – Andy Jazz Jan 13 '21 at 08:01
  • USDPython for USDZconveter. – Alberto Tono Jan 13 '21 at 08:02
  • https://developer.apple.com/download/more/?=USDPython – Alberto Tono Jan 13 '21 at 08:03
  • Ok. If you need `usdz Tools`, `USDPython`, etc, all you need is a free Apple ID to log in into `developer.apple.com` resource. There's no need to use $99 Apple Developer Account to use this tools. Xcode 12 with preinstalled `usdzconvert tools` and Reality Composer app is also free. – Andy Jazz Jan 13 '21 at 08:09
  • I think you need to have an iOS device unfortunately. – Alberto Tono Jan 13 '21 at 08:33
  • `USDZ` is for SceneKit and RealityKit frameworks. These two can be used for macOS development. I think you don't need an iOS device in that case. Also Xcode has a macOS and iOS Simulator... – Andy Jazz Jan 13 '21 at 08:47
  • Yes, you need macOS to use it. You can’t download from a Linux machine. – Alberto Tono Jan 13 '21 at 13:15
  • With a MacOS device I am having issues in setting up the env variables. I follow your great suggestions @AndyFedoroff but still I get Error of pxr module and python bindings. – Alberto Tono Jan 15 '21 at 03:45
  • Hi @AlbertoTono! I've been using `usdz Tools` since Xcode 10 release and there's no issues (except `usdzconvert 0.63` but I wrote about it here – https://stackoverflow.com/questions/50846627/how-to-create-usdz-file-using-xcode-converter/50867018#50867018). – Andy Jazz Jan 15 '21 at 05:33
  • Did you try also on the new MacBookPro with M1 and Big Sur 11? – Alberto Tono Jan 15 '21 at 05:44
  • Not yet, but it seems it's OK. I have not seen any complaints from developers. – Andy Jazz Jan 15 '21 at 05:49
  • I keep getting the pxr module error and PATH bindings even if I set up the PATH following also your instructions and the one in the readme. – Alberto Tono Jan 15 '21 at 06:03
  • 1
    I tested with other 2 devices not M1 and it is working well for those. On the USDZ specification of Pixar they mentioned that they tested with Intel for the 64 byte alignment. – Alberto Tono Jan 15 '21 at 23:45
2

If you're using Xcode, this is the easiest solution

Open the file in Xcode, then go to File > Export... and choose the file type (.usdz is 'Universal Scene Description (Mobile)'):

Exporting as <code>.usdz</code>

FuturrCoder
  • 307
  • 3
  • 7
1

Apple released a tool called Reality Converter that has an interface which allows you to convert your .obj, .gltf and .usd files into .usdz

Check it out: https://developer.apple.com/news/?id=01132020a

devontoast
  • 11
  • 1
0

Anything you upload to sketchfab.com is automatically converted to usdz (and gltf), and Sketchfab supports more than 30 formats as an input, including obj, fbx, stl, dae, blend...

Alban
  • 1
0

In case you want to convert on the device (no XCode required):

import modelIO
import SceneKit
let asset = MDLAsset(url: objURL)
let scene = SCNScene(mdlAsset: asset)
scene.write(to: usdzURL, delegate: nil, progressHandler: nil)

This might not work for everyone since it did not load the materials properly. In my case, it was not a big issue to manually set the materials in RealityKit. I also do not know how it handles animations. Another poster mentioned converting to .usdc and renaming to .usdz but I could not get this to work. (link here)

Other ways to convert to .usdz: https://www.marxentlabs.com/usdz-files/