Tutorial 3.2: Using the Time View, Variables with Expressions, and Motion Blur

Using an image of a ceiling and 5 images of a rotating fan as source material, this tutorial creates the ol' "gee, those fan blades sure have some air of mystery with that strange flickering light behind them, and it sure is dusty in here, even though there is a ventilation device" effect. You know the one. Here are some example images:

This composite can be broken composite down into four steps:

  1. Set up the the basic composition, both in the frame, and in time. Since you only have five images of the fan, loop the animation using the Time View. Also, add an animated RGrad behind the ceiling image to act as a light.
  2. Add a flickering effect to the RGrad. This uses expressions, as well as how to use local variables to better control the expressions.
  3. Add the Radial Blur (RBlur) effect for a the volume-rendering feel.
  4. Although already animated, add motion blur to the fan. It's cool.

Setting Up the Composition

Reading in the Files

In the Load image or sequence browser, use one of the following methods to read in the files:

The two FileIn nodes, ceiling and fan, are added.

You now have a mind-bogglingly complex node tree.

Compositing the Images Together

This leaves you with something stunning like the following image.

Animating the RGrad

Since you are stuck with only five frames of material, you can add a little kick to the composite by animating the position of the RGrad so it approaches the hole in the ceiling.

Drag the current frame on the Time Bar to see the dramatic animation. Those of you not sound asleep by now will note the fan blades disappear after frame 5, somewhat reducing the realism of the scene. Doh! You can fix this in the Time View.

Adjusting Clip Length in the Time View

Click the Time View tab to view the clip length of your nodes.

Only Image generators such as FileIn, Grad, and so on, and nodes that combine two branches together (Over, IDisplace, etc.) are listed in the Time View. Since the nodes you have created in this tutorial are these types of nodes, they are all displayed in the Time View.

The infinity symbols that appear on the left and right edges of ceiling and RGrad1 indicate that the clips (single frames) have no start or end points. The short fan clip however, has a finite length of five frames. At frame six, the clip disappears.

To extend the length of a clip:

By holding Ctrl down, you break the relationship between the clip from the disk and the actual duration of the clip in the composite. If you did not hold Ctrl down, the clip is dragged the from-disk range out, suggesting that there are in fact 75 frames on disk. That would be bad.

By default, the time bar is blue to indicate it the repeat behavior is frozen—the last frame of the clip is repeated to the out point.

The inMode and outmode parameters determine the behavior of a clip that is extended beyond its normal range, as you have done here.

Icon Mode Notes
Black No repeat.
Freeze Last (or first) frame is repeated.
Repeat Entire clip is repeated.
Mirror Clip is repeated backward, but the end frames are not repeated.
Mirror Increment Clip is repeated backward literally, so the end frame is displayed twice in a row.

By the way, startFrame and endFrame control where in time the clip is located, and firstFrame and lastFrame control what part of the clip is read from disk. Both can be controlled in the parameters or in the Time View.

The Time View indicates a repeat of the clip, with markers that indicate the looping point.

Go to the Time Bar, and press the Playback button . This differs from the normal Viewer Flipbook button in that the images are not loaded into RAM—it just renders and plays through as fast as it can. The fan blades loop.

   Using Local Variables with Expressions

This step involves creating several new variables, and then combining the variables with expressions to create a controlled flickering effect on the background light (or whatever it is). This can be accomplished with manual animation, but is much more interesting to use expressions.

Creating Flicker on the Light

You can of course turn on Autokey for the Fade1 value, and animate it to get flicker on the light, but you really want to show the people working next to you how superior you are in all ways moral, physical and technical. That is, after all, the point of CG.

To that purpose, instead insert a function into the value text field:

Shake-style Tremor-style

The keyword time tells Shake to take the current frame number and use it for value. Move the Time Bar slider to check the values—value increases as you increase the frame due to the time expression. This of course over-brightens the image as you get to higher frames, since at frame 70 it creates a fade value of 70. That is bad. You should therefore use a different expression.

Return to your expression box. We can put any expression here, so do something crafty like using a random function.

Shake-style Tremor-style

This returns a random value between 0 and 1, with time as your seed. The rnd() function is not truly random. Use the same seed each time, and you get the same result. By using time as your seed, you guarantee that the values differ from frame to frame.

Further functions can be found in Functions By Class - Expressions.

Your dreams of morally dominating your coworkers are no doubt crushed when you try clicking on the yellow curve—nothing happens, because you are not using keyframe animation. Each value is being generated by the expression.

To help control the expression:

float A number with a decimal place (0.0, .1, .5024, 1.00, etc.)
int A rounded number (0,1, 2, etc.)
string Characters ("Hey, what's up?")
 

The only parameter that matters to the Fade node is the value parameter. The others are not hooked into the value parameter, so they have no effect. To make things a little easier to work with, swap the rnd function from value to the rndVal parameter:

Therefore,



This trick makes everybody warm and happy.

If you are using the Playback button, close the Curve Editor by switching to a different tab—when displayed, the Curve Editor and the Color Picker slow down playback speed.

   Using RBlur

These steps build the atmosphere with the Filter - RBlur function. RBlur stands for Radial Blur.

Inserting the RBlur

The default values do not modify the RGrad much.

To help give the RBlur more definition, do the following:



As a result, the RGrad appears only where there is no alpha in the ceiling/fan composite. RBlur1 now has a slightly more interesting effect.

Since you now have something interesting, tune the RBlur1 parameters. Set the following:

  • Set quality to .1 (the quality is lowered to speed rendering).

  • Set iRadius to 0 (there is no area of the center that is non-blurred).

  • Set oRadius to 300 (sets the blur amount).

  • Set amplitude to 1 (this is a multiplier on oRadius—the greater the number, the more blur; also affects the rendering speed).

Linking the RBlur to the RGrad

Although the light is moving, the rays are shooting off from the same static position. To improve the effect, animate the center of the RBlur, and match it to the center of RGrad1. The best way to do this is to link the xCenter and yCenter parameters of RBlur1 to the xCenter and yCenter parameters of RGrad1. If you modify RGrad1, RBlur1 is automatically adjusted.

To link one node's parameters to another node:

To link a parameter to another parameter within the same node, type the name of the parameter. To link to a parameter in a different node, type the name of the node, a period, and the parameter name (NodeName.parameterName). Both are case-sensitive.


These expressions are the same as rnd(time) or animVal * rndVal, except that they check the xCenter and yCenter in the RGrad1 node for their values.

Note: Moving the onscreen control for the RBlur breaks the link to RGrad1. To retrieve the link, use Undo.

The origin point of the rays is now animated to match the center of the light.

Hooking the RBlur into the Composite


Setting the operation to IAdd adds the two images together. Layer2 places the atmosphere and the fan/ceiling elements over the RGrad.

This looks keen, and you are surely very proud of yourself and the tremendous amount of labor that you have performed as you secretly congratulate yourself for not ending up slogging coal from the depths of some forgotten mine. However, if you view a frame where the RGRad is mostly outside of the frame (probably an early frame), light improperly bleeds in from the edges. Where does this come from?

The Shake engine has a normally divine feature called the Infinite Workspace (Overview - Infinite Workspace) which means nothing gets cropped if it extends outside the frame. Layer_Outside is supposed to cut off the RGrad, except as viewed through the hole in the ceiling element. However, the RGrad is larger than the ceiling element, so it is not completely obscured by the ceiling element.

To check this, do the following:


Viewport is a good tool to view the extended canvas.

This is bad.

To correct this, use one of the following (but not both) solutions.

Solution 1 - Control the Background Color

Background Color is considered everything outside of the Domain of Definition (DOD) of the image. The DOD is normally the frame of the image, but could be smaller. For example, when you view RGrad1, the DOD is described by the RGrad itself, and is the area inside of the green box. The green box is the DOD.

The DOD of the ceiling element is the frame border itself. If you rewire the Viewport (created earlier) to the Layer1 element, you see something like the following when you view the alpha channel.

This area outside of the DOD is called the Background Color, and its color can be controlled with Color - SetBGColor.

When you view RBlur1, the bleeding from the edges disappears.

This is good.

Solution 2 - Clip the Infinite Workspace

The second solution is to clip the Infinite Workspace with a Crop node. This removes everything outside of the frame, and returns the frame to black.

Compare the Viewport1 node when it is attached to Layer_Outside node with the Crop1 node (with Viewport1 attached to it) to view the difference.

Layer_Outside Crop1

This is good.

Concatenation of Color Corrections

To punch up the image, add a bit of color to the flaring and brighten the image.

Shake-style Tremor-style


You may not have picked up on this, because it is rather subtle, but Brightness1 and Mult1 are concatenating their color corrections. The Mult should be turning the entire RBlur blue, but you can see that the center remains white. The Brightness has internally raised the values of the center to around 1.5, 1.5, 1.5 (numbers are a theoretical example). When Mult1 multiplies the color by .7, .7, 1 in the RGB channels, it lowers the color to 1.05, 1.05, 1.5. At 8 bits, this rounds down to 1, 1, 1, which is white.

Concatenating Non-concatenating

   Adding Motion Blur to Pre-Animated Elements

By this stage, the composite may be too slow to use the Playback button, so use the Flipbook button in the Viewer to see your 75 frame animation. If only 1 frame appears, go to Globals, and set your timeRange to 1-75, and launch the flipbook again. As you look at the animation, notice that the fan movement appears choppy. To help smooth this out, add motion blur to the fan without actually moving it.

Match the Fan Movement

The trick is to use a Move3D node to match the movement of a temporary element (such as the letter "X") to the movement of the fan. Then, the temporary element (node) is deleted, and the Move3D is applied to the moving element. Since this normally moves the element, enable the useReference parameter in the Move3D node, and activate the motion blur. Because useReference is active, it only applies the motion blur without actually moving the element.

The Text node is good to generate a temporary element.

If reading this in electronic form (pdf or html):

The Text1 node appears under your cursor. Cool, isn't it?

 

If reading this in printed form:

In both cases, your result is similar to the following image.

Next, mix the Text node with the fan node.

Because the fan is dark, either boost up the brightness on the fan (with a Brightness node), or just view the Alpha channel. Since this subtree is temporary, do not insert it into the rest of the tree.

Next, match the fan animation. The first step is to match the initial position.

If reading this in electronic form:



If reading this in printed form:

  • In the Move3D parameters, set fieldOfView to 15 (this value is from the 3D software's camera).

  • Set xPan to 153.

  • Set yPan to 87.

  • Set xAngle to -7.6.

  • Set yAngle to -22.9.

  • Set zAngle to -196.

  • Leave x/yCenter at 75.

This gives you something like the following result.

Now set the animation.

The animation matches between frames 1 and 5, but stops at frame 5. Use the Curve Editor to correct the problem. When Autokey is enabled, the Load Curve button is activated, so the zAngle curve is already loaded into the Curve Editor.

Instead of a flat value before and after the two keyframes, the zAngle parameter keeps the same slope into infinity.

KeepValue mode KeepSlope mode

 

Test the animation again with the Left Arrow and Right Arrow keys. The animation continues to match up after frame 5.

You are almost done. Honest.

Now that the animation is matched, delete the Text node and apply the animation to the fan.

 

When you view Move3D1, the fan does not look quite right. The transformation is applied to the fan, which is not exactly what you want.

To apply fake motion blur to the fan:

 

Reel Pixel Interpolation. There is a plug-in called ReelSmart Motion Blur to do motion analysis on your images. Visit the Revision Fx web site at www.revisionfx.com. Saves you all sorts of silly time. It's swank!