Hair rendered using XGen (image courtesy of Jonas Tornqvist).
MtoA supports Maya's XGen, a powerful geometry instancing tool.
There are some current limitations when using XGen with MtoA. These are as follows:
The Primitive Type 'Card' is not supported.
Ensure that the MtoA plugin is loaded prior to the XGen plugin otherwise Arnold will not appear in the Renderer list.
The XGen MtoA attributes can be found under the Preview/Output tab. You must first change the Renderer to Arnold Renderer. You will then see custom Arnold curve and motion blur settings.
Live allows XGen to query patches and guide animation directly from Maya. This does not support Motion Blur and will try to reuse information the preview generated.
Batch Render mode will always read geometry and animation from files. Batch render mode is always on when doing a batch render. You must first export the patches and guide animation to caches. Use this mode to make sure your caches are properly exported before doing a batch render.
Apply default Arnold XGen Hair Shader to the current Description. The shader reacts to root_color, tip_color and back_color XGen custom shader parameters.
In order to change the Opacity of XGen splines you must first select the XGen description and then disable Ai Opaque within the Extra Attributes of the Attribute Editor.
To obtain color information from XGen splines, such as those found in the XGen Presets, you will need to add the following steps.
- Go to the XGen window (Preview/Output tab) and make a note of the custom shader parameters names.
2. Assign a shader to the XGen description.
3. Connect an aiUserDataColor shader to the color attribute of the shader that you want to use (e.g. root color).
aiUserDataColor shader connected to aiHair attributes
4. Add the name of the attribute to the Color Attr Name attribute of the aiUserDataColor shader. In this case it is 'root_color'.
XGen hair color rendered using aiUserDataColor
An example scene file that demonstrates this process can be found here.
Choose between Global Settings (uses the MtoA motion blur Render Settings), On or OFF.
Motion Blur and Splines
It is important that you use the following steps when rendering motion blur with XGen splines.
- Ensure that your scene is saved.
- With the geometry and XGen description selected, go to 'File>Export Patches for Batch render'.
- Enable motion blur in the XGen description or in the Render Settings (remember to choose Global settings in the XGen Description).
- Save the scene again.
The following steps go through the process of rendering a head model (kindly provided by Lee Perry Smith) as an XGen archive.
- Open the head scene file. You will need to assign an Ai Skin shader is to it and connect the relevant texture maps to it (remember to convert the texture maps to .tx format using the TX Manager in order to get faster feedback when rendering). A guide to rendering realistic skin can be found here.
- Before you export the mesh as an archive, you must first save the scene, otherwise XGen will fail to export it.
- Select the head mesh and go to XGen>Export Selection as Archive(s)... (alternatively you can convert a saved scene to an archive using Create from Selection... under Archive Files once the description has been created).
- The Export Selection as Archive(s) window should appear. Change the Archive Name to Head.
- Select a folder where you want XGen to save the archive file and select Export. XGen will then export the model as an archive file within the selected folder.
When exporting geometry as an archive, ensure that the name has no colons. For example, a mesh named
Head:Group3919Shape will not export properly as an archive using XGen. Deleting the colon will fix the problem.
You should see the Export Selection as Archive(0) Progress window when XGen is exporting the mesh:
- The next stage is to create a new scene with which we can render the head model as an XGen archive.
- Create a polygon plane. We will add the XGen description to the plane and it will also double up as a floor plane. Select the polygon plane and select XGen>Create Description. The XGen window should appear. Click on Create New Description....
If the archive has not exported correctly, check that the MtoA Render Settings are loaded prior to exporting.
- The Create XGen Despcription window will appear. Change the New Description Name to Heads.
- Choose Custom Geometry/Archives (use for any model you have created) as indicated in the image below:
- The XGen window should replace the attribute editor. Before opening the archive file, reduce the Percent value to a low value in the Preview Settings (Preview/Output tab). This is a good habit to get into as XGen could automatically create many instances in the viewport, depending on settings such as the Density. If the percentage is too high it can cause Maya to crash without any prior warning.
- Go back to the Primitives tab. Scroll down to Archive Files and select Add.
- Go to the location where you saved the XGen archive file and select it. It should be called something like Head-model.xarc
- You will be prompted with the following window. Select Yes to import the materials that were saved with the archive file (you can change the material assignment later if you wish to do so).
Import head material into scene
Increasing the Density will increase the number of primitives.
- To view the XGen archive model in the viewport, slowly increase the Percent value in the Preview Settings. If you cannot see the head model, you may have to adjust the Size value (underneath the Add... button in Archive Files).
- XGen has placed the heads randomly across the surface because this is the default option when creating a description. If you want the primitives to be placed in rows and columns, you can do so by selecting In uniform rows and columns in the Generate Primitives menu under Generator Attributes (Primitives tab).
- When Generate Primitives is set to In uniform rows and columns the Spacing attribute replaces Density. Increasing the Spacing attribute increases the distance between the primitives.
- If we save a log file we can view the total number of unique objects and polys within the scene (increase the Max. Warnings to 6 ). For example, if we look at the log file for the render below, we can see that it contains 378001 head objects and a total of 71725596842 visible triangles.
378001 head objects (71725596842 visible triangles) rendered with XGen
Thanks to James Busby for the use of his head model scans.