Convert OBJ to USDZ Python

OBJ files are standard 3D image formats that are compatible with various 3D image editing software programs. In a 3D object file, we can find 3D coordinates, texture maps, polygonal faces, and other information related to your 3D object. In certain cases, we may need to convert an OBJ file to USDZ or USD format. A USDZ file format enables iOS devices to display 3D and AR content without the need for specialized applications. This portable format makes it easy to share and transfer 3D files between applications. In this article, we will learn how to convert an OBJ file to USDZ format in Python.

This article shall cover the following topics:

  1. Python OBJ to USDZ Converter – Free Download
  2. Steps to Convert OBJ to USDZ
  3. Convert OBJ File to USDZ
  4. Convert OBJ to USD in Python

Python OBJ to USDZ Converter – Free Download

For converting an OBJ to USDZ or USD format, we will be using the Aspose.3D for Python API. It allows creating, reading, converting, modifying and controlling the substance of supported 3D file formats without any 3D modeling and rendering software dependencies.

The API provides the Scene class as a top-level object that contains the nodes, geometries, materials, textures, animation, poses, sub-scenes, etc. The from_file(string) method of this class opens the scene from a given file path. It also provides the save(string, SaveOptions) method that saves the scene to the specified path. The UsdSaveOptions class of the API allows specifying save options for USD and USDZ format.

Please either download the package or install the API from PyPI using the following pip command in the console:

pip install aspose-3d

How to Convert OBJ to USDZ or USD Format

We can easily convert any OBJ file to a USDZ or USD format by following the steps given below:

  • Load an OBJ file.
  • Specify USD save options.
  • Save OBJ as an USDZ or USD.

The following section describes how to transform these steps into Python code and convert an OBJ file to USDZ format.

Convert OBJ to USDZ using Python

We can convert an OBJ file to USDZ format by following the steps given below:

  1. Firstly, load an input OBJ file using the Scene.from_file() method.
  2. After that, create an instance of the UsdSaveOptions class with FileFormat.USDZ as an argument.
  3. Finally, call the save() method. It takes the output USDZ file path and UsdSaveOptions as arguments.

The following code sample shows how to convert OBJ to USDZ in Python.

Convert OBJ to USD in Python

Similarly, we can also convert an OBJ file to the USD format by following the steps given below:

  1. Firstly, load an input OBJ file using the Scene.from_file() method.
  2. After that, create an instance of the UsdSaveOptions class.
  3. Finally, call the save() method. It takes the output USD file path and UsdSaveOptions as arguments.

The following code sample shows how to convert OBJ to USD in Python.

Get Free Temporary License

You can get a free temporary license to try Aspose.3D for Python without evaluation limitations.

Try Online

Please try the following free online OBJ to USDZ conversion tool, which is developed using the above API.

https://products.aspose.app/3d/conversion/obj-to-usdz

Conclusion

In this article, we have learned how to

  • load an OBJ file;
  • specify various USD save options programmatically.
  • save OBJ as USDZ and USD in Python.

Besides converting OBJ to USDZ in Python, you can learn more about Aspose.3D for Python API using documentation. In case of any ambiguity, please feel free to contact us on our free support forum.

See Also