Rendering MI Files
Golaem Crowd provides a plugin to render characters with Mental Ray.
The plugin is installed under procedurals directory in Golaem Crowd's installation directory.
The file name of the plugin is glmCrowdMentalRayPlugin.dll (.so) and is declared in glmCrowdMentalRayPlugin.mi.
Adding Golaem Crowd Characters to a MI Scene
Golaem Crowd only exports crowd related information in its .mi files. These files must be included in a .mi file describing a complete scene (camera, lights, geometry...). Here are the steps to follow, from a Maya scene to the final image:
Step 1- Export the Maya Scene to a Mi Scene
This is a standard export using the default Mental Ray plugin for Maya (Mayatomr.mll). To export the scene to a .mi file, go to the File Menu / Export All… / Choose "Files of Type": mentalRay
Mental Ray Exporter
For better readability, you can check the ASCII mode and put off the compression in the Mental Ray settings. Then just hit the "Export All" button to export the mi file.
Step 2 - Export the Maya Characters Materials & Shaders to Mi Scenes
This step is necessary for exporting the materials and shaders of your characters. To export the materials & shaders, open your shaded character geometry in Maya and export the scene to a .mi file with the following options (in the File Type Specific Options layout):
Mental Ray Exporter Settings for materials & shaders
With those settings, only the data related to the materials will be exported. The geometry will be created procedurally (at render time) by the Golaem Crowd Mental Ray plugin.
As the Golaem Crowd Mental Ray plugin will use the materials of the characters at render time, this file needs to be included in the final scene.
Step 3 - Include the Character Materials in the Mental Ray Scene File
At the end of the main .mi file created at step 1, just before the instgroup directive, add directives to include the character materials exported at step 2:
…$include "[…]/charactersScene1_shaders.mi"instgroup ":MayaTranslatedWorld""defaultLight""pPlane1""pSphere1""persp"end instgroup…
Step 4 - Include the Golaem Crowd Characters in the Mental Ray Scene File
Just as with the character materials, add the directives to include the .mi files created with the Simulation Tool at the end of the main Mental Ray file created at step 1. In addition to the include directive, the crowd entities instance group should be added to the main renderable instance group.
The name of the crowd entities instance group can be found at the end of any .mi file created with the Simulation Tool:
instance "mRayTestScene_0GroupInstance" "mRayScene_0Group"end instance
Mental Ray also requires declaring the different shaders which will be used in the scene: thus, it is also needed to include the Golaem Crowd Mental Ray plugin declaration .mi file (glmCrowdMentalRayPlugin.mi) and to link the plugin library (glmCrowdMentalRayPlugin.dll). The code below shows an example of the main Mental Ray file:
# Mayatomr 2012.0m# Maya 2012 x64# File C:/mentalRayScene.mamin version "3.9"link "AdskShaderSDK.dll"link "MayaShaders.dll"…camera "perspShape"data "perspShape:fbdata"framebuffer "mayaGlow"datatype "rgba"filtering onuser onoutput = "shaderGlow1:perspShape"framebuffer "mayaColor"datatype "rgba"filtering onprimary onfiletype "png"compression "none"filename "mentalRayScene.png"resolution 1280 960aspect 1.33333aperture 1.41732frame 1 1.clip 0.1 10000.focal 1.37795volume = "volumeEngine1"end camera…# Character Materials Includes$include "N:/mRay/mentalRayScene_shaders.mi"# Crowd plugin link and declarationlink "glmCrowdMentalRayPlugin.dll"$include "N:/glmCrowd/mentalRayPlugin/glmCrowdMentalRayPlugin.mi"# Crowd Includes$include "N:/mRay/mentalRayScene.1500.mi"instgroup ":MayaTranslatedWorld""defaultLight""mRayTestScene_0GroupInstance" # Crowd entities instance group"persp"end instgroupincremental shader "volumeEngine1""adskMayaVolumeEngine" ("instances" [])render ":MayaTranslatedWorld" "persp" "miDefaultOptions"
Step 5 - Render the Scene
Mental Ray must be configured to load the Golaem Crowd plugin. The easiest way to do this is to add the directory of the Crowd plugin to the system path environment variable.
Here's an example of batch file that can be written under windows command line:
@echo offrem usage example: launchMRay.bat "myScene.mi"setlocalset PATH=N:/glmCrowd/mentalRayPlugin/;%PATH%"C:/mentalRay/ray.exe" -verbose 3 %*endlocal
To render the main Mental Ray scene file, open a command line in the folder of the batch file and call the batch file with the same parameters as if calling the Mental Ray stand alone executable.
Here's an example for the scene described above:
launchMray.bat "N:/mRay/mentalRayScene.mi"
A similar file can be written for the Linux shell as well.