---
title: "XGen Animation and Motion Blur"
canonical: "https://documentation.chaos.com/space/VMAYA/111741683/XGen%20Animation%20and%20Motion%20Blur"
format: markdown
---
This page provides a tutorial on using XGen Animation and Motion Blur with V-Ray.

## **Overview**

---



** **> Macro (anchor)

** **

## **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](https://docs-chaos.atlassian.net/wiki/spaces/VMAYA/pages/111741162) 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:


![image](media://b6909308-4e29-44ab-a4ad-de7bbcc612f4)


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](https://docs-chaos.atlassian.net/wiki/spaces/VMAYA/pages/111741685) tutorial) with this expression:

```php
$a=map('${DESC}/paintmaps/length');#3dpaint,200.0
$a = 1.0 - $a;
$a = $a - ((25 - $frame) / 24);
$a = clamp($a, 0, 1) * 1.5;
$a
```

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:


![image](media://3efbe245-63ab-442b-bed4-43a6f4860c52)


And here is an example of an animated XGen Archive (archive taken from the [XGen Archive Primitives](https://docs-chaos.atlassian.net/wiki/spaces/VMAYA/pages/111741681) page)


![image](media://d1cb50b1-46c7-4f66-8d6f-7d67b72e3511)



Using this expression to the XGen **Twist** attribute:

```php
$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](https://docs-chaos.atlassian.net/wiki/spaces/VMAYA/pages/111741681) 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](https://docs-chaos.atlassian.net/wiki/spaces/VMAYA/pages/111740390) section) and export the patches for batch render (as explained in the [Required Steps](https://docs-chaos.atlassian.net/wiki/spaces/VMAYA/pages/111741683/XGen+Animation+and+Motion+Blur#XGenAnimationandMotionBlur-requiredSteps) section above), the result looks similar to the following:


![image](media://acdbfdcd-58d5-424b-a7b0-09c13fb2c0c9)



## **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.

** **

![image](media://095b10f8-38cc-477c-a759-c82d5c44f496)


Also do not forget to export the XGen Patches for Batch Render, as discussed in the [Required Steps](https://docs-chaos.atlassian.net/wiki/spaces/VMAYA/pages/111741683/XGen+Animation+and+Motion+Blur#XGenAnimationandMotionBlur-requiredSteps) section above.

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


![image](media://1bb3cbf9-6d66-4b5f-87f2-6e57c8808aae)



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


![image](media://801bee8c-bd32-494b-8aa2-85180078c0d7)



## **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**.