Obj2usdz Save Abandoned

? obj2usdz, convert .OBJ files to .USDZ on iOS

Project README

obj2usdz

Create .USDZ files from iOS itself in Swift.

Note

Since WWDC19, it's now possible to write usdz files natively using SceneKit. (thanks @cpheinrich)

This repo shared an older technique prior to it's the current recommended method:

import SceneKit
import ModelIO

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

Recommended at WWDC19

Previous Technique

With the introduction of the USDZ format and iOS 12, Apple provided guidance only for creating .usdz files using their macOS commandline tool:

xcrun usdz_converter Tyrannosaurus.obj Tyrannosaurus.usdz 
-g TyrannosaurusMesh
-color_map Tyrannosaurus_Color.png
-metallic_map Tyrannosaurus_Metallic.png
-roughness_map Tyrannosaurus_Roughness.png
-normal_map .  Tyrannosaurus_Normal.png
-emissive_map  Tyrannosaurus_Emissive.png

Exporting to .USDZ

Copy the MDLAsset+usdz.swift file into your Xcode project and create .USDZ in the following way:

let objAsset = MDLAsset(url: objUrl)

let destinationFileUrl = URL(fileURLWithPath: "path/Scene.usdz")
objAsset.exportToUSDZ(destinationFileUrl: destinationFileUrl)

Resources

License

obj2usdz is available under the MIT license, see the LICENSE file for more information.

Open Source Agenda is not affiliated with "Obj2usdz" Project. README Source: piemonte/obj2usdz
Stars
49
Open Issues
1
Last Commit
3 years ago
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating