Compositing the Velocity Pass from 3ds Max using After Effects

<< Back to Tutorials

Modern 3d packages have the capability to add motion blur as a post effect using a compositing program. This is done by rendering out a velocity pass, and using the colour information stored within it to add a certain amount of blur in a certain direction. The velocity pass is an incredibly useful tool to add motion blur without adding insane render times. True 3d motion blur is a very time intensive task and requires a lot of processing power. Although the velocity pass isn’t quite as good as true 3D motion blur, it’s far quicker and produces some very nice results.

The best thing about adding motion blur in post production is how controllable it is. You can add as little or as much as you like depending on your scene and the lighting conditions.

Below is a video example of the velocity pass in action:

In this tutorial we will:

  • Set up 3ds max to render the velocity pass.
  • Render out two image sequences, one containing the animation, the other containing the velocity data.
  • Composite the two passes together in After Effects and adjust the amount of blur as required.

.

Setting up 3ds Max

If you don’t have a scene to work with, download this 3ds Max file. (Made in 3ds Max 2009)

The scene provided is a 100 frame animation with a fast moving camera, perfect for this exercise. It’s a simple lighting solution to keep render time down to a few minutes. Setting up 3ds max to render out a velocity pass is very simple process. All we need to do is enable the velocity pass in render elements and choose a location to save it.

Open Render settings (F10) and navigate to the ‘Render Elements’ tab. Click ‘Add…’ and select ‘Velocity’. At the bottom make sure ‘Filtering’ is unticked. Filtering will add anti-aliasing onto the velocity pass which is not required.

add_element

.

With the velocity pass selected scroll down to the parameters rollout and tick the ‘update’ box.

When this box is ticked the Maximum velocity number will automatically update on your next render. The maximum velocity is the speed at which the fastest object in your scene is moving. It’s very important to set this correctly. If the value is too low then motion blur will not work correctly.

parameters1

.

In this animation the camera is moving fastest at frame 50. Go to frame 50 in the timeline and with the Camera01 viewport selected press ‘F9′. This will produce a render of frame 50. If you open up Render Settings again and navigate to the velocity parameters you will notice that the number has been updated. Remember this number as we’ll be using it later. You can always round it up to 70 to help remember it. It’s fine to round up, but never round down as this will adversely affect the final result. With the maximum velocity set, untick the ‘update’ box.

parameters2

.

Navigate to the Common tab in Render Settings and choose a save location.

It’s important that we save the velocity image sequence in a very high quality lossless format. OpenEXR is a very good choice for this and allows you to save images with a depth of 32bits per channel. This is very important because the blur is completely dependant on the pixel colour, and even the smallest change can have a large effect.

save

.

Once everything is set up press render and make a cup of tea. It should only take a few minutes to render the image sequence.

.

Compositing in After Effects

In order to composite the velocity channel in After Effects you need to use a plugin called ‘ReelSmart Motion Blur’. It unfortunately isn’t free, but you can download a free fully functional version from their website. The only downside is that this version adds orange crosses to the composition, but it’s still perfectly usable as a demo. Once it’s installed drag the three plugin files from its install directory into the AE plugins folder.

You can download the previously created image sequences rendered from 3ds Max here.

Open up After Effects and click File > Project Settings.

Change the depth to 32 bits (float).

As a side note if you ever composite elements such as rawGI, Lighting and Diffuse, make sure ‘Blend Colours Using 1.0 Gamma’ is ticked. Without this ticked the composition will not blend together properly.

project_settings

.

Load your two image sequences into AE and add them both to a composition. Put the velocity sequence above the normal render and hide it.

composition

.

It’s important to set the gamma correctly for the velocity pass. By default After Effects interprets the file as using linear light with a gamma of 2.2. We need to tell AE not to do this as it messes up the motion blur.

Right click on the velocity image sequence and click ‘Interpret Footage > Main…’.

A window will appear showing the various settings it has automatically chosen.

Press the ‘Colour Management’ tab and change ‘Interpret as Linear Light’ to Off.

You should see the file get quite a bit darker after pressing OK.

gamma

.

Select the visible layer and add the reelsmart vectors plugin from the effects menu.

Change the source to the velocity image sequence.

Change the amount of blur to the value we saved earlier – I used 70.

Adjust the amount of blur you would like on your composition.

reelsmart

.

That’s it, hopefully by now you will have great looking blur on your renders – all created in post production.

.

Looking at the Velociy Pass in More Depth

This has been a quick tutorial on how to add Vector motion blur using the Reelsmart plugin. There are however a few key issues surrounding this plugin that should be discussed:

  • Vector motion blur is created using X and Y velocity data contained in the red and green channel respectively. For this reason the blue channel can be considered redundant, and can be safely removed. This can be achieved in After Effects by using a ‘Shift Channels’ effect, and choosing ‘Full Off’ in the blue channel. There is no need to do this, but it may explain why the velocity image from 3ds Max may look a little different when compared to results from other programs.

blue_channel

.

  • EXR files are capable of containing lots of extra channels as well as the standard RGBA channels, including velocity data. This can be achieved by choosing ‘Setup’ when selecting EXR as the output filetype in 3ds Max and adding the required channel. There is however a very important difference between the embedded velocity channel in the EXR and the separate render elements EXR file created by 3ds Max.
  • The separate velocity file saved from render elements (that’s also shown in the frame buffer) considers zero motion blur to be at 0.5 (or mid grey), full positive blur at 1 (white), and full negative blur at 0 (black). This is exactly how Reelsmart interprets blur so this file should be used rather than the embedded velocity data in the EXR file. After Effects isn’t great at accessing these embedded files and requires a separate (but free) plugin called ProEXR. From CS4 upwards this plugin is however now included.
  • The embedded velocity channels within the EXR file consider zero motion blur to be 0, full positive motion blur at 1, and full negative motion blur at -1. If you use this with Reelsmart you will get some very nasty results, but this can be resolved by increasing brightness by 50%. Node based Compositing programs such as Fusion and Nuke interpret velocity data like this, so it’s great that 3ds Max supports both methods. It is possible to use the separate velocity file in Nuke or Fusion by reducing brightness by 0.5.

.

exr_outputs

.

  • Reelsmart is great at blurring objects within a scene that all have a similar level of blur, or like in this scene, a nice falloff from fast to slow. If you are getting some nasty edges around your blurs (say for example because object A is moving very fast in front of object B) then you will need to render off an aplha channel for the foreground object and use it with the vector pass. Once you have done this your sharp edges should become nice and blurred again. In the example below the red box is moving from left to right, in front of the blue box. Note on the left picture that the blur suddenly stops when it reaches the edge of the box’s dimensions, whereas the blur on the right correctly fades off. Interestingly this seems to happen with ReVision and Nuke’s vector blur tools; Fusion requires no seperate alpha resulting in a much simpler and quicker comp.

alpha_issues

.

Thank you for reading this, and I hope you’ll find it useful. Tim.

Copyright © 2012 - Tim's Online Portfolio