Rendering through USD

In this tutorial, we present a method to render Golaem Crowd simulations within USD. Notice that, for performance reasons and quality limitations, this approach does not take advantage of USDSkel but uses USD Dynamic Payloads. This allows to render Character with deformers more advanced than skining (blendshapes, cloth, fur...) in a faster and more efficient way.

Supported Versions

Check the Release Notes to see which Golaem, USD, Houdini or Katana versions are compatible together.

Notice that the Golaem For USD plugin has been compiled against a non-monolithic version of USD (multiple libraries instead of one monolithic). Please get in touch for other builds.

Source Code

The source code of the plugin has been released under the GNU Lesser General Public License v2.1. You can access the GitHub repository here.

Workflow

The figure below details the workflow of the render of Golaem Crowd simulations with USD. For a better understanding of the process, check the Golaem Crowd Rendering Workflow.

Setup Simulation in Maya

Create your Crowd Simulation within Maya using Golaem Crowd. In our example we will use the stadium scene from the Golaem Crowd Samples. Once the simulation is done, open the Simulation Exporter to export the Simulation Cache. Once the Simulation Cache will be exported, a Simulation Cache Proxy and a Crowd Render Proxy node will be created and Golaem will be switched in Cache Replay Mode. .

The Crowd Render Proxy node defines attributes to export USD .usda files (in the USD Attributes):

Specify the directory in which you'd like the files to be exported and press the "Export USD file" button. You will obtain two files:

  • cacheName.proxyNodeName.usda which stores all the parameter values of the Crowd Render Proxy required to render exported Simulation Caches as Crowd Characters. Details about this .usda file can be found here.
  • cacheName.proxyNodeName.glmusd which is an empty file required by USD to register the Golaem plugin extension.

Setup USD

A few steps must be undertaken for USD to be able to load and render with the Golaem plugin.

Installing the Golaem For USD Plugin

The Golaem for USD plugin can be found in its own section on the Golaem Download Page and is made of four directories and one library file installed in procedurals/usd:

If using USD within Houdini or Katana, please download and install the USD For Houdini or the USD For Katana plugin.

Adding Golaem For USD Plugin to your Environment

Then, for USD to be able to find the Golaem For USD Plugin, its path needs to be added to the predefined PXR_PLUGINPATH_NAME (or FNPXR_PLUGINPATH for Katana) environment variable. There are many ways to add a path to an environment variable, however for our test, we chose to create a bat / shell file to launch USD with the correct environment.

Linux

#!/bin/sh
# Set Environment Variables for Golaem

export GOLAEM_INSTALL_PATH=/home/golaem/Golaem-7.3-USD0.19.11
# Set Environment Variables for USD
export LD_LIBRARY_PATH=${GOLAEM_INSTALL_PATH}/lib:${LD_LIBRARY_PATH}
export PXR_PLUGINPATH_NAME=${GOLAEM_INSTALL_PATH}/procedurals/usd:${PXR_PLUGINPATH_NAME}
# Launch USD Viewer
usdview mainSceneFile.usd

Windows

:: Set Environment Variables for Golaem
set GOLAEM_INSTALL_PATH=C:\Golaem\Golaem-7.3-USD0.19.11
:: Set Environment Variables for USD
set PATH=%GOLAEM_INSTALL_PATH%\bin;%PATH%
set PXR_PLUGINPATH_NAME=%GOLAEM_INSTALL_PATH%\procedurals\usd;%PXR_PLUGINPATH_NAME%
:: Launch USD Viewer
usdview mainSceneFile.usd

Rendering a Simulation with USD

To render a Golaem Simulation, you can reference the generated usda file in your mainSceneFile USD file. If the Golaem For USD plugin is correctly installed, the Golaem Entity geometries will be generated in the scene hierarchy as a USD geometry. They can be manipulated as any USD object at this point.

 

Assigning Materials

Material Files can be referenced in the Golaem For USD file (.usda). They should match the name of the Surface Shader or the Shading Groups set in the Character File within the Character Maker in Maya. The parameters glmMaterialPath can be used to define the path to the USD Materials to link and glmMaterialAssignMode to use Surface Shader Names (set to 0, default) or Shading Group Names (set to 1) An example can be found below:

#usda 1.0
def "GolaemCacheProxy1" (
   GolaemUSD_Params = {
      # Golaem parameters  
      ...
      token glmMaterialPath = "/Root/Materials"
      int glmMaterialAssignMode = 0
   }
    payload = @./Golaem.glmusd@
)
{
    def Scope "Materials"
    (
        add references = [@./Materials/CasualMan.usda@, @./Materials/CasualWoman.usda@]
    )
   {}
}

Attributes

Shader Attributes

If Shader Attributes are defined within the Character File of an Entity, the Shader Attributes will be assigned at the USD Mesh level. These attributes can be used to make shading variations if required

 
Two Shader Attributes are defined for the Tshirt Mesh. Those attributes can be read as properties in the generated USD Mesh.

Golaem Attributes

If Golaem Attributes or PPAttributes are exported in the Simulation Cache as "Additional Attributes" in the Simulation Exporter, these will be assigned at the Entity XForm level.

 
Three additional attributes are defined for the Simulation. Those attributes can be read as properties in the generated Entity XForm.

Editing the Simulation

Simulation results (character positions, orientations, postures) and Assets repartition or shading assignment (shader, shader attributes...) can be edited using the Simulation Layout Tool in Maya. You can see the results once saving the Layout File with these edits and by refreshing the Golaem For USD file in your USD environment.

Assets repartition or shading assignment (shader, shader attributes...) can also be edited using the Character Maker in Maya. When done, you just need to save the changes in the Character File. Reexporting the library file is not required.

The actual transformation and scale of the node in the USD scene is taken into account.

If you'd like to change any Crowd Shader properties (texture, color, displacement, multi matte IDs...), it can be done on the assigned Materials in USD (see above).