Runtime import of non-USD formats into RealityKit

My users import their own 3D assets at runtime — OBJ, FBX, DAE, STL, PLY, often with skeletal animation — which we convert in-app to SceneKit scenes via Assimp. RealityKit only loads USD/.reality at runtime. Is the recommended path to hand-build MeshResource, skeletons, and animations from parsed geometry, or is there any supported on-device conversion to USD? This is one of my biggest blockers to leaving SceneKit.

Answered by Vision Pro Engineer in 891335022

Hi,

This is a bit of a tricky answer since there's a lot of file formats involved.

If its possible, I would suggest recommending users pre-convert their assets to USDZ using an app like Preview on macOS, or export directly to USDZ from their content creation apps like Blender.

That said, if you do need to support more file formats, the API we provide for conversion is via ModelIO ( https://developer.apple.com/documentation/modelio ). It doesn't support all the formats you listed (particularly FBX) but it does support the others.

For DAE or SCN files, you'll want to go through SceneKit that does wrap ModelIO as well. https://developer.apple.com/documentation/scenekit/scnscene/write(to:options:delegate:progresshandler:)

For both ModelIo and SceneKit you can then export to a USD file, and then use the ModelIO conversion method to create a USDZ that RealityKit can understand ( https://developer.apple.com/documentation/modelio/mdlutility/convert(tousdz:writeto:) ) or use the new USDKit framework to write the USDZ file out (https://developer.apple.com/documentation/usdkit/usdstage-4sfi1/exportpackage(to:options:)-2x7yr)

If you find yourself having to use AssImp (perhaps due to the range of file formats you need to support), then yes you'd have to construct the RealityKit mesh resources directly, unless you can first export one of the other formats that ModelIO or SceneKit support to get it into USDZ.

I realize that's a few hoops to jump through, but those are the various routes I can think of at this time to get non-USDZ content into RealityKit.

Hi,

This is a bit of a tricky answer since there's a lot of file formats involved.

If its possible, I would suggest recommending users pre-convert their assets to USDZ using an app like Preview on macOS, or export directly to USDZ from their content creation apps like Blender.

That said, if you do need to support more file formats, the API we provide for conversion is via ModelIO ( https://developer.apple.com/documentation/modelio ). It doesn't support all the formats you listed (particularly FBX) but it does support the others.

For DAE or SCN files, you'll want to go through SceneKit that does wrap ModelIO as well. https://developer.apple.com/documentation/scenekit/scnscene/write(to:options:delegate:progresshandler:)

For both ModelIo and SceneKit you can then export to a USD file, and then use the ModelIO conversion method to create a USDZ that RealityKit can understand ( https://developer.apple.com/documentation/modelio/mdlutility/convert(tousdz:writeto:) ) or use the new USDKit framework to write the USDZ file out (https://developer.apple.com/documentation/usdkit/usdstage-4sfi1/exportpackage(to:options:)-2x7yr)

If you find yourself having to use AssImp (perhaps due to the range of file formats you need to support), then yes you'd have to construct the RealityKit mesh resources directly, unless you can first export one of the other formats that ModelIO or SceneKit support to get it into USDZ.

I realize that's a few hoops to jump through, but those are the various routes I can think of at this time to get non-USDZ content into RealityKit.

Runtime import of non-USD formats into RealityKit
 
 
Q