Compiling The Houdini USD Plugins on OSX

It’s been a while! I know, I know. Luckily, work has kept me busy and also doing some training in Unreal and shader writing. Yet, it all comes back around to Houdini in some way or another. Anyways, I’ve been wanting to play with the USD nodes in Houdini especially after watching Rob Stauffer’s SIGGRAPH primer on USD. The USD plugins are not installed by default. The good news is that Houdini includes the plugins with its install. The bad news is you have to compile them yourself. 😬

gif come on

 

Have no fear though since I’m going to show you how to compile them yourself on OSX. I will do a separate one for Windows since in typical Windows fashion, it’s a bit more involved.

The Tools You Will Need

First a disclaimer. Compiling software depends on many moving parts. One small thing is off and everything fails. I successfully compiled the USD plugins on this particular machine using:

  • OSX 10.12.6
  • Houdini version 17.5 Build 173
  • Xcode version 9.0.1 with the command line utility components.

You don’t need to have the exact versions but it’s possible a different OS X version or Houdini version will cause the compile to fail. So this guide may or may not work for you. Permissions, install locations, what the mood of your cat is like can all contribute to the compilation process to fail. Many times you can dive into the configuration files and source code and fix the issue assuming you have the technical chops. Otherwise, you will be a sad panda.

Make sure you have the following applications and tools installed:

  1. Houdinihttps://sidefx.com
  2. Xcode with the command line utility components – App Store
  3. CMake – https://cmake.org/

That’s all you need to compile the plugins. This might seem like a great effort but it’s really not that bad. First we’re going to create a couple of directories and modify one of the configuration files. Second, we will generate some files with CMake. Third, we will install our plugins using the make command. Finally, we will tell Houdini where to find the plugins. So let’s forge on!

Location of USD Plugins

First, we need to locate the plugins. You can find them in the Houdini toolkit folder in the following location:

/Applications/Houdini/Current/Frameworks/Houdini.framework/Versions/Current/Resources/toolkit/

You can either use Finder to navigate there or use the Terminal. I find it faster to get there through the Terminal if you have your Houdini environment setup.

USD on Mac
USD plugin location on OSX

 

At this point I would strongly advise you to make a copy of the toolkit folder in case things don’t go as planned. Ideally, you would make a copy and work off that copy. However, doing so complicates things and will present compile errors due to invalid paths. We are going to keep it simple for now and work from within this folder. Just make sure you make a copy of the toolkit folder and save it somewhere.

Setup and Configuration

If you dive into the USD plugins folder you are going to find some source code. The first thing you want to do is to create a folder inside usd_houdini_plugins called build. Again, this folder can be named anything you wish and can be located anywhere but we will leave it here for now otherwise you need to dive into some files to configure paths and we don’t want to do that.

Create a build folder
Create a build folder

 

By default, the plugins are installed to your Houdini preferences folder. This is fine and you can certainly leave it as is, save a few steps and be done. I just like to keeps things organized and prefer to know what exactly is being installed and where. So were are going to make one small adjustment to install the USD plugins inside their own folder within the Houdini preferences.

Head on over to your Houdini preferences folder and make a folder called USD or whatever you want to call it. Just make a note of the name because we need to use that name to modify one of the configuration files in a second.

Custom USD plugin location
Custom USD plugin location

 

Head back to the usd_houdini_plugins folder and open the file CMakeLists.txt with a text editor. This is where we are going to use the name of the folder we just created. Go to line 19 and change the line to the following:

set(H_INSTDIR $ENV{HOME}/Library/Preferences/houdini/${_houdini_release_version}/USD )

 

Add new path to CMakeLists.txt
Add new path to CMakeLists.txt

 

What we are doing is just adding /USD to the end of the line. Notice the forward slash. As you can probably make out, that line of code is setting a variable to a path location. Again, this is the same folder we just created in our Houdini preferences location. Make sure you add the forward slash!

Configuring CMake

The next step is configuring CMake. WTF is CMake you may ask. Well, it’s a set of open-source tools designed to build, test, package software and control software compilation. Most likely you don’t have this installed on your system so we are going to download a nice GUI version and use that. There is an optional command line version but again we are trying to make this as painless as possible.

Once you have CMake installed, open up the application and set the path to the usd_houdini_plugins folder where the source code is located and the path to the build folder you previously created. These are the first two parameters in the application. The source code is what’s inside the usd_houdini_plugins folder and the binaries are what’s getting created inside the build folder.

Setting paths in CMake
Setting paths in CMake

The paths should be the following:

Where is the source code:  /Applications/Houdini/Houdini17.5.173/Frameworks/Houdini.framework/Versions/Current/Resources/toolkit/usd_houdini_plugins

Where to build the binaries:  /Applications/Houdini/Houdini17.5.173/Frameworks/Houdini.framework/Versions/Current/Resources/toolkit/usd_houdini_plugins/build

Now we need to configure one last thing. We need to set the path to where the Houdini CMake config files are located. These files live just outside the usd_houdini_plugins folder and within the toolkit folder. This is one of the reasons we didn’t work off the copy. Doing so would have broken some of the links to file locations. It’s easily fixed but you have to understand how to go in and work with the config files.

We need to make an entry called CMAKE_PREFIX_PATH which points to the files I just mentioned. Do this by clicking on the Add Entry button in CMake. Set the Name to CMAKE_PREFIX_PATH, Type to PATH and Value to the location of the cmake folder that lives in the toolkit folder. You can leave Description blank. The location for the cmake folder should be the following:

/Applications/Houdini/Houdini17.5.173/Frameworks/Houdini.framework/Versions/Current/Resources/toolkit/cmake

Once that is set up press on the Configure button. You should get a dialog asking to specify a generator. Leave the defaults which should be Unix Makefiles and use default native compilers.  If everything goes as planned there should be no errors and the output window should display the path to the installation directory and that Configuring is done. The installation output should match the location you specified for the plugins install. Remember, if you don’t set the CMAKE_PREFIX_PATH you will get an error. Lastly,  press the Generate button. This will generate the necessary files to build the plugins.

Configure CMake
Configure CMake

 

Installing The USD Plugins

Almost done! There are a couple of more steps we need to take before we can start using our USD plugins in Houdini. We now need to install the plugins using the make command. Make is an automation tool that automatically builds executable programs and libraries from source code. We just need it to run a simple command for now.

For this we need to use the Terminal. You should have the make command installed on your system if you have XCode installed along with the command line utility components. From the Terminal, navigate to your build directory, cross your fingers 😁 and type the following command:

make -j8 install
Installing the USD plugins
Installing the USD plugins

 

Make sure you are in the build folder when you run the command. If all went well, open your Houdini preferences folder and you should see your shiny new plugins installed in your custom directory. You can see there are several files so this is why I decided to install them in their own directory. It not only helps me do some debugging but if anything goes wrong I know where to look and what to delete.

Installed plugins
Installed plugins

 

While your preferences folder is open, load up the houdini.env file into your text editor. We need to tell Houdini where to search for the plugins. If you had installed the plugins in the default location you wouldn’t need to modify your env file but recall we are using a custom install location so this is necessary.

USD="/Users/art/Library/Preferences/houdini/17.5/USD"
HOUDINI_PATH=$HOUDINI_PATH;$USD;&
Modify the Houdini env file
Modify the Houdini env file

 

This is standard Houdini environment setup. Now open up Houdini and if you don’t get any errors upon startup things are looking good. Hit tab and type usd and if you get the USD Camera node play some Joe Esposito and throw your fist up in the air. Great job! You have successfully compiled and installed the USD Houdini plugins.

Houdini USD Plugins in action
Houdini USD Plugins in action

 

Conclusion

The process of compiling the USD plugins wasn’t too bad. If you want to learn more about USD head on over to Pixar’s USD website. You will find notes, videos and models to play with. Windows folks, I will be back with an explanation on how to achieve the same on Windows. If you can’t wait, Rachid Abderrahmane has created a video tutorial explaining the process using Windows 10.

Share:
990adjustments

990adjustments

I am a motion designer & developer based out of South Florida. When not designing or animating pixels, I wrangle some code. If all else fails, I watch Twilight Zone, I Love Lucy, or Three's Company reruns.