USD in Houdini#

Houdini has an extensive USD integration and provides a large array of tools to work with USD data.
The Prism USD plugin provides additional tools to manage and organize a USD based workflow with a focus on the Solaris (LOPs) context in Houdini.
This page is a reference of the Prism USD tools available in Houdini.
For workflow examples see these guides:

Solaris HDAs#

In Solaris (LOPs) these Prism HDAs are available:
../../../_images/lops_hdas.jpg

Prism LOP File Cache#

The Prism LOP File Cache is used to write out USD files.
These USD files can then be used as layers in other USD files or as normal products in Prism.
../../../_images/lops_filecache.jpg

Prism LOP Import#

This HDA can be used to import USD files from the Prism project into Solaris.
By default it will import the latest USD product of the asset/shot in which the current scenefile is saved.
../../../_images/lops_import.jpg

Prism LOP Mute Departments#

This HDA provides options to mute specific department layers or sublayers of a USD stage.
This is useful when loading the entity USD container in a department scenefile.
Usually the current department and downstream departments should be muted in this case.
../../../_images/lops_mute_departments.jpg

Prism LOP Render#

This HDA can trigger a render of the input USD stage and save the output images in the Prism project.
This node can also submit renderjobs to Deadline.
Optionally this node can export USD files and submit a render job to Deadline, which renders the USD files using the Husk executable, which doesn’t require a Houdini license and Prism license.
../../../_images/lops_render.jpg

Prism LOP Sequencer#

This HDA will play back all input USD stages in sequence.
It will detect the framerange of each input and offset the startframe, so that multiple shots can be played back after another even if their original startframe number is identical.
../../../_images/lops_sequencer.jpg

Solaris Presets#

Prism offers multiple presets to help setting up nodegraphs for different departments.
From the “Prism Presets” menu in the tab menu there are multiple nodegraph presets available to set up a basic structure for the USD workflow in LOPs and SOPs.
../../../_images/lops_presets.jpg

1 Setup Assets…#
Opens a window where you can select one or more assets from your project.
In the next window you can select which departments you want to setup for each asset.
Once confirmed, Prism will load a nodegraph preset for each selected department of each selected asset.
2 Setup Shots…#
Similar to the Setup Assets... preset.
Select one or more shots and then the departments, which should be setup.
When setting up multiple shots, Prism uses a shot switch in each department nodegraph to switch between the shots, instead of creating independent department nodegraphs for each shot.
3 Current Entity…#
Detects in which asset or shot the current scenefile is saved in and shows a window with the departments, which are available to setup.
4 Import Assets…#
Opens a window where one or more assets can be selected and loaded.
This is intended to load assets into a shot nodegraph.
The asset are loaded using the Prism Import LOP node and are loaded as payload.
The “Add Meta Data” option is disabled to not affect downstream ROPs.
5 New Preset…#
Let’s you create your own presets.
See here for more details.

Creating Custom Solaris Presets#

To create a new nodegraph preset open the tab menu in LOPs and select Prism Presets -> 5 New Preset...
This will open the following window:
../../../_images/usd_createPresetDlg.jpg
Presetname sets the name, which will be visible in the nodegraph tab menu.

Node defines the Houdini nodepath, which will be saved in the preset. All childnodes of the selected node will be saved.

Location defines where the presetfile will be saved on disk.
- “User” location is by default at this path: %userprofile%\Documents\Prism2\Presets\Houdini_Nodegraphs
- “Project” location is by default at this path inside of your current Prism project folder: 00_Pipeline\Presets\Houdini_Nodegraphs
- “USD Plugin” location is at this path inside of the Prism USD plugin folder: Presets\Houdini_Nodegraphs
This is the location where the default nodegraph presets are stored.
Saving custom presets in this location is not recommended because they will be deleted if the Prism USD plugin gets updated in the future.
- “Custom” let’s you choose a folder manually.

Prism will load presets from these locations automatically.

Note

You can use the env var PRISM_HOUDINI_NODEGRAHPRESET_LOCATIONS to define additional locations, where Prism will load nodegraph presets from.

Running Custom Python Code when a preset is loaded#

When you created custom Solaris nodegraph presets, you might want to run some Python function every time after the preset got loaded.
This can be done using a simple Prism plugin like in this example:
class Prism_MyPlugin_Functions(object):
    def __init__(self, core, plugin):
        self.core = core
        self.plugin = plugin
        self.core.registerCallback("pluginLoaded", self.onPluginLoaded, plugin=self.plugin)

    def onPluginLoaded(self, plugin):
        if plugin.pluginName == "USD":
            plugin.api.postPresetLoadHandlers["My Custom Preset"] = self.onPresetLoaded

    def onPresetLoaded(self, presetName=None, kwargs=None):
        self.core.popup("Preset %s" presetName)

SOPs#

In SOPs USD files can be imported using the “Prism ImportFile” SOP.

To export USD files the Prism File Cache SOP can be used.
When working in a full USD workflow, it’s recommended to bring the SOP data into LOPs and cache it out using the Prism LOP File Cache.

Miscellaneous#

Meta Data#

The Prism LOP import nodes can add some meta data to the loaded USD stage to identify the asset or shot from which the USD file originated.
This meta data can be used by downstream filecache and render nodes to set in which asset or in which shot files will be published.

On the Prism LOP Import node there is an Add Meta Data checkbox in the Advanced Settings section.
By default it is enabled, which is recommended when loading asset or shot USD containers at the top of your nodegraph.
When loading assets into a shot USD stage, this checkbox should be unchecked to not overwrite the meta data, which contains the shotname, with the meta data, which contains the assetname. This is because downstream ROPs are expected to publish files to the shot and not the asset.

On the Prism LOP File Cache node and the Prism LOP Render the Context parameter defines in which entity the published files will be saved.
By default this is set to From stage meta data, which will check the input stage for the meta data, which was created by an upstream Prism LOP Import node.

This meta data is stored on the /prism_metadata USD prim on the prism_sources attribute.
This USD prim is hidden by default and can be ignored in most cases.
To see it in the Houdini Scene Graph Tree you can click the Primitive visibility in scene graph button (glasses icon) and toggle Show hidden primitives.
../../../_images/lops_meta_data.jpg

Shot Menu#

When creating nodegraphs from the Prism Solaris Presets for multiple shots, Prism will use switch nodes to work on shot specific overrides.
These switch node use the shot context option.
A convenient way to set this context option and switch the inputs of the switch nodes is to use a shot menu in the main menu bar in Houdini.
../../../_images/lops_shot_menu.jpg
When adding the Prism integration to Houdini, the shot menu will be set up automatically.

If you are using a custom Prism integration in your Houdini startup process, you might need to configure the shot menu manually:
The Prism USD plugin ships with a MainMenuCommon.xml file, which adds this menu to Houdini.
To let Houdini load this file, the Prism.json package file need to be updated to add the path to the Integration``folder of the USD plugin to the ``path env var in the package file.
For example:
{
    "env": [
        {"PRISM_ROOT": "${PRISM_ROOT-C:/Program Files/Prism2}"
        }
    ],
    "path" : [
        "C:/ProgramData/Prism2/plugins/Houdini/Integration",
        "C:/ProgramData/Prism2/plugins/USD/Integration"
    ],
    "load_package_once": true
}
When you open a hipfile, Prism will set the context option shot to the shotname in which the scenefile is saved.

Note

If you want to disable this behavior you can set the PRISM_HOUDINI_SOLARIS_SET_SHOT env var to 0.

Rendering USD files instead of hipfiles on the farm#

The default settings of the Prism LOP Render HDA will submit the hipfile for rendering to the farm.
This will submit a Houdini job, which uses the hython executable and an Houdini Engine license while rendering.
To avoid the need of having a Houdini license for every render worker, Prism can export USD files from the hipfile and render them using the husk executable.
With this setup, a Houdini license is only required while exporting the USD files.
The rendering will only require a Karma license (or a license for another renderer if not using Karma).

To use this workflow, set the Render Mode on the Prism LOP Render node (in the Advanced Settings section) to USD files from disk generated from node input.
By default the USD file will be exported in a separate job on Deadline.
However the exported USD file is usually very small and can be exported in the local Houdini session before submitting the renderjob by using the Write stage to disk before render(-submission) setting on the Prism LOP Render node (in the Advanced Settings -> Save to disk section.
This is useful to avoid that the export job gets send to the farm, which requires a Houdini license during export.
The USD file which gets exported using the Prism LOP Render should not contain any heavy geometry or animations.
Therefore a single USD file will be written for the whole framerange.
There is no option to write a USD file per frame using the Prism LOP Render node.
If the stage contains heavy geometry or animations, the Prism LOP Filecache node should be used to cache out the heavy data before rendering.
The Prism LOP Filecache has an option to write a USD file per frame.
../../../_images/lops_render_usd_farm.jpg

Rendering a bgeo filesequence in Solaris#

Many people are struggling to render bgeo sequences correctly in Solaris, so we’ll cover this here although this is not specific to Prism.

.bgeo filesequences are often used to cache out simulations or animation caches from SOPs or other contexts in Houdini.

A common mistake is to load the bgeo files in SOPs and then import it into LOPs.
When exporting the stage to usd files (for example to render using husk), this would write the heavy geometry into the USD files instead of referencing the bgeo files, which already exist on disk.

To simply add a reference to the bgeo files to the stage without duplicating the heavy data, follow these steps:
Before caching out the bgeo files in SOPs, create a USD Configure SOP and enable the Sample Frame option.
If you already have a bgeo sequence and want to check if they were cached with this option enabled, check if the usdconfigsampleframe detail attribute exists when loading the bgeo files in SOPs.
To load the bgeo files bgeo sequence in LOPs, create a Geometry Clip Sequence LOP, uncheck Get Geometry From Second Input, add the bgeo filepath to in the Load Clip File Path parameter (with $F4 in the filepath), uncheck Flatten Clip Files and set the Clip Primitive Path to /Geometry.
Set the Manifest File Save Path to this Python expression:
import os
return os.path.dirname(hou.pwd().parm("loadclipfilepath").eval()) + "/manifest.usd"
And set the Topology File Save Path to this Python expression:
import os
return os.path.dirname(hou.pwd().parm("loadclipfilepath").eval()) + "/topology.usd"
Now you can use the Prism LOP Filecache, Prism LOP Render or other ROP nodes further down in your LOP nodegraph to write your stage to a usd file.
The USD file will be very lightweight and load the heavy geometry to the bgeo filesequence.
../../../_images/lops_bgeo_sequence.jpg