Export the USD or USDZ with Maya

Maya 2022 has a plugin that can export USD and USDZ files. Therefore, I used it to export the USD and USDZ files. Finally, after several attempts and errors, I exported USD and USDZ files with textures.

This article summarizes the setup and procedures.

目次

My system environment

Our system environment when I created this article was the following.

  • Windows 11 Pro 21H2
  • Maya 2022.3 for Windows

Texture files path

It is important to pay attention to the file paths when exporting USD or USDz files. If the file path contains any multi bytes characters such as Japanese hiragana, katakana, kanji, full bytes characters, and so on, it causes errors. The script editor reports errors as follows.

// Error: Invalid asset path string -- character 27: invalid UTF-8 code point byte 0x83

To avoid these errors, ensure that the path for the texture files does not contain multi-byte characters. It was my blind spot that my user name has Japanese kanji, so my home folder path contains it.

Use Usd Preview Surface

Set the material of the models that will be exported to the Usd Preview Surface. The aiStandard Surface of the Arnold is not exported.

Usd Preview Surface
Usd Preview Surface

Therefore, Arnold can’t render the Usd Preview Surface. However, the “Maya Software Renderer” and the “Maya Hardware Renderer” can render them.

Render with the Maya Hardware Renderer
Render with the Maya Hardware Renderer

Set the Subdivision to None

To export USD or USDZ files, select “USD Export” from the ‘file type’ options in the export dialog. Next, set the Subdivision Method to “None (Polygonal Mesh)”. It is available in the “Geometry” in the “File Type Specific Options”.

Set the Subdivision Method to the "None (Polygonal Mesh)"
Set the Subdivision Method to the “None (Polygonal Mesh)”

If you use the default value “Catmull-Clark”, the model will crumble. The following screen captures were exported in USDZ with “Catmull-Clark” selected at the top and “None (Polygonal Mesh)” at the bottom.

Catmull-Clark
Catmull-Clark
None (Polygonal Mesh)
None (Polygonal Mesh)

Set the name extension to “usdz”

When the usdz extension is entered in the export dialog, a USDZ file will be exported. Suppose you enter the file name without the name extension. In that case, the USD file will be exported, which contains references to the texture files.

Trouble Shooting: The file references in the USD file are the absolute path

Suppose you specify the texture files to the Usd Preview Surface with the relative file path. This causes errors in that case, and texture will not be exported when you export the USD file. Instead, you must specify the absolute path. If you place the texture files in the home directory or its subdirectories, it can make cross-machine collaboration challenging.

Trouble Shooting: Find the error files

To identify files that cause errors, change the “.usd File Format” option in the Output section of the File Specific Options to “ASCII”, then export.

Open the exported file and search asset input:file = @@. You will be able to see the materials that were not exported. When the texure is exported successfully, the file path will be written between @ and @.

著書紹介

Authored Books

よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!

この記事を書いた人

Akira Hayashi (林 晃)のアバター Akira Hayashi (林 晃) Representative(代表), Software Engineer(ソフトウェアエンジニア)

アールケー開発代表。Appleプラットフォーム向けの開発を専門としているソフトウェアエンジニア。ソフトウェアの受託開発、技術書執筆、技術指導・セミナー講師。note, Medium, LinkedIn
-
Representative of RK Kaihatsu. Software Engineer Specializing in Development for the Apple Platform. Specializing in contract software development, technical writing, and serving as a tech workshop lecturer. note, Medium, LinkedIn

目次