Motion Vector Export (mental ray)
 
 
 
Command entry:Main toolbar (Render Setup) Render Setup dialog Renderer panel Camera Effects rollout Camera Shaders group Output button Material/Map Browser Maps mental ray Motion Vector Export

This shader is intended for those who wish to do compositing work before applying motion blur, or to use a specific third-party motion-blur shader. Its purpose is to export motion in pixel space (mental ray’s standard motion vector format is in world space) encoded as a color.

Most third-party tools expect the motion vector encoded as colors where red is the X axis and green is the Y axis. To fit into the confines of a color (especially when not using floating point and a color range extends only from black to white), the motion is scaled by a factor (here called Max Displace) and the resulting value range, which is –1 to 1, is mapped to the color channel’s 0 to 1 range. The shader also support a couple of different floating point output modes.

Interface

Max Displace (pixels)

Sets the maximum encoded motion vector length. Motion vectors of this number of pixels or above are encoded as the maximum value that is possible to express within the limit of the color (that is, white or black).

To maximally utilize the resolution of the chosen image format, it is recommended that you use a Max Displace value of 50.0 (the default) for eight-bit images (which are not really suitable for this purpose) and a value of 2000.0 for 16-bit images. The shader outputs an informational statement of the maximum motion vector encountered in a frame to aid in tuning this parameter. For details, consult the documentation for your third-party motion-blur shader.

If Max Displace is 0.0, motion vectors are encoded relative to the image resolution. For example, for an image 600 pixels wide and 400 pixels high, a movement of 600 pixels in positive X is encoded as 1.0 in the red channel, while a movement 600 pixels in negative X is encoded as 0.0. A movement in positive Y of 400 pixels is encoded as 1.0 in the blue channel etc.

Blue Channel is Magnitude

When on, the blue color channel represents the magnitude of the blur, and the red and green channels encode the 2D direction only. When off, the blue channel is unused and the red and green channels encode both direction and magnitude.

Floating Point Format

When not set to 0, the shader writes real, floating-point motion vectors into the red and green channels. They are not normalized to the max displace length, not clipped, and contain both positive and negative values. When this option is used, neither Max Displace nor Blue Channel Is Magnitude have any effect.

The floating-point format options are:

  • 1The actual pixel count is written as-is in floating point.
  • 2The pixel aspect ratio is taken into account such that the measurement of the distance the pixel moved is expressed in pixels in the Y direction, and the X component will be scaled by the pixel aspect ratio. This format is compatible with Autodesk Toxik.
Blur Environment/Background

When on, motion vectors are generated for the empty background area controlled by the camera movement.

NoteThis option does not work when the Scanline rendering algorithm is enabled.