Rendering With Arnold
In this tutorial, we present a method to render Golaem Crowd simulations with Arnold + sitoa in Softimage. The really big advantage of this method is that it uses the procedural rendering (saving a lot of space and enabling to customize shading after simulation) and enables to customize shading directly in Softimage.
Export Simulation From Maya
Create your crowd simulation using Golaem Crowd in Maya. In our example we will use the stadium scene from the Golaem Crowd samples.
You will obtain two file sequences: simulation cache files (containing positions and animation for each character) and arnold .ass files. Each file in these sequences represents a given frame (there is a naming convention in Golaem Crowd, where the exported file number is frame number x 60 / fps x 100. So if your scene runs at 24 fps, there will be a 250 offset between each file (we will get back to this later).
Note that as Golaem Crowd cannot export before frame 2 (because of Maya limitation), the sequences start at 500.
A few steps must be undertaken for Softimage to be able to render with Golaem Crowd.
Installating & Checking Sitoa Version Compatibility
Obviously Arnold (sitoa) must be installed. You should check that the Arnold version supported by your sitoa version is the same as the one supported by the mtoa Golaem Crowd is linked against. (see Golaem Crowd Release Notes, mtoa trac, sitoa trac). For our test, we have used Golaem Crowd 3.4.1 and sitoa 3.2.0.
Adding Golaem Crowd binaries in the PATH
Then, for Softimage to be able to find Golaem Crowd binaries, their path should be added to the PATH variable. There are many ways to add a path to an environment variable, however for our test, we chose to modify the Softimage setEnv.bat file (located e.g. in C:\Program Files\Autodesk\Softimage 2015\Application\bin).
We added the following line at the end:
Note that the path obviously depends on your own installation (do not forget the \bin at the end), and that it is important for the Golaem Crowd related path to be before the %PATH%
If you want to check that you PATH variable is correctly setup, you can run the following Python command from Softimage and check that you find the Golaem Crowd path in the PATH variable.
import osfor param in os.environ.keys():print "%20s %s" % (param,os.environ[param])
Arnold related paths
Note that to be able to load the Golaem Crowd procedural, Arnold need to be told where it is.
In our example we will do it directly from the Arnold settings in our Softimage scene (see below), however it can also be done using Arnold specific environment variables (see here again the different ways to setup environment variables).
Create an Arnold Standin in Softimage
An Arnold Standin is a proxy object that references an ass file to be loaded at render time.
It can be created on top of any shape in your Softimage scene (e.g. a polygon cube) by adding the Arnold Standin Property (Get / Property / Arnold / Standin).
Note that as explained in the Arnold Standin documentation, you should not change the material name associated to your object (Scene_Material) , or else Arnold will use the material from the cube for all meshes on your characters, and not the ones defined by Golaem Crowd.
In the created Standin, browse to the .ass file sequence exported from Maya. The name of the ass file is automatically filled in using the [frame] token.
As Golaem Crowd uses a special frame padding in order to accommodate for Motion Blur (as explained above), it is needed to create an expression and override the current frame with its result thanks to the options offered by the Arnold Stand-in. Check "Override Frame" and click on the arrow next to Frame to link its value to an expression.
Note that frame 250 never exists because Golaem Crowd does not export frame 1 (because of Maya limitation). So you may want to modify the expression to add an offset (e.g. Fc*250+250)
Also to avoid having to provide a bounding box, uncheck "Deferred Loading", so that Arnold unfold the characters bouding boxes and compute it itself.
Next, let's go to the render options and fill the path for procedural and shaders in the Arnold render options.
You should fill it in with respectively the /shaders and /procedurals path of your Golaem Crowd installation as well as the binaries directory of your sitoa installation.
At this point Arnold is already able to render your crowd geometries, however as no shader is set, your characters will be orange.
Note: as you may know Arnold does not create a default light, so before trying to render, do not forget to add a light in your scene...
Create Shaders For Your Crowds
The first step is to create shaders which names match all shaders defined in the Golaem Crowd .cam file and assign them to an active (not hidden, but possibily out of the camera view) geometry. It can be done manually but the faster method is to import the .fbx character exported by the Golaem Crowd Character Maker (or provided with the Golaem Crowd Character Pack if you are using it).
Note: if you choose to import the fbx file, you may need to check the shaders parameters, and relink them to a correct texture but at least you will not have to create the shaders one by one...
Notice how the shader's name defined in the Character Maker's Geometry Tab matches the one in Softimage. This is what enables Golaem Crowd to find your shaders and handle them to Arnold for rendering.
Render. You should get a nice crowd, but all characters look the same. They all wear either red sweatshirt or red tshirt because we did not introduced shading diversity yet.
Adding visual diversity
When rendering crowds with Golaem Crowd in Maya, it is possible to use the generated Arnold User Data to create visual diversity.
E.g. when using the Golaem Crowd Character Pack, Golaem Crowd will generate a random shader index for tshirts. It is possible to read this value directly in the Render Tree using an Integer_Attribute shader. Its Attribute value should be set via the Script Editor to the user data name defined in the Golaem Crowd Asset Manager.
For example to be able to get the tshirt index generated by Golaem Crowd when using the Character Pack, one should create an Integer_Attribute shader (Nodes/Data/Attribute/Integer Attribute) and launch the following command (depending obviously on the name of the created node)
MAN_MD_torso_tshirt_blinn_textureIdx_value is the name of the user data defined for the tshirt shader in the Golaem Crowd Asset Manager (see screenshot below).
Beware, the Integer_Attribute does not show any value in the Attribute field, even when it has been set (if it has NOT been set correctly, it displays "Use Default Value")
Although this is a strange user inteface design, this is perfectly normal. Do no try to click on the arrow next to this field, or you will just put back the default value...
The tshirt shader defines a Shader Attribute which value is randomized between 0 and 3
This attribute shader can then be linked to any Softimage node in order to create diversity. In the following example we linked it to a ColorMultiSwitch. This switch takes several shaders as input and select one per character based on the Integer_Attribute value (which contains our user data, randomly set between 0 and 3 by Golaem Crowd).
After doing the same kind of setup for t-shirts, pants and hairs, we get a visually diverse crowd as when rendering directly within Maya:
Final Tips & Tricks
Always remember that because we are using the procedural, even in Softimage, you do not need to reexport your simulation if you change the mesh repartition (e.g between tshirts and sweatshirts) or the shaders index range in the Asset Manager File. Just save it, and re-render! (the only case where it is not true is if you setup ppAttributes to be used by shaders attributes, as they need to be exported with the cache)
Similarly, you do not need to export the .ass files sequence all the time. You need to re-export it only if you changed the simulation cache path, the .cam file path, added (or removed) crowdfields, enabled motion blur or if you changed the fps of your scene.
Final Tips: if something fails (procedural not found, missing shaders, missing cache file...), Arnold and/or Golaem Crowd will almost always warn you in the script editor. Check warnings and errors to see what is happening