Right now I can save what I created in ARKit as a scene file, and load it back later.
sceneView.scene.write(to: path, options: nil, delegate: nil, progressHandler: nil)
But is it possible to save the scene as USDZ file and load it back?
Right now I can save what I created in ARKit as a scene file, and load it back later.
sceneView.scene.write(to: path, options: nil, delegate: nil, progressHandler: nil)
But is it possible to save the scene as USDZ file and load it back?
First of all, read the following SO post that is very helpful.
In SceneKit, there's the write(to:options:delegate:progressHandler:)
instance method that does the trick (the only thing you have to do is to assign a file format for URL).
let path = FileManager.default.urls(for: .documentDirectory,
in: .userDomainMask)[0]
.appendingPathComponent("model.usdz")
sceneView.scene.write(to: path)
However, if you need to convert OBJ
model into USDZ
, you have to import SceneKit.ModelIO
module at first. Then use the following code:
let objAsset = MDLAsset(url: objFileUrl)
let destinationFileUrl = URL(fileURLWithPath: "path/Scene.usdz")
objAsset.exportToUSDZ(destinationFileUrl: destinationFileUrl)
In Xcode 15/14/13/12/11, you can convert several popular input formats into USDZ via command line: obj
, gltf
, fbx
, abc
, usd(x)
.
usdzconvert file.gltf
In Xcode 10, only OBJ-to-USDZ
, single-frame ABC-to-USDZ
and USD(x)-to-USDZ
conversion is available via command line:
xcrun usdz_converter file.obj file.usdz
In Xcode 15+ you can use a Reality Composer Pro software for converting any RCP scene into usdz
file format (right from UI). Also, there's a Reality Converter standalone app.
And, of course, you can use Autodesk Maya 2024 with Maya USD plugin.