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:
Setting Up the Composition |
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.
In Node View, select the fan node and add a Layer - Layer node.
The fan image is layered over the ceiling. By default, the Layer node operation
is set to Over (the layer operation can be changed to another type of operation).
This leaves you with something stunning like the following image.
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.
Go to frame 1.
Click the left side of the Layer2 node (to load it into the Viewer), and click the right side of the RGrad1 node (to load its parameters).
In the Viewer, turn on Autokey
.
A keyframe for the position of the RGrad is set.
Using the onscreen controls, position the RGrad in the upper-right corner and reduce the size of the RGrad.
Jump to frame 75.
Using the following illustration as a guide, enter a second position
keyframe.
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.
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.
The clip length is extended.
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 frozenthe last frame of the clip is repeated to the out point.
Open the fan node parameters.
Open the Timing subtree.
Set the outMode to Repeat
.
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 RAMit 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.
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:
Double-click the text field (to select the 1).
Type the following simple expression:
time
If you are in the Shake-style interface, a plus-sign
appears next to the parameter. Click the plus sign to open the expression
beneath the parameter in a text field. If you are in the Tremor-style
interface, the double-clicking locks that expression into the Expression
box above the Function Bar on the left side. You can then continue to
edit it there. The old parameter text field now displays the result of
the expression.
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 valuesvalue 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.
|
Move the slider on value, and you remove the expression. Type
the expression again, or click Undo
(Command+Z / Ctrl+Z) . The only exception to this behavior
is if your expression is an animated curve that you create with keyframes,
since curves are actually expressions. In that case, modifying the slider
enters or modifies a value.
Click the Load Expression
button to view the parameter in the Curve Editor.
Your dreams of morally dominating your coworkers are no doubt crushed when you try clicking on the yellow curvenothing happens, because you are not using keyframe animation. Each value is being generated by the expression.
To help control the expression:
In the Parameter1 tab, right-click and select Create Local Variable from the pop-up menu. An extra parameter is added to Fade1 (that you can do whatever you want with).
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?") |
Enter a name of rndVal and set it to float.
Adjust the sliderabsolutely nothing happens. How exciting!
Create another local variable named animVal, also float.
Turn on Autokey for animVal.
Enter 3 keyframes at frames 1, 40, and 75. Ensure that at least one
of the keyframes is a value of 1. The values really do not matter
right now. And still, nothing happens! Oh, rapture!
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:
Double-click the value expression text field that reads rnd(time), copy the expressions (Command+ C / Ctrl+C), and then paste the expression (Command+ V / Ctrl+V) in the rndVal text field.
Therefore,
Ensure value and animVal, but not rndVal, are loaded in the Curve Editor.
The curve for animVal modifies the shape of the otherwise random
curve. Grab its keyframes or insert new one (shift-click on a segment),
and you change the form of the random shape. If you do not see the shapes,
make sure at least one of the animVal keyframes equals 1, and press
Home in the Curve Editor to frame the curves.
This trick makes everybody warm and happy.
If you are using the Playback button, close the Curve Editor by switching to a different tabwhen displayed, the Curve Editor and the Color Picker slow down playback speed.
In the Node View, select Fade1.
Shift-click on Filter - RBlur. This creates
a new branch off of Fade1.
The default values do not modify the RGrad much.
To help give the RBlur more definition, do the following:
In the Node View, select Fade1 and Shift-click Layer - Layer to create another Layer node.
In the Parameters1 tab, rename the new Layer3 node Layer_Outside.
Connect the output of Layer1 to the second input of Layer_Outside.
Rewire RBlur1 to Layer_Outside.
Switch the Layer_Outside operation to Outside.
Switch the Layer_Outside clipMode to background.
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 oRadiusthe
greater the number, the more blur; also affects the rendering speed).
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 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.
In the RBlur1 xCenter parameter, type:
RGrad1.xCenter
In the RBlur1 yCenter, type:
RGrad1.yCenter
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.
In the Node View, click RBlur1, and click Layer - Layer.
Rename the new Layer node Layer_Add.
In the Layer_Add Parameters1 tab, switch the operation parameter to IAdd.
Connect the output of the Layer_Add node back to the first input of Layer2.
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.
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.
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.
In the Node View, select Layer1.
Insert a Color - SetBGColor:
When you view RBlur1, the bleeding from the edges disappears.
This is good.
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.
If you already followed Solution 1, delete the SetBGColor1 node (select the node and press Delete).
You are finished with this stage.
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.
To punch up the image, add a bit of color to the flaring and brighten the image.
In the Node View, select RBlur1.
Attach a Color - Brightness node.
Brightness1 should be active. Insert a Color - Mult (both nodes should be between RBlur1 and Layer_Add).
Shake-style | Tremor-style |
![]() |
![]() |
In the Mult1 parameters, set the color to blue with the Color
Picker, or by using the Virtual Color Picker. To boost the blue color,
hold down B and drag to the right.
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.
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.
Activate (click in) the Shake window.
Place the cursor in the Node View, and press Command+V / Ctrl+V to paste the Text node in.
The Text1 node appears under your cursor. Cool, isn't
it?
Create an Image - Text node.
In the Text node parameters, set width and height to 150.
Set font to Courier.
In the text field, type X as your text.
Set your xFontScale to 307 and your yFontScale to 270.
In both cases, your result is similar to the following image.
Next, mix the Text node with the fan node.
In the Node View, select Text1.
Attach a Layer - Mix node.
Connect the second input of Mix1 to fan.
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.
Copy and paste the following Move3D node into the Node View:
Move3D1 = Move3D(0, 153.7649,
86.88863, 0, -7.659575, -22.97875, -196.597, 1, 0.9259, 0.9259, yScale,
75, 75, 0, 15, "default", xFilter, "trs", 0, 0, 0.5, 0, 0, time );
Link the pasted Move3D node between Text1 and Mix1.
Go to frame 1.
In the Node View, select the Text1 node and insert a Transform - Move3D (see above illustration).
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.
Click on the zAngle Autokey button
to set a keyframe.
Go to frame 5.
Set the zAngle parameter to approximately -122.
Use the Left Arrow and Right Arrow keys to step through your animation.
Open the Curve Editor tab.
To select the curve, drag across the the curve or select the curve in the curve list.
Change the Curve Cycle Behavior from KeepValue to KeepSlope in 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.
In the Node View, select the Move3D1 node and press E to extract the node. The node is pulled from the tree, but not deleted.
Attach Move3D1 between fan and Layer1 again.
Open the Move3D1 parameters.
Set motionBlur to .5. The result still isn't rightthe fan is transformed.
Activate useReference. The fan snaps back to its original position,
the motion blur applied to the fan.
|