Square Enix © Goodbye Kansas

Table of Contents

This page provides a tutorial on using XGen Animation and Motion Blur with V-Ray.


 XGen primitives can be animated in a few ways:

  • By moving the mesh on which they are instanced
  • By changing attributes from frame to frame
  • By animating guides
  • By simulation

XGen attributes are keyable just like standard Maya attributes (right click menu):

Attributes that do not have a slider and cannot be keyframed can be converted to a Maya attribute for keyframing.

You can also animate through expressions and the use of the $frame variable.

Before doing these tutorials, it is recommended that you read the  XGen General  page first.


Required Steps

You can render animations and motion blurred frames in Maya Interactive Mode or Maya Batch Mode

In Maya Batch Mode, an Alembic file is required. You will first have to export the patches for each collection in the scene through the XGen UI to an .abc file (Alembic file). See the XGen in Maya Batch Mode section of the XGen and V-Ray in Maya 2015 and newer page for details on how to do this.

Alternatively, you can force the use of the Alembic file while in Maya Interactive Mode by enabling the Require Alembic File With Exported Patches for Animation option from the V-Ray Settings from the Preview/Output tab of the XGen window:

When the Require Alembic File With Exported Patches for Animation option is enabled, renders will be guaranteed to be the same as in Maya Batch Mode. 

Animation Examples

XGen Attributes

If you make a plane and instance splines on it with a degree of density, you can animate the Length attribute using a texture map (as shown in the XGen General tutorial) with this expression:

$a = 1.0 - $a;
$a = $a - ((25 - $frame) / 24);
$a = clamp($a, 0, 1) * 1.5;

This inverts the length from the map and makes it from 0 to 1.5 depending on the frame (in the 1-24 frame range).

If we render a 24 frame animation (from the V-Ray Common render settings) we get this:

And here is an example of an animated XGen Archive (archive taken from the XGen Archive Primitives page)

Using this expression to the XGen Twist attribute:

$a = ((25 - $frame) / 24);
rand(-180, 180) + sind($a * 360 + 90) * rand(0, 120)

Archives can have animation inside them. For more information, see the XGen Archive Primitives tutorial.

Moving Geometry

You can also have an animation with moving geometry that XGen primitives get instanced onto.

If you animate a sphere to move and rotate for 24 frames, instance XGen splines on it, colorize them with a texture (like shown in the XGen Spline Primitives section) and export the patches for batch render (as explained in the Required Steps section above), the result looks similar to the following:

Motion Blur Examples

To create motion blur, create an animated scene as shown above and enable motion blur from the V-Ray Render Settings as shown below.

Also do not forget to export the XGen Patches for Batch Render, as discussed in the Required Steps section above.

The example below is a motion-blurred scene with a rotating sphere that has red XGen splines instanced onto it.

And here is a motion-blurred scene with an animated Bend U attribute (through keying) with splines.

Notes and Limitations

  • When using an Alembic file with exported patches with motion blur (in Maya Interactive Mode or Maya Batch Mode) if there are 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.
  • Such non-integer keyframe times can be made through the camera motion blur settings of the V-Ray Render Settings by changing the Geometry Samples, Duration and Interval Center.
  • The results might slightly differ 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).
  • The scene can also be exported to a vrscene while in Maya Interactive Mode  (to get the right samples) and rendered with V-Ray Standalone.