How to create USDZ file using Xcode converter?

2020-01-26 08:40发布

At the 2018 WWDC Apple annouced the introduction of new USDZ file format.

https://developer.apple.com/videos/play/wwdc2018/603/

In relation to creating USDZ file the following was said:

To create your own usdz files, a usdz_converter has been bundled as part of Xcode 10 beta. Its a command line tool for creating the usdz file from OBJ files, Single-frame Alembic (ABC) files, USD file (either .usda or usd.c)

the basic command line is

xcrun usdz_converter myFile.obj myFile.usdz

I have installed Xcode 10 beta, but have been unable to run or even find usdz_converter in the Xcode 10 beta bundle made available on the 4th June 2018 (build 10L176w).

note: I’m still running on macOS highSierra, I have not installed macOS Mojave 10.14 beta yet... but didn’t think that should be the reason why.

Has anyone else been able to get this xcrun usdz_converter to work?

If so please share the steps.

3条回答
迷人小祖宗
2楼-- · 2020-01-26 09:11

You have to enable the Xcode 10 command line tools on Xcode > Preferences > Locations

Example

查看更多
聊天终结者
3楼-- · 2020-01-26 09:22

usdzconvert command for Xcode 11

In macOS 10.15 Catalina and Xcode 11 USDZ converter has a rich set of commands and supports more input formats for conversion than previous version. But before using it you need to download usdz Tools. And don't forget to setup a global variables for Python usdz tools. Here's how a new command looks like in Terminal:

usdzconvert ~/Desktop/file.gltf -diffuseColor albedo.png -metallic brass.jpg
  • In macOS Catalina the default command shell is ZSH.

So, if you want to use USDPython tools you need to create a Shell Resource file .zshrc using the following Terminal command:

touch ~/.zshrc

Then you have to open this file using:

open ~/.zshrc

Now you can add these lines into zsh resource file:

export PATH="/Users/yourUserName/usdpython/USD:$PATH"
export PATH="/Users/yourUserName/usdpython/usdzconvert:$PATH"
export PYTHONPATH="/Users/yourUserName/usdpython/USD/lib/python:$PYTHONPATH"

echo "Now I can use USDPython commands here."

Save it and restart Terminal.

usdzconvert is a Python script that converts the following assets into usdz:

  • obj
  • gltf
  • fbx
  • abc
  • usda
  • usdc
  • usd

enter image description here

xcrun usdz_converter command for Xcode 10

In macOS 10.14 Mojave and Xcode 10 USDZ converter has a slightly different set of arguments and flags. Here's how an old command looks like in Terminal:

xcrun usdz_converter file.obj file.usdz -color_map color.jpg -ao_map ao.png
  • In macOS Mojave the default command shell is BASH.
查看更多
Melony?
4楼-- · 2020-01-26 09:24

You have to activate the command line tools in Xcode preferences, in case they're not actived yet (that was my case). See this topic:

How to create a USDZ file?

查看更多
登录 后发表回答