Wiki

Clone wiki

Blender-Add-Ons / motion_blur

Motion Blur

Simple Transformations (e.g. Rotation)

Blender Scene

Here is a simple Blender test scene, with the blades of a toy wind mill, modelled with simple bicubic NURBS patches:

blend/nurbs.blend

Keyframed rotation on wind mill blades

The blades are grouped with the help of an empty, share the same geometry, but use different (colored) materials.

Scene graph for the wind mill

The empty has keyframes for frame 1, 2, and 3. For frame 1 the yellow blade points to the left, for frame 2 it is up, and for frame 3 it's pointing to the right. For our exporters we want to use the render settings which are already there for the internal renderer:

Render settings for motion blur

With the settings from above the internal renderer creates the following image:

Blender's intenral renderer with motion blur

It looks more like several (in this case 32) images were rendered without motion blur and being combined into a single image.

RenderMan

The RenderMan exporter uses the render settings the following way to export a RIB file:

...
Shutter 0.0 0.5
...
WorldBegin
...
  Attribute "identifier" "name" "SurfPatch_left"
  AttributeBegin
    MotionBegin [ 0.0
...
                  0.5]
      ConcatTransform [
        1.0 0.0 0.0 0.0
        0.0 1.0 0.0 0.0
        0.0 0.0 1.0 0.0
        0.0 0.0 0.0 1.0
      ]
      ConcatTransform [
...
      ]
    MotionEnd
...
    Patch "bicubic" "Pw" [
...
    ]
  AttributeEnd
...
WorldEnd

Basically it writes out the scene graph without the hierarchy (for example the empty, which groups the 4 blades, is not mentioned), tells the renderer the shutter open and close times, and uses a motion block (starting with MotionBegin and ending with MotionEnd) to export 32 transformation matrices, tagged with values from 0.0 to 0.5. The resulting image (rendered with 3Delight) looks like this:

Rendered with 3Delight

mental ray

The mental ray and iray exporter keeps the hierarchy and splits the scene description into several files. One of them is called options.mi and the motion blur related options are set like this:

options "opt"
...
  time contrast 0.03125 0.03125 0.03125 0.03125
  # diagnostic samples on
  shutter 0.5
  # motion steps are not used for motion transformations
  motion steps 32
end options

We will use motion transformations for this simple example and it's worth to mention that the option motion steps is used, but has no effect on this kind of motion blur. We rather calculate the inverse (1.0/32 = 0.03125) and set the time contrast to get more or less samples based on the original motion samples setting in Blender. But this is only half of the work we have to do for motion transform based motion blur. Because we keep the hierarchy there is only one motion transform (if we render frame 2, that would be the transform for frame 3) in a file called instances_groups.mi:

...
instgroup "Empty_grp"
  "SurfPatch_bottom_inst"
  "SurfPatch_left_inst"
  "SurfPatch_right_inst"
  "SurfPatch_up_inst"
end instgroup

instance "Empty_grp_inst" "Empty_grp"
  transform
    -1.6292068494294654e-07 1.0 0.0 -0.0
    -1.0 -1.6292068494294654e-07 -0.0 0.0
    0.0 -0.0 1.0 -0.0
    -0.0 0.0 -0.0 1.0
  motion transform
    -1.0 -3.2584136988589307e-07 0.0 -0.0
    3.2584136988589307e-07 -1.0 -0.0 0.0
    0.0 -0.0 1.0 -0.0
    -0.0 0.0 -0.0 1.0
end instance
...

Please notice that this works only for simple motion blur based on a transformation which can be described by only two matrices (as in this case a rotation with constant speed). As soon as the motion gets more complicated we should switch to motion vectors to get a proper motion blur in mental ray.

Alternatively the exporter could have used a shutter value of 1.0 in the options block, and set the frame to the current frame plus the shutter end value before retrieving the motion transform from Blender:

...
scene.frame_set(frame_current, self.shutter_end)
...
self.mi_files[type].write('\tmotion transform\n')
...

The resulting image (rendered by mental ray) looks like this:

Rendered with mental ray

Arnold

For this simple motion blur Arnold behaves pretty similar to RenderMan, but not entirely. In the camera section we tell Arnold the shutter open and end times, but we use always values of 0.0 and 1.0. The real frame times are used to calculate transformation matrices for the shutter opening and closing times (and all inbetween steps):

...
persp_camera
{
 name Camera
...
 shutter_start 0
 shutter_end 1
}
...
nurbs
{
 name SurfPatch_left
...
 matrix 1 32 MATRIX

  1 0 0 0
  0 1 0 0
  0 0 1 0
  0 0 0 1
 ...
  0.707106709 -0.707106829 0 0
  0.707106829 0.707106709 0 0
  0 0 1 0
  0 0 0 1
 shader "yellow"
}
...

The resulting image (rendered by Arnold) looks like this:

Rendered with Arnold

Updated