USD

Tutorial: Setting up and Building Pixar's USD on Windows

Setting up Pixar’s Universal Scene Description (USD) framework can be a daunting task, and documentation tends to be spread around. Here’s a quick rundown of what you need to do. (With thanks to VFXPro99’s instructions here :)

Installing Required Software

GitHub Desktop

7-Zip

  • Download the 7Zip file archiver.

  • Install it and add its install location (usually C:\Program Files\7-Zip) to the System Path .

Python 2.7

  • Download Python 2.7.

  • Run the installer

    • Select the option to add Python 2.7 to the System Path

    • Important: you must also add your Python Scripts directory to your System path by hand. (Usually C:\Python27\Scripts) The installer will add your Python install directory if you select the option, but won’t add the Scripts subdirectory.

CMake

  • Download CMake.

  • Install it and select the option to add CMake to the System Path for all users.

NASM

  • Download NASM.

  • Run the installer as an Administrator

    • When the warning appears, select More Info > Run Anyway

    • Install for anyone using this computer

    • Accept the default options

  • Add C:\Program Files\NASM to the System Path

Microsoft Visual Studio

Microsoft Visual Studio Code

  • Download and install Visual Studio Code.

  • Install the Python plugin for VSCode and reload it

  • Create a simple Python file (any file with extension .py)

    • Contents can be simple:

      • msg = “Foo”
        Print msg
    • Saving the file should prompt VSCode to install PyLint - let it.

  • For further information on setting up VSCode to work with Python, check here. Be aware though that these directions discuss setting up Python 3, but USD requires Python 2. You can set up both Python versions on the same machine, but life gets more complicated if you do.

Getting the USD source

  • Navigate to Pixar’s USD Github repository.

  • Select Clone or Download > Open in Desktop

  • Allow GitHub Desktop to clone the depot to the directory of your choice.

Preparing to Build

  • Run Start Menu > Visual Studio 2017 > x64 Native Tools Command Prompt for VS 2017

    • You must use the Native Tools Command Prompt - a standard command prompt won’t allow you to build using MSVC from the command line.

  • Verify your tools:

    • Type ‘cl’ - you should see the optimizing compiler’s usage notes appear

    • Type ‘7z’ - you should see the 7-Zip usage notes appear

    • Type ‘python’ - Python 2.7 should start. Type exit() to exit it.

      • If you have both Python 2 and Python 3 on your machine, type ‘py -2’ instead.

    • Type ‘cmake’ - CMake usage notes should appear

    • Type ‘nasm’ - NASM should complain that no input file was specified.

  • Install dependencies:

    • Type ‘pip install PySide

      • For this and the following commands, it may be necessary to specify which pip executable to run if you have multiple versions of Python installed. In this case, you can specify the path directly:

        • C:\Python27\Scripts\pip install PySide

      • Let the install finish.

    • Type ‘pip install pyd

      • Possibly not required

    • Type ‘pip install pyopengl

      • Required for the USD viewer

Building USD

  • In the Native Tools Command Prompt, navigate to the location where you cloned your USD source.

  • Type python build_scripts\build_usd.py "C:\USD"
    • Use py -2 rather than python if you need to specify explicitly that you want to run the build script using python 2. The script will not run under python 3.

    • The argument at the end is the location where you’d like to install the USD binaries. You can specify another location here if desired.

  • Allow the build to complete

  • Add a PYTHONPATH variable to your system variables as instructed at the end of the install output and populate it as instructed.

    • If you installed USD to C:\USD, this path will be C:\USD\lib\python

  • Add C:\USD\bin and C:\USD\lib to your System Path as instructed.

    • If you installed elsewhere, of course, these paths will be different.

Testing the USD Build

  • Open a new command window (it no longer needs to be a Native Tools Command Prompt - Powershell or even the default command line is fine here now.)

  • Navigate to the location where you cloned your USD GitHub depot

    • Type: usdview .\extras\usd\tutorials\convertingLayerFormats\Sphere.usd

  • If you correctly set up your PYTHONPATH and Path variables in the last step, the USD viewer should now open and display a sphere.

USDView

USDView

If you’ve completed these steps and USDView successfully launched, you should be ready to work through the USD tutorials.