Part 3: Rendering a 2D Motion Vector Sequence Using Maya 2009’s Built-in Render Pass

This segment will cover usage of mv2DNormRemap, the Mental Ray 2D Motion Vector Render Pass. It’s a newer and easier method than the lm_2DMV shader covered in the last section.

With the release of Maya 2009 it became unnecessary to use lm_2DMV because Mental Ray can now export a native render pass that produces the same data. For those of you who don’t yet have Maya 2009 or just want to use the tried-and-true method, go back and study the  previous section:

<<Part 2: Installation and Use of The lm_2DMV Mental Ray Shader to Create a Motion Vector Sequence

If you have already completed Part 1, then you can skip this section and go directly to Part 4:

Part 4: Use of The ReelSmart Motion Blur Plugin to Convert Motion Vectors Into a Motion Blur>>

Why Is mv2DNormRemap Better?

  • No shader installation
  • Faster rendering because it outputs during the same render as the beauty pass
  • Supports a higher Max Pixel Displacement value

Step 1. Make Separate Foreground and Background Render Layers

Render Layers

Make two render layers that contain everything in your scene. You can do this by duplicating the masterLayer twice.

backgroundOn the background layer, you need to turn off primary visibility of all foreground geometry.

  1. Make sure that the background render layer is the active layer.
  2. Select the foreground geometry (what will be blurred).
  3. Go to Window -> General Editors -> Attribute Spreadsheet-> Render tab.
  4. Pick every field under Primary Visibility.
  5. Type 0 (zero) and press Enter.
  6. This should change every field to “off.”

workerNow activate the other render layer that will be your foreground beauty pass.

On this layer, turn off Primary Visibility on all of the background geometry to isolate the foreground instead.

The reason that the primary visibility attribute is better than simply hiding or not adding certain geometry to a layer is that, with this method, all the hidden objects are still casting indirect light from final gather, as well as their shadows and reflections (if you want), onto your visible geometry.

Step 2. Activate and Tune the 2D Vector Pass

  1. Select the Foreground render layer that contains the geometry you wish to motion blur.
  2. Open the Render Settings window.
  3. Select the Passes tab.
  4. Create a new pass (top right button in the image).
  5. From the pop-up list, choose Normalized 2D Motion Vector.
  6. Close the pop-up.
  7. In the Scene Passes box, highlight the new mv2DNormRemap.
  8. Then click the red down arrow to apply this pass to your current render layer.

renderpasses

Now, whenever you render out this layer, you will get the expected beauty layer and also the 2D motion vector layer. The vector layer may be embedded into the same OpenEXR file as the beauty pass, or it may end up with its own file sequence, depending on what naming conventions you use in the Common tab.

Now highlight the mv2DNormRemap in its new home in the Associated Passes box, and then double click on it. This should bring up the Attribute Editor and give you some options for this pass. The options are basically equivalent to the lm_2DMV options. Instead of Normalize, you have the Max Disp. option. They do exactly the same  thing.

lm_2DMV “Normalize” = mv2DNormRemap “Max Disp.” = RSMB “Max Displacement

Adjust the Max Disp. value. What this value is asking is, “In pixels, what is the most that the object will move between one frame and another?” Then it takes the internal motion vector data and clamps it down to a range based on this setting. As long as you are rendering as a 16-bit image, then you can set this value to 1024 (the highest value it supports). You will still get plenty of detail in the image without needing to clamp it down further. Whatever value you set this to, you need to also enter that number into the Max Displace field later on in the RSMB plugin.

The option box for “Automatic Max Pixel Disp.” functions by looking at the active camera’s frame size and by setting it to the diagonal measurement of that size. This  can be helpful, but it isn’t useful for our purposes here because we need to know what the exact value is so we can match it in the ReelSmart plugin settings later.

You do not need to turn on motion blur or change any shutter settings before rendering this pass.

If you are going to make other passes in this layer, go ahead and make them now.

Step 3. Make a Second Matte Layer (If Needed)

In many situations, you will use the built-in alphas from your vector or foreground layers and will not need to do anything extra. What I’ve created in this example shows the yellow railing in front of my foreground character layer. This requires an extra step. I had to generate a second matte layer. Using material overrides, I made the railing geometry white (and anything else that obstructed my motion blurred geometry) and everything else black. Remember to apply the same motion blur render settings to this layer as in step 6 (shutter open/close set to 0.5). This layer should be applied in the compositor last. The foreground character and its alpha and blur need to be precomped, and then this railing luma matte needs to be applied to that in order to cut a hole through the foreground character to allow the railing to show. If this matte was added at the same time as the other alpha(s), then the motion blur plugin would try to use the railing obstruction in its blur calculations, which we definitely don’t want.

railing matte

Step 4. Ensure Temporal Parity

Important Tip: By default, any render layer with a motion vector render pass (mv2DNormRemap) applied will render each frame in the sequence at a slightly different point in time than render layers with no motion vector pass assigned. If you are familiar with the lm_2DMV method, then you know that it requires the motion blur in render setting to be activated and then made to do nothing so that the render will internally generate the vector math needed to output the shader. The side effect of this is that, instead of creating each image at the temporal start of the frame, it renders halfway through (i.e., you get the visual equivalent of frame 1.5, 2.5, 3.5, etc.).  Well, this Mental Ray pass works in a similar fashion, but it doesn’t alert you to that fact. You do not need to turn on motion blur, but be aware that it turns on motion blur internally at the time of render. Whereas lm_2DMV you would set the shutter open/close to 0.5, this method internally sets these parameters to around .00001. That means that, on any render layer that does not have a motion vector pass assigned, you either need to turn on motion blur and set the shutter open/close to .00001 or you need to simply tell it to generate a 2D motion vector pass for every single render layer, even the ones you won’t need. There is no way around this; you MUST do it or your layers won’t have temporal parity. So now go back to your background layer and your luma matte layer (if you have one) and fix this.

Step 5. Render It!

Once you have the foreground, background, matte, and vector pass rendered out, you are ready to move on to the compositing stage. If you are following along with the tutorial and are curious about ReelSmart vs. built-in Maya motion blur, then you can render out your masterLayer with the motion blur override on so that you also get a composite beauty layer with blur for comparison.