From BlenderWiki

Jump to: navigation, search

As the song goes, birds fly, ships sail...namely, things move; it just comes natural. But maybe you want some things to move really fast while other things stay almost the same (think Flash of the Fantastic Four). Especially in anime, the guy always seems to run so fast he's a blur while the girl just stands there and waits for him to run off his excess energy. That, or the good ninja runs up to fiercly chop the bad guy, but the bad guy just stands there.

Rendering all this motion of all the objects in your scene with motion blur turned on is perfectly feasible...if you have enough CPU and memory. Particularly during the early creative stages, you'll want to see just the stuff that's moving really fast, to see if it looks, well like, really cool.

The Blur

A little backround info, if you will indulge me, to level set your perspective on blur. Three things: eyeball biology, film and CG:

Eyeballs: If you look into my eyeball, you will see (pun intended) that my brain processes about 15 images from each eye in parallel each second. My brain cognates those images together and I perceive motion by comparing the two. If something is moving fast enough, I percieve it to be a blur (either because my rods have some latency in reacting to light, or my brain, in overlaying and differencing the images, somehow merges them in a mix sort of fashion). The POINT IS, I percieve a motion blur.

Film: to keep us from seeing jumpy motion pictures, we simply doubled the frame rate to 30 frames per second (fps) (24 fps EU). So, the shutter is basically open for a 30th of a second and the film is exposed to the world for that length of time. As things moved in the real world during that time, the film exposure caused the image of the moving thing to be physically blurred or smeared on that frame. When developed and shown, we physically see an image that is blurred. The POINT IS, I see a blurred image.

CG: In CG, when a frame is rendered, the computer knows exactly where everything should be, and renders it as such. From frame to frame, an object is location A in frame 1, and location B in frame 2. When we show you these two frames at speed (30 fps), the image appears jumpy to us, because, somewhere between the eyeballs and the film, there isn't that same blurring as the real world and film, and we can tell.

So, how can we make a blurry CG image? Blender has two ways to achieve Motion blur in Blender:

Common Motion Blur
Slow, but produces better results.
Vector Blur
Blender specific Vector Blur. Faster but sometimes unwanted side-effects - which can be avoided though.

Motion Blur via MBlur button

This is the tradtional way (read: old, outdated) of making motion. Simply enable the MBlur button, located below the Render button (Render button is located on the Buttons window, Scene buttons, Render sub-selection, Render panel). When enabled, Blender uses the motion in the scene to render the full image containing EVERYTHING up to 16 times: for each final frame at time X, he renders frames at X+0.0625, X+0.1250, X+0.1875, X+0.2500, X+0.3125, X+0.3750, X+0.4375, X+0.5000 (for a blur on 8 frames, and a Bf of 0.5), recalculating the exact position of each moving object at each of those exact times, and then finally mixing all those renders together. Great, if you have the time. Most of us don't. So read on.

Vector-based motion blur

Vector-based motion blur for a single image in Blender is accomplished in these broad steps:

  1. Render one frame of a scene (or image)
  2. Move the object(s) that should be blurred
  3. Repeat the previous steps until the range of motion for the blurry objects has been covered
  4. Have Blender calculate the motion blur of the objects between each pair of frames
  5. Blender combines the individually rendered frames into a final picture

These steps, expounded on in the following subsections, provide a very quick overview of how to get something blurry in as few steps as possible.

Object Motion

There are at least two ways to set up an object's motion:

  • Manually change the object's position, from one frame to another, or
  • Force the object to follow a path

To manually change an object's position:

  1. Add a 'Sphere' and tab out of edit mode.
  2. Insert a Location Ipo to position it there at that frame
  3. Press the up arrow to advance a few frames (10 by default)
  4. Grab the Sphere and move your mouse to drag it somewhere else. LMB Template-LMB.png click to drop it.
  5. Insert a second Location Ipo to position it there at that frame

The sphere will then move from point A to point B during the animation. However, moving the object along a path, using Blender to compute that motion, is conceptually easier than moving it manually between frames. To force an object of follow a path:

  1. Add a 'Sphere' and tab out of edit mode.
  2. Add a 'Bezier Circle' and tab out of edit mode. The circle will be selected.
  3. Make the circle a path by clicking the CurvePath button in the Curve and Surface panel in the Editing Buttons
  4. Shift-Select the 'Sphere' via ⇧ ShiftRMB Template-RMB.png
  5. Make the Parent Path of the selected Sphere via CtrlP to make the sphere a Parent of the circle.
  6. In the Object buttons, Constraints panel, add a constraint that the sphere must Follow Path, and enter the name of the circle (usually "CurveCircle") in the OB: field.

The Sphere should then cruise around the circular path defined by the Bezier Circle if you set your animation to a second or two.

For either method, you need to then:

  1. Click the Scene button
  2. Set the start and end frame of your animation in the Scene Anim panel
  3. Click the Render Layers tab
  4. Enable Passes: Vec for Vector Blur use.
  5. Do NOT enable MBLUR, as we will be using Vector Blur instead.

Configure Blender for Blurring

Blender must be told to blur the objects in motion. This can be accomplished as follows and as shown in the noodle picture below:

Mini blur map
  1. Change any window to the Node Editor
  2. Enable Use Nodes and select the Compositing (face) button.
  3. Add a Vector Blur node (Add >> Filter >> Vector Blur)
  4. Thread the Vector Blur between Composite and Render Layer
  5. Connect Image to Image, Z to Z and Speed to Speed (from Render Layer to Vector Blur)
  6. Connect Image to Image (from Vector Blur to Composite)
  7. Enable Do Composite under Scene settings

Render "Animation"

At this point, you should be able to select Render >> Render Animation (or CTRL-F12) to tell Blender to begin rendering the individual images. Each image will appear slightly different than the previous (sometimes, if the moving object has not been told to move far or fast enough, it will hardly appear to have moved at all!). Once Blender has finished rendering each of the images for the scene, it will merge them together to create the objects in a blurred motion.

Using Vector Blur

Voila, the master Blender coders have given you the tools to realize your creative dreams, whether you're doing anime, mixing real-world footage, or simply making a really smooth animation, and simply can't afford a Cray computer with its 20,000 AMD dual-core Opterons. At least not on this week's allowance. Enter the Vector Blur node: the ability to render motion blur on only a small subset of objects in your scene.

In the Node Editor window above, you see three nodes: The RenderLayer input feeding a Vector Blur Node which in turn feeds a Composite Output Node. What isn't shown is that in frame 2 Suzanne is on the left side, and at frame 11 she is on the right side. The frame being composited is frame 6, as shown in the frame indicator. So, in frame 6, she need to be blurry as she streaks across the screen.

The entire scene contains Layers 1-5 (as shown with those 5 layer buttons enabled), but the RenderLayer is only rendering objects on Layer 1 as shown by the layer set of buttons below the RenderLayer name. As shown in the input node, this is only Suzanne, and she is looking pretty. The Image, Z, and Speed sockets are connected from the Input to the Vector Blur node. The resultant computed output image is fed to the Composite output. The Alpha and Z channels from the Input are threaded to the Output sockets (they go under the blur node, but don't let that throw you).

Down in the Buttons window, on the RenderLayers tab, you need to select at least the Solids option, and the Z and Vec(tor) passes. Enable Combined to speed things up a bit.

The composite output viewer node shows you what a blurry Suzanne looks like, and will look like in the final rendering. Note that the old Motion Blur button is turned off. If we had other RenderLayers set up fo the other Layers of objects in our scene, we could mix those images with the blurry Suzanne to composite our final image.

Other Usage Examples

In the ninja anime example above, using traditional anime technique, you want to freeze the rig of the good ninja and blur the background. To do the more traditional style, put the background in its own layer and create a renderlayer just for it. Make it really move by adding an IPO that covers a few frames. Choose the middle frame as above, route the Renderlayer input through a Vector Blur Filter node, as shown above. Render another image of the static ninja rig, everthing else without motion blur, mix them together over time (like a second or so - 30 frames), and you have your finished product in a minimum of CPU usage. And you have some of your allowance left over for a new pair of sneakers.