Rendering With Unreal Engine

In this tutorial, we present a method to render Golaem simulations with Unreal Engine. The really big advantage of this method is that it avoids baking out geometry from Maya and handles both geometry and shading variation.

Supported Versions

Notice that you need the following versions of software for this process to work:

  • Golaem 6.4 and above
  • Unreal Engine 4.20 and above. Please check the Release Notes

Limitations

For now, some features of Golaem are not supported, this includes:

Workflow

The figure below details the workflow of the render of Golaem simulations with Unreal Engine.

Setup in Maya

Setup the Character Geometry In Maya

When a Character Geometry File is imported within Unreal, meshes with the same materials are merged together. In some situations, it can be useful to keep them separated if their visibility is part of the geometry variation of a Character File (e.g. two different hair meshes sharing the same material, but only one will be displayed per character). To work around this, you can run the following Python script in your Maya script editor, with your Character lookdev file open, to create one material per mesh before exporting it to .gcg:

# make sure to select all the character meshes before executing the following script
import glm.mayaUtils as mutils
import glm.crowdUtils as cutils 
meshes = list(set(mutils.getSelectedObjectsOfType('mesh')))
cutils.makeUniqueMaterialsPerMesh(meshes)

Setup the Simulation In Maya

As Unreal Engine renders scenes at 30fps, it is recommended to set your Maya scenes to 30fps as well

Create your Crowd Simulation within Maya using Golaem . In our example we will use the locomotion 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 Library File (.gscb) will be created in the same directory than the Simulation Cache. It is also possible to add the exported simulation to an existing Simulation Cache Library File using the Library Tool.

The Simulation Cache Library File contains the useful information about exported simulations such as the export directory, the Character Files used...

Setup Unreal Engine

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

Installing the Golaem For Unreal Engine Plugin

The Golaem for Unreal Engine plugin can be found in its own section on the Golaem Download Page and is made of four directories and one .uplugin file:

Adding Golaem For Unreal Engine Plugin to your Environment

Then, for Unreal Engine to be able to find the Golaem For Unreal Engine Plugin, it must be added in the Plugins/GolaemPlugin directory of your Unreal Engine Project. If correctly installed, you should be able to set it in the Plugin list of Plugin Window (Edit / Plugins):

Adding Golaem For Unreal Engine Dependencies to the Unreal Engine Environment

For the Golaem Simulation Cache Library Tool to work properly, some third party dependencies need to be manually installed. If you do not plan to use the Library Tool, you can skup this part.

Installing PySide

To install the PySide Python module, go in the Unreal Engine installation directory  UnrealEngineInstallDir/Engine/Source/ThirdParty/Python/Win64/, open a Command tool in Administrator Mode and run the following commands:

python -m pip install --upgrade pip
python -m pip install --no-warn-script-location PySide
This will install the latest version of PySide in your Unreal Engine Python environment

Load the Python Editor Script and the Editor Scripting Utilities Plugins

In Unreal Engine Plugin Window (Edit / Plugins), enable both the Python Editor Script and Editor Scripting Utilities plugins:

Replaying / Rendering a Simulation in Unreal Engine

TODO