piemonte / obj2usdz

🦖 obj2usdz, convert .OBJ files to .USDZ on iOS
MIT License
64 stars 8 forks source link

Using SCNScene's native USDZ writer #2

Open cpheinrich opened 3 years ago

cpheinrich commented 3 years ago

In case its useful for anybody else, I wanted to call out that since the 2019 WWDC it's now possible to write USDZ files natively using SceneKit. To convert obj to USDZ you would do

import SceneKit
import ModelIO

let asset = MDLAsset(url: objPath)
let scene = SCNScene(mdlAsset: asset)
scene.write(to: <your-usdz-file-path>, delegate: nil)

This would be the recommended way to do this suggested halfway into this video: https://developer.apple.com/videos/play/wwdc2019/602/

Hope this saves people some time

cpheinrich commented 3 years ago

Note: I do appreciate this repo though, because this SCNScene export option was only possible since late 2019. It would have been nice of Apple to expose that option earlier