Rendering with V-Ray
In this tutorial, we present a method to render Golaem Crowd simulations with V-Ray 3 in 3ds Max. The really big advantage of this method is that it uses the procedural rendering (saving a lot of space and enabling to customize shading and asset repartition after simulation) in 3ds Max. Note that the procedure explained on this page will only work from Golaem Crowd 4.3.
Notice that you need the following versions of Golaem and V-Ray for this process to work:
- 3ds Max 2015, 2016 or 2017 (reach us here for another version)
- V-Ray 3.30.XX and 3.40.XX for 3ds Max (below version will not work !!)
- Golaem 4.3 (and above) for Maya 2015, 2016 or 2017
The figure below details the workflow of the render of Golaem Crowd simulations with V-Ray in 3ds Max. For a better understanding of the process, check the Golaem Crowd Rendering Workflow.
Setup Simulation in Maya
Create your Crowd Simulation within Maya using Golaem Crowd. In our example we will use the stadium scene from the Golaem Crowd Samples. Once the simulation is done, open the Simulation Exporter to export the Simulation Cache, import the Crowd Shaders in your Maya scene and create a V-Ray Render Proxy.
From Golaem Crowd 4.3, the V-Ray Render Proxy defines attributes to export custom .vrscene files for 3ds Max:
Specify the directory in which you'd like the files to be exported and press the "Export 3ds Max VrScene files" button. You will obtain two files:
- cacheName.proxyNodeName.vrscene which defines how V-Ray should handle the exported Simulation Caches and render them as Crowd Characters (e.g. all the parameters defined in the VRay Render Proxy). Details about this .vrscene file can be found here.
- cacheName.proxyNodeName_shaders.vrscene which contains the shaders used by the exported Crowd Entities.
Left: more than 200 objects in the scene - Right: less than 200 objects in the scene
Setup 3ds Max
A few steps must be undertaken for 3ds Max to be able to render with Golaem Crowd.
Installing the VrayGolaem 3ds Max plugin
In addition to VRay for 3ds Max, it is required to install another 3ds Max plugin which makes the bridge between the VRay plugin and the Golaem plugin. This plugin can be downloaded below and is made of four files:
- vraygolaemXXXX.dlo, vraygolaemhslXXXX.dlt and vraygolaemswitchXXXX.dlt which should be installed in Drive:\[3ds Max XXXX installation directory]\plugins\vrayplugins
- vraygolaem.py which should be installed in Drive:\[3ds Max XXXX installation directory]\scripts\Python
Adding Golaem Crowd VRay Plugin to your Environment
Then, for the VRayGolaem bridge to be able to find Golaem Crowd VRay Plugin, two environment variables must be set. There are many ways to add a path to an environment variable, however for our test, we chose to create a bat file to launch 3ds Max with the correct environment:
:: Set Environment Variables
:: Launch 3ds Max
"C:\Program Files\Autodesk\3ds Max 2015\3dsmax.exe"
Paths obviously depend on your own installation (do not forget the \bin and the \procedurals at the ends) and that it is important for the Golaem Crowd related paths to be before the %PATH% and the %VRAY30_RT_FOR_3DSMAX2015_PLUGINS_x64%.
Finally, do not forget to change the name of the VRay variable if you're using 3ds Max 2014 or 2016.
Rendering a Simulation in 3ds Max with VRay
A VRayGolaem node is a 3ds Max proxy object which references a crowd .vrscene file and a shader .vrscene file and handles the rendering of a Golaem Crowd simulation in 3ds Max at render time. It can be created from the Create tab of the Command planel, VRay category, select the VRayGolaem button in the Object Type panel, and then click and drag in a viewport to create it.
The node has two attributes to load the Crowd and the Shader .vrscene files (optionnal). You can specify Texture search paths using the VRAY_ASSETS_PATH environment variable if needed.
Once the Crowd .vrscene file loaded, the other attributes of the node will be automatically filled according to the content of the file. They now can be edited to change the rendering results (motion blur properties, subdivision attributes...). The 3ds Max node attributes are the same than the Maya node.
Those parameters will also enable to display the Crowd Entities as bounding boxes within 3ds Max viewport (notice that frames 0 and 1 are not exported and nothing will be displayed for those) :
When you're happy with everything, render with V-Ray and you're done!
Notice that this method has the same properties than rendering inside of Maya. It means that it supports 3d motion blur, displacement, frustum culling, subdivision surfaces, shading variation, render passes... More here. The only not supported feature in 3ds Max is light linking.
Assigning 3ds Max Shaders
By default, the shaders used by the VRayGolaem node for the Crowd Entities are exported from Maya in a .vrscene file and loaded in the Shaders .vrscene attribute. Those shaders can be directly created in 3ds Max.
Assign a Multi/Sub-Object material to the VRayGolaem node and create as Sub-Objects as you need. For each of those Sub-Object create a Shader from the V-Ray Materials library (Standard 3ds Max shaders are not supported) and rename it according to name of the Shaders stored the Character File postfixed with a "@" (see image below). At render time, those shaders will be updated and made available to Crowd Entities:
If a Shader listed in the Character File, with the same name, is found both in the Shader .vrscene file and in the VRayGolaem Sub-Objects, the one in the .vrscene file will be used in priority. To fix this, you can either remove the Shader .vrscene file from the proxy node or reexport the Shader .vrscene file from Maya after having deleted the Shader node from your Maya scene.
If a Shader listed in the Character File, with the same name, is not found (neither in the Shader .vrscene file nor in the VRayGolaem Sub-Objects), the default shader is used (the name of the default shader can be found / changed in the VRayGolaem node attributes). If the default shader is not found, the meshes requiring that Shader are not rendered.
Dealing with Shading Variation
Golaem allows to define Shader Attributes in the Character Maker which can be then used to pass random or PP Attribute controlled values to the shading graph. Those values can also be read and used in 3ds Max using the VRay's VRayUserScalar shader. Golaem also provides two VRay maps shaders called VRayGolaemSwitch and VRayGolaemHSL which can respectively be used to make texture variation and color variation. Those maps shaders work the same way than the Maya ones:
VRayGolaemSwitch and VRayGolaemHSL maps in the Slate Material Editor
Thus, if an integer Shader Attribute called tshirt_textureIdx_value with a value between 0 and 3 has been defined on the Tshirt mesh in the Character Maker, a VRayUserScalar shader can be created and set with the same name:
This VRayUserScalar shader can then be plugged wherever you want on the Shading Graph of the Tshirt mesh (which should be linked to the VRay Golaem Multi/Sub-Object shader), such as a VRayGolaemSwitch for example:
Example of a Texture Variation
Thus, if a float Shader Attribute called tshirt_hue_value with a value between -1. and 1. has been defined on the Tshirt mesh in the Character Maker, a VRayUserScalar shader can be created and set with the same name:
This VRayUserScalar shader can then be plugged wherever you want on the Shading Graph of the Tshirt mesh (which should be linked to the VRay Golaem Multi/Sub-Object shader), such as a VRayGolaemHSL saturation attribute for example:
Example of a Color Variation
Texture and Color variation can be combined in any ways and a same VRayUserScalar shader can also be used to feed different attributes within the same shading graph.
Editing the Simulation
All parameters relative to the Render Proxy (motion blur, frustum culling, subdivision, visibility...) can be changed directly on the 3ds Max node or in its Object / VRay properties panel. The actual transformation and scale of the Render Proxy object in the 3ds Max scene is also taken into account.
If you'd like to change any Crowd Shader properties (texture, color, displacement, multi matte IDs...), it can be done on the imported shaders in Maya (and in this case, the Shader .vrscene must be reexported) or on the assigned shaders in 3ds Max (see above).
Finally, if you'd like to change the assets repartition or the shading assignment, it must be done in the Character Maker in Maya. When done, you just need to save the changes in the Character File. Exporting the .vrscene files is not required.
When do I need to reexport the .vrscene files from Maya?
Always remember that because we are using a procedural rendering approach, even in 3ds Max, it is not required to reexport your simulation if you change the mesh repartition (e.g between tshirts and sweatshirts), shading assignment or the shaders index range in the Character Maker's Geometry Tab. 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).
When I load the Crowd .vrscene, the parameters of the node are not updated. What have I done wrong?
To fill the node attributes, the VRayGolaem bridge uses the Golaem Crowd VRay Plugin. If that plugin can not be found, it means that the VRay environment variable used to specify Vray plugins location has not been set correctly and you should get the following message in the 3ds Max Listener :
VRayGolaem: Error loading .vrscene file "C:\maxExport\vray.crowdProxyVRayShape.vrscene". vray_glmCrowdVRayPlugin.dll plugin was not found in environment variable "VRAY30_RT_FOR_3DSMAX2015_PLUGINS_x64" (C:\Program Files\Chaos Group\V-Ray\RT for 3ds Max 2015 for x64/bin/plugins;).
Casual mistake is to set environment variable VRAY30_RT_FOR_3DSMAXXXX_PLUGINS_x64 instead of VRAY30_RT_FOR_3DSMAXYYYY_PLUGINS_x64 when using 3ds Max YYYY (or vice versa) or that the PATH environment variable contain incompatible versions of 3rd party library. The value of an environment variable can be easily check in 3ds Max using the following MaxScript command:
And here're the expected results when querying the value of the environment variables in 3ds Max:
Maya2014\procedurals;C:\ Program Files\Chaos Group\V-Ray\RT for 3ds Max 2014 for x64/bin/plugins;"
I haven't found the answer to my question in the answers above. What else?
Here are some tips to troubleshoot issues:
- Make sure you're using supported versions of Vray For Maya and Vray For 3ds Max. Those can be different for Maya and 3ds Max and can be checked in the Release Notes.
- Make sure it renders in Maya. That's usually a good way to check that the first part of the workflow is valid.
- If something fails (procedural not found, missing shaders, missing cache file...), V-Ray and/or Golaem will almost always warn you in the V-Ray messages window. A more verbose render log can be found in %TEMP%/vraylog.txt
Finally if none of those above worked, please contact us, specify the V-Ray versions used (for both Maya and 3ds Max), copy / paste the content of the 3ds Max Listener / Editor Window and attach the vraylog.txt file