Chapters

Hide chapters

Apple Augmented Reality by Tutorials

First Edition - Early Access 3 · iOS 14 · Swift 5.1 · Xcode 12

Before You Begin

Section 0: 3 chapters
Show chapters Hide chapters

Section I: Reality Composer

Section 1: 5 chapters
Show chapters Hide chapters

Section VI: ARKit & SceneKit

Section 6: 2 chapters
Show chapters Hide chapters

Section VII: ECS & Collaborative Experiences (Bonus Section)

Section 7: 2 chapters
Show chapters Hide chapters

4. USDZ Files & USD Python Tools
Written by Chris Language

Heads up... You're reading this book for free, with parts of this chapter shown beyond this point as scrambled text.

In the previous chapters, you explored the power of AR Quick Look. You also learned how to create your own AR experiences with Reality Composer using models from the built-in content library. But what about creating AR experiences with your own custom content?

The key technology behind AR Quick Look and Reality Composer is a file format known as USDZ.

In this chapter, you’ll learn about USD and the USDZ file format. You’ll also learn how to convert your own virtual content into this universal format using Python-based command-line tools. This knowledge will empower you to create your own USDZ content for both AR Quick Look and Reality Composer.

What is USD?

Before getting to USDZ, you need to understand the technology behind it: Universal Scene Description (USD). This is a universal format to exchange 3D content. Pixar developed it to improve the graphics and animation workflow pipeline of large-scale animation productions.

USD has been under development since 2016. It’s one of the core technologies behind stunning animation blockbusters like “Finding Dory” and “Cars”.

Since Pixar open-sourced the technology, it’s become an industry standard. Many of the big players within the 3D graphics and animation industry now back it.

USD features

USD comes with an onslaught of great features. Here’s a shortened list of just some of its key features:

What is USDZ?

At WWDC 2018, Apple introduced AR Quick Look along with the new USDZ file format. As you know by now, USD stands for Universal Scene Description; the added Z merely indicates that it’s a ZIP archive.

USDZ features

A number of critical features make USDZ an excellent choice for 3D content delivery:

USDZ tools

At WWDC 2019, Apple announced a new set of tools to help developers create their own USDZ files. These tools are known as USDZ Tools or the USD Python Tools.

Installing USDZ tools

Your first step is to download the USDZ Tools: https://apple.co/36TN9WJ

Reviewing the project

For this example, you’ll use a cool AR drum set Reality Composer project. Open starter/ARDrumSet.rcproject in Reality Composer, then press the Play button to test it.

Exporting 3D models

The first thing to do is to export the kick drum from the original 3D composition in a format that USDZ Tools supports.

Converting 3D models to USDZ

It’s time to convert Kick.glb into a USDZ file. To do this, jump back to the open Terminal window from the first section and execute the following command-line instructions:

cd /
cd Users/<YourUserName>/Desktop

Using usdzconvert

For your next step, you’ll use the usdzconvert tool. To find out more about the available options, execute the following command-line instructions to request detailed help information:

usdzconvert -h

usdzconvert Kick.glb -v Kick.usdz

Converting USDZ to USDA

To see what’s inside the USDZ file, you need to convert it to a USDA file, which is the plain text representation of the USDZ.

Using usdcat

To do this, you’ll use usdcat. This tool converts USDZ into USDA files.

usdcat -h

usdcat Kick.usdz -o Kick.usda

Inspecting and validating USDZ

Now that you’ve converted your 3D model into USDZ, you can inspect and validate the USDZ file.

Using usdtree

To get a high-level overview of the model hierarchy, you’ll use the usdtree tool.

usdtree -h

usdtree Kick.usdz

Using usdchecker

Finally, to validate the generated USDZ and to make sure the file is compliant, you’ll use the usdchecker tool.

usdchecker -h

usdchecker Kick.usdz -v

Importing USDZ assets

Now that your USDZ file is ready to go, open starter/ARDrumSet.rcproject again with Reality Composer.

Key points

Well done, you’ve just reached the end of this chapter.

Where to go from here?

Here are a few recommended links you can explore to advance your knowledge on this topic:

Have a technical question? Want to report a bug? You can ask questions and report bugs to the book authors in our official book forum here.
© 2024 Kodeco Inc.

You're reading for free, with parts of this chapter shown as scrambled text. Unlock this book, and our entire catalogue of books and videos, with a Kodeco Personal Plan.

Unlock now