How to use USDZ files with ARKit / SceneKit
Sep 8, 2018 · 1 min read
The .usdz format is a “universal” format, but the WWDC18 session does NOT show the concrete way to load 3D models from usdz files in ARKit or SceneKit projects.
Here is the way:
guard let url = Bundle.main.url(forResource: name, withExtension: "usdz") else { fatalError() }
let mdlAsset = MDLAsset(url: url)
let scene = SCNScene(mdlAsset: mdlAsset)That’s it. Anything is not special for the `usdz` format.
You will need
import SceneKit.ModelIOto initialize SCNScene from MDLAssset.
This implementation is available on iOS 10 or greater because USD format has been supported since iOS 10. You don’t need to wait for iOS 12.
MDLAsset currently supports following formats:
.abc.usd.usda.usdc.usdz.ply.obj.stl
