This page provides information about the XGen Arbitrary Primitive Generator.
XGen is an Arbitrary Primitive Generator that instances primitives on polygon surfaces, allowing artists to create complex assets such as fur, feathers, grass, and so on. Instancing geometry is controlled through expressions, guides, direct placement, maps, etc. V-Ray can render two kinds of primitives from XGen: Splines and Archives.
The XGen features described here pertain to V-Ray 3.0 for Maya 2015 and newer. Support for Maya 2014.5 (called export to vrscene) is very limited (no animation/motion blur, no batch render support, etc.) and is a subset of the support for XGen in Maya 2015.
In order to use XGen in Maya, the XGen plug-in must first be enabled.
Note: This information relates to rendering with V-Ray and not overall XGen usage and workflow.
For more information on using XGen with V-Ray for Maya, see the XGen Tutorials.
||Windows menu|| > Settings/Preferences > Plug-in Manager > xgen options
XGen in Maya Batch Mode
To render in batch mode, export the patches from all collections in the scene for batch render (to an alembic file) from the XGen Window as shown below:
When Motion Blur is enabled in the scene, you need to use the Export Patches for Batch Render option. Otherwise, the xGen geometry is not visible in the render.
The following dialog appears. If XGen primitives are animated, enable the Animated option, set the Frame Range, and click Export File. When the animation is of x frames from A to B, set the frame range in this dialog from A to B+1.
Whenever you change anything regarding an XGen collection/description (XGen attributes, modifiers or the original geometry) you will have to re-export the .abc file as shown above.
Please note the following about Alembic files exported for batch rendering:
- If the animation contains non-integer keyframe times, they will be interpolated linearly between their respective floor and ceiling values. For example, for time 1.2 the sample will be interpolated linearly between 1.0 and 2.0. For 5.7, the interpolation will be between 5.0 and 6.0.
- The results might differ slightly from renders in Maya Interactive Mode without the use of an Alembic file when the interpolation in the scene is not linear (which is true by default; see Windows menu > Animation Editors > Graph Editor).
Caching XGen Primitives to a .vrscene
XGen primitives (splines/archives) can be cached to a .vrscene so that consecutive renders of the same unmodified primitives take less time to export. This is most useful for large amounts of primitives with complex XGen expressions/guides on a complex source geometry, when the export time becomes minutes rather than seconds. The vrscene cache can also be used with the new vrscene node from the V-Ray section of the Create menu.
Note: This feature is not the same as the Maya 2014.5+ XGen support through vrscenes, which is now deprecated.
The options for vrscene caching are located in the VRay Settings section of the Preview/Output tab of the XGen window.
Use vrscene cache – Enable this option to use a previously exported vrscene cache when rendering.
Export material for hair – By default, only the geometry gets cached, allowing you to change the hair material without having to re-export the XGen geometry. Enable this option to export the material for hair so the resulting vrscene cache can be usable with the vrscene node.
vrscene cache file – Sets the file to export or use.
Export vrscene cache – Exports the cache to the specified file.
To export a cache, give a path to a .vrscene file and click the Export vrscene cache button. Then to use the cache, enable the Use vrscene cache option and do a normal render.
Note the following about vrscene cache:
- Caches are per-description and not per-patch.
- When caching archives, everything gets cached including materials, textures, bitmaps and geometry. If anything is changed, the cach must be re-exported.
- Note that with V-Ray 3.60.03 a single .vrscene file is generated for the purpose of simplifying the workflow.
- When exporting hair to the vrscene cache, the hair will not yet be tessellated. Tessellation happens just before rendering by V-Ray so the cache stays small.
- The export of the cache will take into consideration the current animation and motion blur settings.
- If you are rendering a layer different from the default one and using a vrscene cache, the cache must have been exported from that layer (the layer name is appended to the vrscene filename by V-Ray automatically).
- For render managers: the .vrscene file should probably be put on a network location accessible by everyone so only one machine does the export before starting the render manager.
Scripting the Caching Operation with Python
Below is sample Python code that can be used to export the vrscene cache.
V-Ray has options for the tessellation of XGen splines.
Go to the Preview/Output tab, and from the Output Settings choose V-Ray as the the Renderer. Find the V-Ray Settings in the Preview/Output tab.
The Hair Tessellation Mode and the slider below it can be used to tweak the tessellation and thus improve rendering speed, memory footprint and quality.
Per Spline Mapping
V-Ray can control per spline colors using the VRayHairSampler node's Distance Along Strand output and XGen's root_color and tip_color parameters. The parameters are defined in the Custom Shader Parameters section of the XGen Preview/Output tab. This method is discussed in detail in the XGen Spline Primitives tutorial.
In addition, V-Ray supports custom color and vector type parameters with arbitrary names. They can be extracted using a VRayUserColor node.
The example below illustrates two custom color parameters with Ptex maps. The VRayUserColor nodes allow the Ptex maps to be used with a ramp and VRayMtl.
- XGen Delta files are supported for use with V-Ray.
- When working with groomable splines, if a render or an IPR render happens, to continue updating the splines with respect to the groom splines, one has to refresh XGen, groom a bit more and refresh again. Only then will the splines regenerate accordingly to the groom splines (which are only for the viewport).
- V-Ray supports textures for interactive groom splines in Maya 2017.