RSS< Twitter< etc

XMesh for Maya - Motion Blur


When rendering polygon meshes with Motion Blur, the renderer needs to acquire two samples of the object to interpolate the velocities of its vertices. This means that the topology must be consistent to be able to find matching vertices in both samples.

With Maya primitives, the object will be evaluated at two different times around the frame to be rendered based on the shutter interval specified in the render settings, and as long as the topology is consistent, the correct motion of the vertices will be calculated.

With Alembic caches though, there are a finite number of samples available on disk, and if the topology was changing, they will contain incompatible vertex lists. The Alembic cache will not be able to interpolate the velocities in that case, and no Motion Blur will be generated.

XMesh supports two approaches to generating Motion Blur. The default approach is saving a Velocity channel at caching time and using this channel to extrapolate the sub-samples at loading time. This approach works well with most cases of changing topology. The alternative is interpolating velocities at loading time from the two nearest samples. Obviously, this would work, like with Alembic, only in the cases of consistent topology. It is useful for saving disk space and speeding up saving time when it is known in advance that the topology is not changing over the course of the whole animation segment.

A Simple Motion Blur Test

Let's create a very simple test case and see how the native Maya primitives, the Alembic cache, and the XMesh cache interact with the Maya Software Renderer.

The Basic Scene 

  • Create a Cylinder Polygon Primitive object with a Radius of about 2.5 and a Height of about 12.
  • Set the Subdivisions Height value to 100
  • Add a Bend deformer and animate it from 0 degrees on frame 1 to 180 degrees on frame 24.
  • Create a second Cylinder Polygon Primitive next to the first one with the same settings.
  • Keyframe the Subdivisions Height from 1 on frame 1 to 100 on frame 24.
  • Add a Bend deformer and animate it from 0 degrees on frame 1 to 180 degrees on frame 24.

RESULT: Playing back the animation or moving the time slider will show two cylinders bending into donuts on frame 24, with the right one also changing its height segments over time. 

Caching To XMesh 

  • Select the Cylinder with the changing topology and click the XMesh Saver icon on the XMesh shelf.
  • In the XMesh Saver dialog, the Cylinder will be added automatically as the object to cache.
  • Under Output Path, enter a Name for the sequence, for example "BendingCylinder"
  • Under Revision, enter "v001"
  • In the Frames To Save panel, press Playback Range to set the Start Frame to 1 and End Frame to 24. Leave Samples Per Frame at 1 to save samples only on full frames.
  • Under Channels To Save, make sure "Velocity" channel is checked. By default, both Velocity and all other channels except for Normals should be checked.

RESULT: An XMesh sequence will be written to disk. The size of the whole cache folder should be around 693,460 bytes (the actual size may vary slightly depending on various factors).


Creating An XMesh Loader

Now that we have the cache on disk, let's load it back: 

  • Click the XMesh Loader icon on the XMesh shelf.
  • Navigate to the cache folder specified in the XMesh Saver Base Path, go down into the sequence name folder and into the version folder.
  • Pick the .MEL file with the same name as the sequence, e.g. BendingCylinder_.mel 

RESULT: An XMesh Loader will be created at the world origin and will load the same geometry as the saved object. Move it along X to the right of the second cylinder we cached.

Caching To Alembic

Just for comparison, let's also create an ABC cache using the built-in Alembic plugin. 

  • Select the Cylinder with the changing topology.
  • In the Maya Menus, go to Pipeline Cache> Alembic Cache > Export Selection To Alembic...
  • Specify a file name to save, for example, and save.
  • Using Pipeline Cache> Alembic Cache > Import Alembic... to recreate the Cylinder from the cache and move it to the right of the XMesh Loader.

RESULT: We now have two primitive objects and two geometry caches in the scene. The ABC file created should be around 2,686,302 bytes.

Playing Back The Animation With Subframes 

  • Open the Time Slider Preferences and uncheck the Snap option to allow the Time to be changed at sub-frames
  • Drag the Time Slider to explore the animation of the scene objects. 

RESULT: The first three objects - the consistent topology primitive, the changing topology primitive and the XMesh Loader - will play back smoothly. The fourth object, the Alembic cache loader, will stutter showing only the full frames it cached due to the inability to interpolate between two frames with changing topology.

Rendering With Motion Blur

Now we are ready to test the actual Motion Blur rendering. 

  • Make sure you are in the Front view
  • Open the Render Settings dialog and switch to resolution of 640x480 in the Common Tab.
  • In the Maya Software tab, expand the Motion Blur settings and check the Motion Blur checkbox.
  • Leave the Motion Blur mode at 3D.
  • Leave the Blur By Frame at 1.0.
  • Hit the Render the current frame icon.
  • Click the Display Alpha Channel icon to see the Alpha channel. 

RESULT: The first and the third objects from the left will be motion blurred slightly.

Increasing The Motion Blur 

  • Increase the Blur By Frame value to 2.0 
  • Re-render the frame 

RESULT: The motion blur will be more pronounced on the first and third objects. The second (changing topology Maya primitive) and the fourth (Alembic cache) will show no motion blur.


Using The Shutter Interval And Exploring The Limits Of XMesh Motion Blur 

  • In the Render Settings dialog, check the Use Shutter Open/Close checkbox.
  • Leave the defaults -0.5 / 0.5 values
  • Rerender the frame. 

RESULT: The Xmesh object shows only the geometry from the previous frame (as compared to the source primitive which shows the current frame), and no motion blur is produced. A Warning appears in the script editor saying

// Warning: line 0: TrenderPolyShape::sample: mesh 'sequenceXMeshShape1' delivered an empty surface. // 

This shows that we have reached the limit of the XMesh velocity extrapolation capabilities - the two samples requested by the renderer must still be within the range of the current frame. 

  • Change the Shutter Close value to 0.49
  • Re-render the frame 

RESULT: Now the XMesh Loader is using the same sample to produce both the Shutter Open and Shutter Close geometries, and the Motion Blur works again!



As you can see, the XMesh cache not only uses nearly 4 times less disk space than Alembic, but is also able to produce Motion Blur where even the Maya Primitive source object that was cached could not!