Golaem Crowd Procedural Rendering & Pipeline
Prologue: for readability reasons, this blog post will be mainly illustrated with examples and code samples specific to Renderman-like renderers. If some of you would like details about other renderers, be my guest to add a comment.
Ok guys, I promise this is the last time we’ll talk about procedural rendering (until the next time)! Last month, we’ve seen how wonderful Golaem Crowd procedural rendering is (see part1 & part2), but as a Pipeline TD, you may ask: “ok, this looks great but how smooth does it go in my studio pipeline?”. Here’s the answer.
As you may know, each rendering engine defines a scene description language and needs every frame of each scene (wherever it comes from) to be translated in this format in order to be rendered. This language is able to describe geometry objects, scenes, lights, cameras…
There is no real standard for those description files, and each rendering engine defines its own. It’s called RIB for Rendeman-like renderers (Renderman, 3delight, Guerilla), Mi for Mental Ray… Obviously, those guys did not think about us when making their software… Not even talking about shader writing! Damn them all!

Here is an example of a RIB file describing a simple scene:
|
# sphere.rib: display a sphere # Display "output.tiff" "framebuffer" "rgba" # Output Format 800 500 1 # Picture Size Projection "perspective" "fov" 40 # Camera Persp # World description WorldBegin Translate 0 -3 26 # Move the viewpoint LightSource "ambientlight" 0 "intensity" 2.5 # Light Sphere 5 -5 5 360 # A sphere WorldEnd |
With MentalRay in Maya (and the other highly-integrated renderers), this file translation step also occurs, but is completely transparent for the user, not to say inaccessible. For example it is not possible to export a mi file without the standalone version of MentalRay.
Golaem Crowd & Scene Description Language
If you do remember well, when dealing with procedural rendering, for each frame, Golaem Crowd exports two files: a simulation cache (including the simulation results) and a scene description file (depending on the chosen rendering engine).
Here is an example of a RIB file exported with Golaem Crowd.
|
# crowdScene.500.rib # # Each line describes a crowd character [parameters] [bounding box] Procedural "DynamicLoad" ["glmCrowdRendermanPlugin" "2 24 0 'SimulationCacheFilePath' 'CrowdAssetManagerFilePath' 'crowdCharacter_0'"] [5.64372 9.0606 -3.07996 8.65929 9.5157 12.9478] Procedural "DynamicLoad" ["glmCrowdRendermanPlugin" "2 24 1 'SimulationCacheFilePath' 'CrowdAssetManagerFilePath' 'crowdCharacter_1'"] [-1.11433 1.46161 -2.4975 7.08014 8.96017 11.6108] … |
That’s it!? Where are the lights, cameras and layout information? Well, as Golaem Crowd is only a matter of crowd simulation, all those data are useless in the RIB it generates. It is no more no less than a sub-set of the final scene (namely the crowd geometry) and then, to be correctly rendered, it needs to be dynamically included in the main RIB scene file (containing the light, cameras and so on):

What is the main advantage of such a mechanism? Well, even if you’re not happy with your lights, shaders or camera traveling, you don’t need to compute you crowd simulation again! Open Maya, tweak the required parameters, export your new scene and let’s render again!
External Rendering
There are two ways to render a scene:
- Internal rendering: press “Render” in Maya and wait for it. With this method no need to export your scene & shaders but it requires a Maya token all along. Not really convenient for heavy renders;
- External rendering: exactly the opposite of the one above. Export your scene from Maya and launch the render outside Maya with your rendering application.
Let’s start with external rendering then. Each rendering engine offers its own way to include sub-scene description file in its main description file: ReadArchive for Renderman, #include for VRay, $include for MentalRay… So, how will our little RIB sphere scene look like with some crowd in it?
|
# sphere.rib: display a sphere and a crowd # # World description |
Depending on your project architecture, you may also need to specify some extra lines to locate the crowd plugins and assets (shaders & textures) directories.
|
# sphere.rib: display a sphere and a crowd # Option "searchpath" "string procedural" ["N:/plugins/:@"] # World description |
As this process should be made for each frame of your animation, I highly recommend you to dust off you scripting skills!
Internal Rendering
Please note that this part is now obsolete if you want to render in Maya. Starting from 2.1 version, Golaem Crowd includes a Renderman proxy which will help you to easily render in Maya. You should have a look at the Golaem Crowd Maya Rendering FAQ instead.
If your rendering engine is integrated with Maya, it is “sometimes” possible to dynamically include a 3rd party generated scene description language in the rendering process… Once again, it also depends on your renderer: there are as many ways to do it as there are rendering engines (if not more).
With Renderman Studio, the Pixar guys implemented a RiReadArchive MEL command (equivalent to the ReadArchive RIB command). God bless them! The best way to use it is to call a little MEL procedure in the Pre Shape MEL command of a Maya object (Attribute Editor / Renderman / Manage Attributes… / Pre Shape MEL):
|
global proc readCrowdRendermanCache() { float $currentFrame = `currentTime -q`; float $frameRate = 24; int $pdcNumber = $currentFrame * floor(6000./$frameRate); RiReadArchive ("N:/crowdScene."+ $pdcNumber +".rib"); } |
Bearing in mind that you may also need to locate your assets (in the Renderman Controls / Advanced Tab / Ri Injection Points / Default RiOptions MEL)
|
global proc setCrowdRendermanOptions() { RiOption "searchpath" "string procedural" "N:/plugins/:@"; RiOption "searchpath" "string shader" " N:/shaders/:@"; RiOption "searchpath" "string texture" "N:/textures/:@"; } |
Press Render and enjoy! Of course the rendered geometry is shaded and motion blurred as well!

Notice that, for now, this RiReadArchive command is not available with RendermanForMaya. Thus, as far as we looked at, it seems that there’s no way to procedurally render your crowd directly from Maya with this version of Renderman.
Finally I'd like to thank Roberto Hradec for his great website which inspired me this last part.

Comments
For better performance...
I would better write :
int $pdcNumber = $currentFrame * floor(6000./$frameRate) + 1 ;
B.A.