Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

converting .usdz to .obj results in flattened model

I'm using the Apple RoomPlan sdk to generate a .usdz file, which works fine, and gives me a 3D scan of my room.

But when I try to use Model I/O's MDLAsset to convert that output into an .obj file, it comes out as a completely flat model shaped like a rectangle. Here is my Swift code:

let destinationURL = destinationFolderURL.appending(path: "Room.usdz")
do {
    try FileManager.default.createDirectory(at: destinationFolderURL, withIntermediateDirectories: true)
    try finalResults?.export(to: destinationURL, exportOptions: .model)
    let newUsdz = destinationURL;
    let asset = MDLAsset(url: newUsdz);
    let obj = destinationFolderURL.appending(path: "Room.obj")
    try asset.export(to: obj)
}

Not sure what's wrong here. According to MDLAsset documentation, .obj is a supported format and exporting from .usdz to the other formats like .stl and .ply works fine and retains the original 3D shape.

Some things I've tried:

  • changing "exportOptions" to parametric, mesh, or model.
  • simply changing the file extension of "destinationURL" (throws error)
converting .usdz to .obj results in flattened model
 
 
Q