1. Python3.7 must be installed first [Must be Python3.7.x version]
Go to the Python official website to download the Python3.7.x installation package for macOS
Python Releases for macOS | Python.org
Pay attention to find, some 3.7.x versions do not have macOS installation package,
Here are two of them that can be downloaded directly.
- Python 3.7.8rc1 - June 17, 2020
- Download macOS 64-bit installer
- Python 3.7.9 - Aug. 17, 2020
- Download macOS 64-bit installer
2. Download the USDPython tool
Apple official download: https://developer.apple.com/download/all/?q=USDPython
You will be asked to log in midway.
3. Configure the environment path
To edit ~/.zshrc, for example, you can open it with vim ~/.zshrc, then press i to insert, and paste the following:
export PATH="/Applications/usdpython/USD:$PATH"
export PATH="/Applications/usdpython/usdzconvert:$PATH"
export PYTHONPATH="/Applications/usdpython/USD/lib/python:$PATH"
Please fill in the specific path according to the actual situation.
After filling, remember to save.
Then execute source ~/.zshrc to refresh.
If no path is configured, an error occurs:
Error: failed to import pxr module. Please add path to USD Python bindings to your PYTHONPATH
4. Convert obj format to usdz format
and enter the directory where usdzconvert is located
Enter the command: ./usdzconvert xxxx.obj
Please fill in the file path according to the actual situation.
Then there will be a xxxx.usdz file in the same directory as xxxx.obj.
For example, my execution result is:
howard@Howards-MacBook-Air usdzconvert % ./usdzconvert /Users/howard/Desktop/work-visionOS/xiaoyi.obj
Input file: /Users/howard/Desktop/work-visionOS/xiaoyi.obj
Output file: /Users/howard/Desktop/work-visionOS/xiaoyi.usdz
usdARKitChecker: [Pass] /Users/howard/Desktop/work-visionOS/xiaoyi.usdz