6

So I have an OBJ 3D model with its associated MTL file. The MTL file contains all the textures. However, when I convert the file to the USDZ format, the textures are not attributed to the file. This is the code I use.

xcrun usdz_converter /Users/SaiKambampati/Downloads/Models/object.obj /Users/SaiKambampati/Downloads/Models/object.usdz

The USDZ file is created but the attributes and textures are not applied. Is there any way to include the MTL file when converting the OBJ model to USDZ model?

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220
HeySaiK
  • 480
  • 1
  • 6
  • 17

3 Answers3

3

To convert OBJ to USDZ, I'd recommend using GLB as an intermediate format.

You can convert OBJ to GLB using Blender, by importing the OBJ, and exporting as GLB.

Then Spase has a GLB to USDZ converter available at https://spase.io/converter, that rapidly does the conversion (for free), powered by a Google USDZ library. It's a drag-and-drop tool, and after conversion the USDZ can be downloaded instantly.

Spase
  • 31
  • 4
2

Xcode's Command Line Converter for USDZ doesn't understand associated material MTL files for OBJ 3D models at the moment.

For texturing converted USDZ models in Xcode, you need to save UV-mapped textures in Autodesk Maya as JPEG or PNG files, for OBJ, ABC, FBX, USD or DAE models, and then assign these UV textures thru Xcode's UI or programmatically. Also, you can export a USDZ model with textures right from Maya 2024.

For more details, read about Pixar USD file format here.

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220
  • When you say that Xcode 10 doesn't understand .mtl, you mean the usdz_converter tool, right? Because I've tried to render a (.obj + .mtl) in Xcode 10 for a ARKit project and I had no problem. But it's true you can't use the usdz_converter tool without options and expect a .usdz with textures from a (.obj + .mtl) – Sergio Nov 14 '18 at 19:01
  • 1
    Yes, I meant usdz_converter tool. – Andy Jazz Nov 14 '18 at 19:17
  • I am having problems with .usdz textures and ARKit too: https://stackoverflow.com/questions/53317392/how-to-create-a-scnnode-from-a-usdz – Sergio Nov 15 '18 at 10:34
2

For what it is worth, I created a model in Blender intended for usdz and used regular Texture and UV mapping to color it. When I output the OBJ I too got a .mtl file but did not need it. When I passed the texture .png to usdz_converter as the color_map param the texture showed up in Quick Look on iOS 12.