Simulation Cache Reader Plugin

This sample shows how to use the Simulation Cache API and Geometry Generation API to load a Golaem cache, and generate the entities geometry.


Result of a Cache Reader node

FILES

The sample is installed in GolaemCrowdPluginDir/devkit/samples/glmCrowdSimulationCacheReaderPlugin.

glmCrowdSimulationCacheReader.h & glmCrowdSimulationCacheReader.cpp Maya dependency node which loads a simulation cache file and generate the geometry.
glmCrowdSimulationCacheReaderPlugin.cpp Maya plugin entry points.
glmCrowdSimulationCacheReader.mel Mel commands to execute in the script editor to create the mesh, the dependency node and connect their attibutes.
glmCrowdSimulationCacheReaderPlugin.mll Compiled version of the code as a Maya plugin

DEPENDENCIES

In order to compile this plugin, this sample requires the following dependencies:

Maya This sample being a Maya plugin, Maya libraries are required.
glm_crowd.h Single file library needed to load Golaem Simulation Cache files.
glm_crowd_io.h & glmCrowdIO.so (or .lib and .dll) Library needed to generate the geometry from the cache.

PLUGIN

Once compiled this sample output is a Maya Plugin which declares a dependency node called GlmSimulationCacheReader:

CREATION

  • MEL commands to create the GlmSimulationCacheReader node :​

createNode GlmSimulationCacheReader;
 

CONFIGURATION

This node defines the following attributes:

Input Frame Number of the frame to load
Cache Name Name of the Simulation Cache to load
Cache Directory Directory where the Simulation Cache files have been exported
Crowd Field Name Name of the CrowdField to load
Character File File path to a Golaem Character File
Terrain Destination File Name Directory for the generated terrain if any
Layout File Name Path to the history file of the cache (gscl) if any
Cache Import Mode

There is two import modes :

  • All in a single Mesh : This will import the whole cache in a single mesh. It is faster to process, but there won't be any shader information on this mode, only raw geometry
  • One mesh per entity & asset : This mode is slower, and will split the scene into each mesh asset as it would be done on an equivalent FBX or alembic import. If the shaders are present, they will be linked. Note that this mode is closer to what our renderer plugins : the instances & shaders can only be handled correctly by doing so.