Creating a 3D application with hydra rendering
Build a 3D application that integrates with Hydra and USD.
Overview
Configure the sample code project
This sample requires Xcode 14 or later and macOS 13 or later. To build the project, you first need to get and build the USD source code from the Pixar GitHub repository, and then use CMake to generate an Xcode project with references to both the compiled USD libraries and the header files in the USD source code. If you don’t already have CMake installed, download the latest version of CMake to your Applications folder.
CMake is both a GUI and command-line app. To use the command-line tool, open a Terminal window and add the /Contents/bin folder from the CMake.app application bundle to your PATH environment variable, like this:
path+=('/Applications/CMake.app/Contents/bin/')
export PATHClone the USD repo, using the following command:
git clone https://github.com/PixarAnimationStudios/USDNext, build USD using the following command: python3 <path to usd source>/build_scripts/build_usd.py --generator Xcode --no-python <path to install the built USD>. For example, if you’ve cloned the USD source code into ~/dev/USD, the build command might look like this:
python3 ~/dev/USD/build_scripts/build_usd.py --generator Xcode --no-python ./USDInstallConfigure the USD_Path environment variable: export USD_PATH=<path to usd install>. For example, if you’ve installed USD at ~/dev/USDInstall, use this command:
export USD_PATH=~/dev/USDInstallRun the following CMake command to generate an Xcode project: cmake -S <path to project source folder> -B <path to directory where it creates the Xcode project>. If the sample code is at ~/dev/, the command might look like this:
cmake -S ~/dev/CreatingA3DApplicationWithHydraRendering/ -B ~/dev/CreatingA3DApplicationWithHydraRendering/Finally, open the generated Xcode project, and change the scheme to hydraplayer.
See Also
Render workflows
Using Metal to draw a view’s contentsDrawing a triangle with Metal 4Selecting device objects for graphics renderingCustomizing render pass setupCreating a custom Metal viewCalculating primitive visibility using depth testingEncoding indirect command buffers on the CPUImplementing order-independent transparency with image blocksLoading textures and models using Metal fast resource loadingAdjusting the level of detail using Metal mesh shadersCulling occluded geometry using the visibility result bufferImproving edge-rendering quality with multisample antialiasing (MSAA)Achieving smooth frame rates with a Metal display link