Shake Homepage.
Apple Computer, Inc. © 2005 Apple Computer, Inc. All rights reserved. Under the copyright laws, this manual may not be copied, in whole or in part, without the written consent of Apple. Your rights to the software are governed by the accompanying software license agreement. The Apple logo is a trademark of Apple Computer, Inc., registered in the U.S. and other countries.
1 Preface 7 7 8 8 Contents Welcome to Shake 4 The Tutorial Lessons Installing the Tutorial Media Mac OS X Notes Chapter 1 11 11 12 16 19 24 24 26 31 33 34 37 40 41 43 Shake Basics Tutorial Summary A Tour of the Basics Loading Images Viewing Images, Parameters, and Channels Working With Windows Launching a Flipbook Compositing Elements Setting Resolution Filtering and Masking Tuning Parameters Working With Layer Nodes Transforming an Image Fading an Element Rendering a Sequence Chapter 2 47 47 48 50
93 98 102 107 111 121 125 Working With Z Channels Creating Composites With ZCompose Color Correcting Premultiplied Images Fading With Distance 3D Compositing With the MultiPlane Node Animating a MultiPlane Camera Importing Camera and Animation Data Chapter 4 133 133 133 136 138 139 144 153 156 Working With Expressions Tutorial Summary Creating the Fan Composite Creating a Light Source With RGrad Looping Frames in the Time View Using Local Variables and Expressions Simulating Volumetrics With RBlur Co
215 218 Position the Foreground Element Color Correct the Foreground Element Chapter 8 225 225 225 226 232 234 237 238 241 Working With Macros Tutorial Summary What Is a Macro? Creating a Handmade Macro Saving and Testing the Macro Adding a Button to the Interface How to Set Slider Ranges Creating Macros With MacroMaker Creating Sliders in MacroMaker Chapter 9 243 243 243 247 252 Creating Clean Plates Tutorial Summary Stitching Images Stabilizing and Stitching Background Plates Creating a Clean Plate
Contents
Preface Welcome to Shake 4 This guide includes hands-on tutorials, demonstrations, and explanations of Shake features and workflow. In addition to the fundamental topics, this guide also explains specialized topics, such as 3D compositing, expressions, keying, and tracking. Check the lesson summaries below for a quick overview of each tutorial. For further study, you’ll want to explore the Shake 4 User Manual.
• Tutorial 6: “Using Primatte”—This lesson describes the basic use and mechanics of the Photron Primatte keying plug-in, as well as masking and spill suppression. • Tutorial 7: “Tracking and Stabilization”—This tutorial demonstrates the primary uses for Shake’s tracking technology, including removing unwanted motion from an image sequence and “matchmoving” an element to the motion of another element in the composite.
Important: Macintosh users should bear in mind that the Delete key used in Shake is not the key located below the F12 key but, rather, the one grouped with the Help, Home, and End keys. If you are using a smaller Macintosh keyboard without the second Delete, use Option-Delete (again, the key below F12). Keyboard Command Differences Between Platforms Some keyboard commands are different between the Mac OS X platform and the Linux or IRIX platform.
Preface Welcome to Shake 4
1 Shake Basics 1 This tutorial introduces Shake through a series of common tasks, including loading and compositing images, tuning parameters, transforming images, adding masks, and rendering.
• • • • • • • Setting resolution Creating a new element Tuning parameters Working with layer nodes Transforming an image Applying a mask Rendering a sequence A Tour of the Basics In this tutorial you’ll create a composite with images created at Big Sister's Watching, NY by Brandon Robinson and Melissa Graff. You’ll start by layering the images for the composite. Then you’ll incorporate additional elements for soft shadows and lighting. Before you begin, let’s review some basic Shake operations.
Using the Shake Panels When you start Shake, you’ll notice that the interface is divided into four panels: Viewer, Node View, Tools, and Parameters. Each image process in Shake is accomplished by connecting items, called nodes, as a tree structure in the Node View. The result is an overview of the images, layers, and processes in your project. Shake projects are called scripts because the results are stored as a list of sequential commands in a script file.
Contextual Help Move the mouse pointer over a control or parameter to display brief help messages in the Info field at the bottom of the screen. These messages explain what each item does and also show any relevant hot keys. The Info field displays context-sensitive help. For example, suppose you want to know what would happen if you clicked on the ColorWheel command on the Image tab. Move your pointer over the command and the message Create node: “ColorWheel()” appears in the Info field.
For many onscreen controls, there are also click-and-hold behaviors: • Click a button to toggle between its two default states. For example, click the View Channel button to toggle between RGB and alpha channel views. • Press and hold a button to select an option from a pop-up list. When you press and hold the View Channel button, for example, you can select from a list of available channel options. Click to toggle between RGB and alpha views. Press and hold to choose from a pop-up menu.
Loading Images To load images into your project, you use the FileIn node from the Image Tool tab. In these tutorials, the notation for creating nodes is identified with this format: Tab NameNode Name, as in “insert an Image-FileIn node”. Note: Do not confuse the FileIn node with the Load and Save buttons at the upperright corner of the screen. The Load and Save buttons are for retrieving and saving Shake scripts. If you still have that ColorWheel node in the Node View, you need to remove it.
3 Double-click the background directory to open it, select the background.30-59@.jpg image sequence, then click Next at the bottom of the browser (or press the Space bar). You click Next instead of OK to select additional files. When you’re done, you’ll load all the images at once. 4 Click the Up Directory button, and browse to the orchid directory where you’ll find the orchid.30-59#.exr image sequence. The “30-59” tells you this is a sequence of 30 frames.
. Browsing Tips There are several ways to navigate within the File Browser: • To move up one level, click the Up Directory button or press Delete (Mac OS X), or press Backspace (IRIX or Linux). • To move back to the previously viewed directory, click the Previous Directory button. • To move down one level, double-click a directory. • To scroll by file, click in the file list, then press the Up Arrow or Down Arrow key to scroll up or down.
11 Drag a selection box around all the nodes, then press L on your keyboard to line them up. You can also right-click in the Node View and choose Node Layout > Layout Selected from the shortcut menu. Viewing Images, Parameters, and Channels Each node represents a function or operation that can be viewed or modified. In this case, these are FileIn nodes that reference images from your disk directories. As shown in the previous illustration, image thumbnails appear above the nodes.
• To view the alpha channel, place the pointer over the thumbnail and press A. To return to the RGB view, place the pointer over the thumbnail and press C for “color.” • Any node can have a thumbnail—select the node and press T. Note: The thumbnails do not dynamically update (see below). • To hide thumbnails, select the nodes and press T. Press T again to show the thumbnails. • Additional controls for the thumbnails are located in the Globals tab.
• To load the parameters into the Parameters tab, click the right side of the node. • To load a node into the Viewer and the Parameters tab simultaneously, double-click the node. Sometimes, you need to edit the parameters of one node while viewing the output from another. For example, you’ll often want to adjust a color correction while looking at the result in the final composite. Loaded into Viewer 1, buffer A. Loaded into the Parameters tab.
The gray square on the right side of the background node—it’s supposed to be a tiny text field—indicates that this node is selected for editing in the Parameters tab. So why is this useful? In a real composite—you’ll have one soon—you’ll often want to adjust a node while viewing the end result at the final output node in your script. We mentioned contextual help for screen controls, and this also works to get information about nodes.
Panning, Zooming, and Framing While working in Shake, you’ll need to pan, zoom, and frame the contents of the Node View, the Viewer, and other windows in Shake. • To pan: Drag the pointer over a window while pressing the middle mouse button. Or, drag the pointer while pressing Option (Mac OS X) or Alt (Linux/IRIX) • To zoom: Drag the pointer over the window while pressing Control-Option (Mac OS X) or Control-Alt (Linux/IRIX). You can also press plus (+) or minus (–) to zoom in or out.
Working With Windows Now that you have a few images loaded, this is a good time to practice methods of working with the Shake windows. Function Keyboard Notes Expand a window full screen Space bar Press the Space bar again to zoom back to normal view. Pan a window Middle-click and drag, or Optionclick and drag (Mac OS X); Alt-click and drag (Linux/IRIX) Works in all windows, including the File Browser.
Flipbook Controls The following table contains several Flipbook controls. Control Action . (Period; think of it as the > key.) Play forward. , (Comma; think of it as the < key.) Play backward. R, G, B, A, C Show the red, green, blue, alpha, and color channels. Shift-drag Scrub through the animation. Escape (Esc) Close the window. You can have as many Flipbooks as memory allows, but once closed, all links to the Flipbook are lost—you cannot save or use the images again.
Compositing Elements Now that you know how to navigate through the Shake interface, you’re ready to composite the elements. Finally! Arrange the FileIn nodes like this, in the order that you want to composite them: To begin the composite: 1 Click the orchid node to select it. 2 In the Tool tabs, click the Layer tab, then click Over. Over1 is automatically attached to the orchid, because that node was selected when you added the new node.
You can also drag from the bottom of table to the second input on Over1. Information flows downward in the Node View like a stream—the image data is passed from the orchid and table nodes, and fed into the Over1 node to create the composite. orchid node table node Over1 node What happened? The top half of the image is gone. We’ll fix this in a minute—and explain what it means.
Look in the Parameters tab, where the Over1 parameters now appear. The first parameter is the same for all nodes: the name of the node. By default, Shake assigns a generic name and appends a number to it, which allows each node to have a unique name. You can type a different name in the text field and make it more descriptive. 4 Click in the first parameter field for Over1, and type “orchid_Over_table.” The new name reflects the compositing logic for the node: “Input 1 is Over Input 2.
The node logic is switched, which completely changes the result of the composite. The orchid now appears behind the table when it should be on top. 6 Switch the inputs again (or press Command-Z or Control-Z to undo your previous operation). The orchid image appears over the table image again. As you work with the different layer nodes, you’ll find they have distinct methods for creating the layered output.
7 In the Node View, select the orchid_Over_table node and add one more Over node. Use the following illustration as a guide to connect the background element. The result appears in the Viewer. We can thank the folks at Big Sister's Watching, NY for their impressive work.
If you were paying attention when you connected images to that first Over node, your composite looked like this for a brief period: Although everything turned out fine, it’s important to understand why Shake clipped the image—it’s a feature, honest—and how this can help you. This, and other mysteries, are explained in the next section. Setting Resolution Shake supports an Infinite Workspace, which means you can dynamically change resolution during the compositing process and Shake will handle it.
Setting Resolution in a Composite There are several ways to set the resolution for your composite: • Composite elements so that one of the elements is already set to the resolution you want to use. Then, use the clipMode parameter in the layer node (Over, lAdd, lMult, and so on) to indicate which image you want to pass as the resolution for the next node in the tree. • From the Transform tab, use the Fit, Resize, or Zoom node to scale your images.
4 To ensure that the resolution is 720 x 486 pixels, set clipMode to foreground. The image is no longer clipped. 5 Double-click the Over1 node to view the full composite again. In this situation, the Over1 node restores the orchid image, even without the clipMode fix. This is because orchid isn’t truly clipped. The Shake Infinite Workspace ensures that images are never permanently clipped due to framing.
5 Using the following illustration as a guide, add a new Image–RGrad node and attach it to the side mask port on the Blur1 node. The blur effect is now controlled by the pixel values in the RGrad1 alpha channel. Lighter pixels allow the effect to be applied to the background image. Darker pixels block the effect. Tuning Parameters So now you’ve got your basic composite. The mask needs some fine tuning to improve the effect, and this will give you some practice with the Parameter controls.
2 Click the right side of the RGrad1 node to load it into the Parameters tab. 3 In the RGrad1 Parameters tab, set radius to 100, and falloffRadius to 400. 4 Display the subtree for center, then change the xCenter value to 360. 5 Change aspectRatio to 1.5. The result will look similar to this: The overlay circles and crosshairs are interactive transform controls that allow you to make adjustments in the Viewer.
In the illustration below, the radius is set to 312 and the falloffRadius is set to 370. It’s looking better, but there’s still a big difference between the sharp area and the blurred area. Adjust the gradient colors to fix this, then set the Blur1 node to use a color channel from RGrad1 as the mask, instead of the alpha channel. When you change the gradient colors and substitute the alpha channel with one of the color channels, you can adjust the opacity of the mask and its effect on the blur filter.
10 Drag in the luminance bar, under the ColorWheel, until you see a softer focus for the background in the Viewer. Working With Layer Nodes This example includes other elements for soft shadows and lighting. Instead of the Over node, you’ll use Layer–lMult and Layer–Screen to blend these elements into the composite you created in the previous exercise. To load the lighting and shadow images: 1 Add an Image–FileIn node to the node tree.
4 Arrange the nodes as shown in the illustration below. Composite the soft shadows first. 5 Select the Over1 node, then add a Layer–lMult node to the tree. 6 Connect the shadows image to the second input. Rather than place one image over another, the lMult node multiplies pixel values together. For this reason, it doesn’t matter that the shadows image is connected to the second input. The shadow image is multiplied into the existing image, not placed on top of it.
7 In the lMult1 parameters, drag the percent slider to set it to 65. Next, composite the lighting pass. 8 Select the lMult1 node and insert a Layer–Screen node. 9 Connect the lighting node to the second input of the Screen1 node. Not again! In the Viewer, you’ll see a clipped image, similar to what you saw earlier in this tutorial. Move the pointer over the lighting node and you’ll see it has a resolution of 360 x 243. This resolution is obviously not the desired output.
10 Drag the noodle from the second input on Screen1 to the first input. That fixed the clipping situation but didn’t change the size of the lighting image to match the rest of the composite. You could re-render this element at the full resolution, but who has time to do that? Alternatively, you can resize it with a transform node (just don’t tell your CG supervisor).
Or, in the Viewer, drag a corner of the Move2D transform control until the scale parameter is set to 2. The size is right, but the image is not in the correct position. 3 Drag the triangles or the crosshairs to position the image to match the rest of the composite. 4 Open the pan subtree in the Move2D1 parameters, then adjust the values so that xPan = 181 and yPan = 123. The lighting pass should now be in the right place. Fading an Element You’re almost done.
2 Right-click Fade, then choose Create from the shortcut menu (or, you can click Fade while holding down the Control and Shift keys). This inserts a new Fade1 node that is not connected to any existing nodes. 3 Drag Fade1 over the connection between the Move2D1 and the Screen1 nodes. When the inputs turn yellow, release the mouse button and Fade1 is inserted between the two nodes. 4 In the Fade1 parameters, drag the value slider to 0.25. This reduces the opacity of the lighting pass to 25 percent.
The finished image will look similar to this: Rendering a Sequence When you’re ready to create the final images for your composite, you insert at least one FileOut node at the place in the node tree where you want to render. This is often at the bottom of the node tree, because this is where the final result is composited. However, you can place as many FileOut nodes as you need to output from different places along the tree, and send rendered output to multiple directories and formats.
About File Names When you enter the file name for render output, the name should include a combination of the following: • The name of the file. • A frame-numbering symbol for image sequences. When you render to an image sequence, include a frame numbering symbol—either @ or #. A single @ is an unpadded number—that is, 1, 2, 3, 4. A single # is 4-place padding—that is, 0001, 0002, 0003. Either symbol used multiple times indicates that many places of padding, that is, @@@@@ is 00001, 00002, 00003. • A .
2 In the File Name text field, type “orchid.shk” as the name for the script, then click OK. Note: To Save As, use Command-Shift-S or Control-Shift-S, or choose File > Save As. To render files to disk: 1 From the menu bar, choose Render > Render FileOut Nodes. The Render window appears. Note: You can also right-click in the Node View, then choose Render > Render FileOut Nodes from the shortcut menu.
2 Open Terminal and navigate to the directory where your orchid.shk script is saved. 3 Type: shake -exec orchid.shk -v Note: In OS X, if you do not have environment variables set for Shake, you must type the full Shake path, for example: /Applications/Shake/shake.app/Contents/MacOS/shake -exec orchid.shk -v Usually, you set your environment variables to use the shake command with a lowercase “s.” For more information, see “Environment Variables for Shake” in Chapter 14 of the Shake 4 User Manual.
2 Intermediate Skills 2 This tutorial shows how to optimize your workflow with the SetDOD node, and how to use the Shake Time View, and the Curve Editor. You will also learn how to add motion blur, how to color-match the elements in a composite, and how to import Photoshop files as layers in a composite.
To explore the topics of this tutorial, you’ll work with images from the Beanfield music video Tides, kindly provided by the artist, Maximilian Graenitz. Inserting Nodes Into a Tree Before you continue with the tutorial, take a moment to review different ways to insert and manage items in the Node View. The illustrations show a generic “node,” but you can try these with any node from the Tool tabs. • Insert, Method 1: Select the parent node, then click a node button in the Tool tabs.
• Replace: Select the node you want to replace, then Control-click a node button in the Tool tabs. • Insert Unconnected: Control-Shift-click a node button in the Tool tabs. The new node appears in the Node View unconnected to any other node. • Extract: Select the node, then press E (for Extract). The node is disconnected from the tree.
• Delete: Select the nodes by clicking, Shift-clicking or dragging a selection box, then press Delete. • Delete Connection: Control-click the noodle, or move the pointer over one end of the noodle (it turns magenta at the bottom or yellow at the top), then press Delete. Grouping Nodes and Using SetDOD When your script includes many elements, two features can help you control the organization and rendering of the nodes: the SetDOD node and the Groups command.
Optimizing With SetDOD A DOD (Domain of Definition) is a rectangular region around an element that defines the part of the image you want to include in render calculations. Usually, the DOD is used to exclude empty image areas from render calculations. Before SetDOD: Whole image area is calculated and rendered. After SetDOD: Only image area inside DOD is calculated and rendered. But you can also use SetDOD to crop out parts of an image that you don’t want to include in your composition. Give it a try.
To add the SetDOD node: 1 In the Node View, select the mitosis node. 2 Insert a Transform–SetDOD node. 3 Make sure the onscreen controls are enabled for the Viewer. 4 Drag the DOD corners or edges in the Viewer to frame the “little guy” character.
This tells Shake to calculate only the image information within the DOD boundaries. The rest of the image is ignored, thereby reducing memory usage, I/O activity, and processing time, both upstream and downstream in the node tree. 5 Click the Flipbook button in the Viewer shelf to create a preview of the image with the DOD applied. When you play back the preview (press the period key), you’ll see that the DOD crops some of the animation as the clip plays. To fix this, make an adjustment to the border.
To group the mitosis, setDOD1, and Move2D1 nodes: 1 In Node View, drag to select the mitosis, setDOD1, and Move2D1 nodes. 2 Right-click in the Node View, then choose Groups > Group Selected Nodes from the shortcut menu. The new Group1 node appears in the Node View. 3 In the Parameters tab, rename the node to “mitosis_group.
4 Click the Expand button on the mitosis_group node to show its contents. When a group is expanded, you can select and edit the nodes inside the group. 5 Click the Expand button again hide its contents. Using the Time View In the next example, you’ll make a few adjustments to the mitosis clip in the Time View, where you can modifiy the location and duration of clips.
Each image node and layer node in the composite is represented by a horizontal bar, lined up with the frames in the Time Bar. Tips for Working in the Time View • The Time View shares similiar functions with the Node View. You can select nodes in both windows. You can view nodes, load parameters, and ignore nodes by clicking the controls on the bars in the Time View. Load into the Viewer Load into the Parameters tab Ignore node Load into the Viewer Load into the Parameters tab Press I to ignore.
m To load the mitosis node into the Parameters tab, do one of the following: In the Node View click the right side of the mitosis node. m In the Time Bar, click the parameters indicator on the mitosis bar. The mitosis parameters appear in the Parameters tab. Under the Source subtab , the firstFrame parameter is set to 1 and the lastFrame parameter is set to 35. These are the source frames read from the image sequence on disk.
m To modify the clip’s position in the Time Bar: In the Time View, drag the middle of the mitosis bar to the right. The entire clip moves to the right. Frame numbers where the In/Out points line up in the Time Bar Start (In point) and end (Out point) frames for the sequence or clip As you drag the mitosis bar, dark blue numbers appear outside the ends of the bar to show where the start and end frames of the clip line up with the Time Bar frames.
To extend the length of the mitosis clip: 1 In the Time View, press the Control or Command key and drag the right timing handle of the mitosis clip until the Out point (dark blue number) reads 101. Pressing the Control or Command key while dragging a timing handle breaks the relationship between the disk clip and the duration of the clip in the composite. The newly extended area of the clip is calculated in one of several repeat modes.
Button Mode Result Mirror The clip repeats, first in reverse order, and then forward, indefinitely. To provide a smooth transition, the first frame does not repeat between the loops. InclusiveMirror The entire clip repeats, first in reverse order, and then forward, indefinitely. You now have everything set up for the first original copy of our “little guys” element. The next step is to make a copy of all the nodes for this element, and paste four or more copies to populate the composite.
3 Drag the selected nodes to the left in the Node View to make room for the copies. 4 Right-click in the Node View, then choose Edit > Paste from the shortcut menu (or press Control-V) to place the first copy. 5 Repeat Step 4 to paste at least three additional copies.
6 Using the illustration below as a guide, connect the copies to the rest of the node tree. Tips for Navigating in the Node View The Node View can get a little unwieldy when you add a large number of nodes to your script. Here are some tips to help you work more efficiently. With the pointer over the Node View: • Press the plus key (+) to zoom in. Press the minus key (–) to zoom out. • Press F on your keyboard to frame all selected nodes. If none is selected, press F to frame the entire node tree.
To position the “little guys”: 1 Load the leftmost Over1 node into the Viewer. 2 Click the Expand/Collapse button on the leftmost mitosis_group node to show its contents. The group window expands (and jumps to its original paste position). 3 Drag the group header to the left to see its contents more clearly. 4 Click the right side of the Move2D1 node to load its parameters into the Parameters tab. Keep that Over1 node, at the bottom of the node tree, displayed in the Viewer.
5 Drag a corner of the Move2D onscreen controls (the box overlay) to change the size of the element. 6 Drag the top and side triangles to position the element within the frame. It doesn’t matter where you place the element or how big it is. Just resize it and move it away from the center. 7 Click the Expand/Collapse button on the mitosis_group node to hide its contents. 8 Repeat the previous steps to size and place all the copies of the mitosis element.
3 Double-click the Over1 node (the last Over node at the bottom of the node tree), to see the results of the composite. When you are finished, your composite should look similar to this: 4 Click the Flipbook button to preview the finished composite. That’s it for this example. In the next project, you’ll see how to add motion blur to elements in a composite.
Creating Motion Blur The motion blur feature lets you simulate the effect you see with moving objects in real photography. Shake relies on changes in position or scaling created with one of the Transform nodes—Move2D, Move3D, CornerPin, and so on—to generate motion blur for an element. In this example, you’ll open the “magic carpet” script and add motion blur to one of the elements.
2 Click the Globals tab and expand the motionBlur subtree. Note: The Move2D, Move3D, CornerPin, CameraShake, Pan, Rotate, Scale, Stabilize, and MatchMove transform nodes also have motion blur parameters. The motion blur parameter has no effect until you apply an animated transformation to an element. Shake creates the motion blur by tracking each pixel through the transformation. Motion Blur Parameters • motionBlur: Controls motion blur quality. When set to 0, the blur effect is turned off.
To create a transformation for motion blur: 1 Select the front_man node, then insert a Transform–Move2D node. 2 Move the playhead to frame 25 in the Time Bar. 3 Enable the Autokey button in the Viewer shelf. 4 Move the playhead to frame 30, then drag the onscreen transform control up until the “front man” character moves out of view. This animated transformation between frames 25 and 30 creates the movement Shake needs to generate motion blur.
5 Click the right side of the Over4 node to load the final output into the Viewer. No motion blur, right? You still need to specify the motion blur settings. (See “Motion Blur Parameters” on page 67 to review the Shake motion blur settings.) To activate the motion blur: 1 Scroll to the bottom of the Move2D1 parameters and expand the motionBlur subtree. 2 Set motionBlur to 1. You should now see some motion blur action.
3 Set motionBlur to 0.25 to lower the blur quality. 4 Enter a few different settings for shutterTiming to test the effect of this parameter. shutterTiming = 0.5 shutterTiming = 1.5 shutterTiming = 0.15 Time to settle on one of these. 5 Set shutterTiming to 0.35. 6 Test the effect of shutterOffset by entering different values for this parameter. shutterOffset = 0.5 shutterOffset = –2 shutterOffset = 1.25 7 Reset shutterOffset to 0.
Note: Generally, it’s better to define motion blur settings for individual transform nodes. You can set motionBlur to 0 in the Globals tab to temporarily turn off all motion blur calculations, and thereby speed up your workflow. Just remember to reset the global motionBlur parameter to 1 when you need to preview the effect in the Viewer or render final output. The first two motion blur parameters in the Globals tab are multipliers of the motion blur settings for the individual transform nodes.
Now use the Photoshop import feature to read in the same file. To import a Photoshop file using the Import command: 1 Choose Import Photoshop File from the File menu. 2 Browse to the same directory as before ($HOME/nreal/Tutorial_Media/Tutorial_02/ images/field_wawas) and double-click the background.psd file. This time, Shake organizes each Photoshop layer in the file as a separate image and inserts a Composite node to create the same result as the background node that you inserted.
As you can see, each Photoshop layer has its own set of parameters inside the Composite node. The clipLayer parameter controls the output resolution of the Composite node. Ignore layers above Name (layer) Blend mode Solo layer Layer visibility Drag this control to change the position of the layer in the composite. Delete layer Now let’s add some new elements and incorporate them into the composite. 4 In Node View, delete the background node.
Zoom in on the Composite node (press Command-middle-click or Control-middle-click and drag right). You’ll see the plus sign (+) on the top-right edge of the Composite node. Drag any noodle to the plus sign and you’ll add new inputs—in this case, new layers— to the node. 8 Drag a noodle from the wawa1 node to the + sign on the Composite node. 9 Load the Composite parameters. Note that a new layer is stacked on top of the existing layers in the Photoshop file. Move it behind all the “flower” layers.
12 In the Parameters tab, use the Reposition controls to drag the wawa2 and wawa3 layers below the grass layer. 13 Click the Save button at the top of the Node View, and save the script as field_wawas.shk. Keyframe Animation and the Curve Editor This section continues with the script you created in the previous section. You’ll add animation to create motion that doesn’t exist in the original image sequences. Then, you’ll use the Curve Editor to adjust the animation keyframes.
In the Move2D1 Parameters tab, click the AutoKey button next to the pan parameters. 3 Move the playhead to frame 30, then, using the onscreen transform controls, drag the wawa2 character to the right edge of the frame. 4 Again, using the tranform controls of the Move2D1 node, adjust the vertical position of the wawa2 element at frames 10, 20, and 30 to create a “bouncing” movement. It should look like the character is hopping through the grass. No need to be precise.
6 Click the Curve Editor 2 tab (in the Tool tabs) to view the animation curves. Note: To expand the window, position the pointer in the Curve Editor and press the Space bar. Press the Space bar again to reset the Curve Editor window. Here you’ll see the curves for the two pan parameters that you animated: xPan and yPan. The points on the curves indicate the places where you set keyframes in the Time Bar. To the right of the curves, you’ll see the individual curve channels.
10 Drag the yPan keyframes until your curves look similar to the following illustration. Now make use of what you’ve already learned about motion blur. 11 In the Move2D1 parameters, expand the motionBlur subtree, set motionBlur to 1, and shutterTiming to 1.25. If you move the playhead, you’ll see motion blur on the wawa2 character. Note that the blur effect disappears at frame 30. You can create an offset to fix this. 12 In the motionBlur subtree, set shutterOffset to –1.
13 Before you continue, click the Save button at the top of the Node View to save the changes you’ve made. Curve Editing Tips • To move a keyframe, click the keyframe and drag. • To insert a keyframe, Shift-click a curve segment. You can also enter a value at the desired frame in the Val field of the Curve Editor. • To remove a keyframe, select the keyframe and press Delete (near the Page Up/ Page Down keys) or Backspace. • To adjust the tangents, click and drag a tangent handle.
Color Correction You’ve got a nice composite with the animated “wawas.” Now it ‘s time to blend the elements using color correction. First, you need to match the base colors of the animation to the photographic layers. Second, you want to vary the luminosity of the characters to mimic the lighting from the background.
A ColorMatch node appears after the wawa1 node. ColorMatch1 is already loaded into parameters, but we need to see the result of the composite to match our character to the background. 3 Click the left end of the Composite node to load its output into the Viewer. In the ColorMatch parameters, you’ll see controls that let you specify the low, mid, and high colors of the image (the “Source”) that you want to color correct. Typically, the low color is black or the darkest color in the image.
The ColorMatch Parameters tab also contains controls for colors you want to match (the “Dest” or destination colors), which are also low, mid, and high. When you first insert the ColorMatch node, the color selections for Source and Dest will be the same. Choosing the low, mid, and high values from the destination image that the source image will match As you adjust the Source and Dest colors, the ColorMatch node will color correct the source image to conform to similar colors in the destination image.
7 Click to select the midSource color control, then drag inside a gray area between the wawa’s nose. This should be the most neutral area between the low and high values you’ve selected. You won’t see a difference in the Viewer because you haven’t specified the Destination colors yet. As you continue with the next steps, notice how the image changes with each of your selections. 8 Click to select the lowDest color control, then drag inside the darkest area you see in the background.
10 Click the midDest color control, then drag inside a neutral area or a midrange value between the lightest and darkest areas in the background. Your ColorMatch settings will look similar to this: 11 Click the Home button in the Viewer shelf to see the entire image.
The image doesn’t look quite matched. So let’s make adjustments to the color selections. You can do this with precise channel sliders, found in the subtrees beneath the color controls. You can also drag over the color control while pressing keystroke modifiers to focus adjustments to specific values. To adjust color selections with subtree sliders: 1 Expand the first subtree beneath the lowDest color control.
To adjust colors with the keystroke modifiers: 1 Hold down the G key on your keyboard while dragging over the midDest color control, until the rgb channels are set to 0.4, 0.5, and 0.4. Green channel value l 2 Using the keystroke modifiers or the color sliders, continue to make adjustments to the low, mid, and high destination values until you get a result that you like.
Since you have multiple characters—and they’re composited at different places in the node tree, a better method is to copy and clone the ColorMatch node. Then, when you adjust the original color correction, your changes will apply to the base colors of the other characters, also. To clone the color correction node: 1 Select the ColorMatch1 node and press Command-C or Control-C to copy it. 2 Press Shift-Command-V or Shift-Control-V to paste a copy of node as a clone of ColorMatch1.
You see a connection between the original ColorMatch node and the clone, with an arrow pointing toward the parent. 5 Press Shift-Control-V again to paste another ColorMatch1 clone, and drag it to the noodle under wawa3. 6 Press Control-E to turn off enhanced Node View. Changes in ColorMatch1 will be applied also to ColorMatch1_clone1, and any other clones of ColorMatch1—as long as you do not change the parameters of the clones.
Now that you’ve color corrected the base colors of the characters, you can add other nodes to simulate lighting for their positions at various distances from the camera. To adjust brightness for wawa3: 1 Select the wawa3 node and insert a Color–Brightness node. 2 In the Brightness1 parameters, set the value slider to 0.88. The final character, wawa2, is moving into a shadowed area of the background.
It doesn’t need to be exactly the same as the illustration, but the color correction on wawa2, should match the dark area in the background. The goal is to animate this color correction so that the wawa appears to be retreating into the shadows. Before Mult After Mult You’re finished with the field wawas! Again, good work! 6 Click the Save button to save your changes to the file on disk. 7 Click the Flipbook button to preview the completed composite.
3 Depth Compositing 3 This tutorial demonstrates different methods for creating “real” and simulated depth in your composites. You’ll start with Z channels and filtering options. Then you’ll work with the MultiPlane node.
Simulated Depth and 3D Compositing In this tutorial, you’ll use various methods to create the illusion of depth in composites. You can simulate 3D transformations by positioning, scaling, and rotating the images in the composite. Shake can also perform Z channel operations to filter and mask elements, according to the perceived distance from the “camera” or viewing plane. The MultiPlane node provides another method by compositing elements in 3D space (with x, y, and z axes).
Launching Shake Projects From Terminal Here’s something you can try to speed up your workflow in Shake: Open a Terminal window and enter simple commands that perform the compositing functions before you launch the Shake interface. The following steps provide an alternative way to read images into Shake: 1 Open Terminal, found in the Applications/Utilities folder.
As shown in the illustration above, Shake orders these pixels and outputs the higher values when it layers the images for the composite. Z channels are usually rendered from 3D animation software, where each pixel has a known distance from the camera. Note: You may need to make adjustments—inverting the grayscale image, for example—to make the Z channel from your animation software work in a Shake composite.
Displaying Z Channels The Z channel—or lack of it—in the background image is a problem because some of the balloons and dirigibles should appear in front of the buildings, while others should appear behind buildings. Background image, no Z channel Background image, with Z channel mask This background is a 3D image. You could render a Z channel for it, when you have the animation file.
To view the Z channel of an image: 1 Load the balloons node into the Viewer. 2 Press and hold the Viewer Script button, then choose the View Z button from the popup menu. The Viewer displays the Z channel embedded in the balloons.iff file. 3 To see the numerical Z values, right-click the View Z button, then choose Load Viewer Script Controls into Parameters2 Tab from the shortcut menu. 4 In the Parameters2 tab, set the floatZinA parameter to Original or Distance.
The real Z values are placed into the alpha channel for analysis. The inverted display is a result of the Alpha channel view. 6 Click a pixel or drag over the image to display the Z distance value at the top of the Viewer, shown as the “alpha” value. When the View Z script is active, you can use the Pixel Analyzer to get the minimum and maximum values in terms of distance. 7 Click the Pixel Analyzer tab (in the row of tabs beneath the Node View). The Pixel Analyzer opens.
Some software processes Z channel data differently than Shake. If you’re using 3ds Max, for example, you’ll see negative values in the Z channel of the rendered image. If you’re using a Maya-rendered image, you’ll see values calculated as –1/distance. Setting the floatZinA parameter to Distance returns the actual distance from the camera. You can also choose to “normalize” the Z channel data for either Maya or 3ds Max by selecting the appropriate item in the zNormalize parameter.
4 In the Reorder parameters, enter “rgbar” in the channels value field. This string specifies that red goes to the red channel, green to the green channel, blue to the blue channel, alpha to the alpha channels, and red again to the fifth channel—the Z channel. You now have a Z channel for the background. Next, you’ll copy this Z channel to the city_bg image. To copy the Z channel to the city_bg image: 1 In the Node View, select the city_bg node. 2 Attach a Layer–Copy node.
3 Connect the Copy1 node to the second input of ZCompose1. So what’s the result? Probably different than you expected. There are several places where the balloon images are not masked by the Z channel. ZCompose will not work properly unless all images have an alpha channel. In this case, you need to create an alpha channel for the city_bg.jpg image. To create an alpha channel for city_bg: 1 Double-click the city_bg node to load it into the Viewer and into the Parameters tab.
3 In the city_bg parameters, click the button to enable autoAlpha. A solid white alpha channel is created for the image. Note: As an alternative, you can also attach a Color–SetAlpha node after the city_bg node. 4 Click the left side of the ZCompose node to load the corrected composite into the Viewer. Adjusting Z Depth When you combine the effect of two or more Z channels, as in this example, the distance values do not always correspond to the result you want in the composite.
Color Correcting Premultiplied Images To create a more realistic lighting effect, you can color correct the foreground objects to “reflect” the ambient colors of the background. Use the Color–Add, Color– ContrastLum, and Color–Brightness nodes to correct the balloons image. The images in this tutorial are premultiplied, which means that the RGB pixel values are appropriate for the transparency indicated by the alpha channel.
To color correct the balloons image: 1 In the Node View, select balloons, then insert a Color–Add node. 2 In the Add1 parameters, click the Color control to open the Color Picker. 3 In the Viewer, scrub over the dark orange horizon in the city_bg image to add an orange tint to the balloons image. Everything from the balloons to the background turns bright orange—and check out the artifacts around the edges! This is obviously not good.
The Add1 node applies a tint to the balloons and the sky, but doesn’t affect the buildings from the background image. This is because the composite also includes Zchannel masking, which prevents color correction on the closer elements (in Z space). To fix this problem, you need to isolate the color-correction nodes for this branch of the node tree using MDiv and MMult nodes. MDiv removes the alpha channel from calculations, which prevents the alpha pixels from being color corrected.
This is an extreme color change, but it helps illustrate the issue with premultiplied images. Time to tone it down a bit. 5 Load the Add1 parameters (click the right side of the node), then set the RGB color values to 0.2, 0.11, and 0.07. That’s a little better, but the blacks could use more contrast. 6 Select the Add1 node and insert a Color–ContrastLum node. 7 In the ContrastLum1 parameters, drag the value slider to 1.1, then drag the center slider to 1.
To limit color correction with a rotoshape mask: 1 Insert a Color–Brightness node after the Add1 node. 2 Insert a Color–RotoShape node, then drag a noodle from RotoShape1 to the mask input on Brightness1. 3 Click the left side of Brightness1 to load it into the Viewer, then click the right side of RotoShape1 to load it into the Parameters tab. 4 Using the RotoShape tools in the Viewer shelf, draw a shape around the small zeppelin. 5 Load the Brightness1 parameters, then set the value slider at 0.
Fading With Distance In this section, you’ll add some depth cueing by varying the color correction between the foreground and background elements. There are many ways to do this. One way is to pull a depth-based key from the balloons image and use it as a mask for a colorcorrection node. Again, there are many options for the type of color correction.
5 Connect the DepthKey output to the mask input of the Fade1 node. 6 Click the left side of ZCompose1 to load the result into the Viewer. This part of the mask is partially transparent. The fade effect is definitely varied, but take a close look and you’ll notice that some elements are fading too soon. You need to adjust the range of the DepthKey. 7 In the DepthKey1 parameters, set loVal to approximately 0.25. After adjustment, the mask is opaque.
If you’re happy with the results at this point, then you’re done! Otherwise, you can add some additional nodes to improve the composite. The depthDONE.shk script, located in your $HOME/nreal/Tutorial_Media/Tutorial_03/scripts directory, includes these final changes. Layering Background Elements to Smooth Edges Our little zeppelin has turned out to be problematic in the composite. Notice the hard edge between the right end of the zeppelin and the building in front of it.
This is one example of the node tree you could create for this solution: The KeyMix1 node layers a copy of city_bg, which is masked with RotoShape2, over the finished composite from ZCompose1. KeyMix has a mask input, like all other nodes, but also has a unique input for the mask you want to combine with the other elements. Adding Haze to the Entire Image When you applied the Fade node, the result was a “fade-to-distance” effect.
This DepthKey2 node pulls a key from the combined Z channel of balloons and city_bg. The Compress node uses DepthKey2 as a mask to apply a subtle haze that increases with depth. Original image Haze added with Compress and DepthKey Compress1 adds the hazy color. In this example, the settings are Low Color = 0.25, 0.15, 0.115, and High Color is set to 1, 1, 1. 3D Compositing With the MultiPlane Node In the previous example, you created the illusion of depth with 2D images.
To set up the 3D scene: 1 Add an Image–FileIn node to the Node View. 2 Browse to $HOME/nreal/Tutorial_Media/Tutorial_03/images/betty, select the checker_plane.jpg image, then click OK. 3 In checker_plane parameters, click the SFileIn field and rename the node wall_plane. 4 This image does not have an alpha channel, so turn on the autoAlpha parameter. 5 Select the wall_plane node, press Control-C to copy it, then press Control-V to paste the copy. 6 Rename the copy of the node floor_plane.
The wireframe camera lets you adjust the position of the rendering camera, which becomes the output of the MultiPlane node. The Camera1 view is the default, but you can specify a different camera for output. Each panel shows an independent view of your scene, and you can use the standard onscreen controls to pan and zoom inside them. To navigate in the multi-pane Viewer: 1 To pan, hold down the middle mouse button and drag in the Side pane.
Click the camera to select it, and you’ll see two sets of transform controls: one set at the center of the camera, and one set for the target, or filmback, of the camera. Change camera position & rotation. Change where camera is pointing. Move the camera controls to change the camera position. Move the filmback controls to change where the camera is pointing. Drag the pan controls to change camera position. Drag the rotate controls to rotate the camera.
To adjust the position of the camera: 1 If it is not already selected, click the yellow wireframe camera in the Perspective view. 2 In the Parameters tab, click the Camera subtab and find the translate and rotate controls. You can use the onscreen controls described earlier to interactively change the camera position. Or you can enter specific numeric values in the Parameters tab. 3 In the Viewer, drag the pan controls on the camera (the red, green, and blue arrows) to change its position.
Now that you’ve had some practice manipulating the camera, you need to reset it to the default position. 4 Right-click in the Parameters tab, then choose Reset All Values from the shortcut menu. You can make this scene more interesting by adding additional elements. The MultiPlane node lets you add as many inputs to the node as you require. To adjust elements in 3D compositing space: 1 Drag a noodle from the floor_plane node to the + (plus) sign at the top of the MultiPlane1 node.
The floor_plane appears, but it’s in the wrong position. Before you start moving anything around, it’s a good idea to turn on hardware rendering and make use of the OpenGL rendering engine. 5 Click the Rendering button in the Viewer shelf to turn on hardware rendering. This will speed up the display response. 6 Click in an empty space inside the Perspective (Persp) view pane, then roll the pointer over the L2 floor_plane. When you see the “L2” label in the pan, you know the pointer is in the right spot.
Make sure you check all the view panes while you move, because it’s practically impossible to get precise positioning from a single view. 9 Select the L1 wall_plane element in the Camera1 pane, then drag a corner to resize it to the same width as the floor. 10 Use the pan controls to adjust the wall at the back edge of the floor. When you’re done, the image should look similar to this: Now let’s add the star of your shot—Virtual Betty.
3 Drag a noodle from the walking_woman node to the + (plus) sign on the MultiPlane1 node. f 4 In the Camera1 pane, select the L3 walking_woman element—your Virtual Betty—and adjust her position so that she appears to be standing on the floor.
It won’t look perfect because the camera is in the wrong position. So that’s the next step—place the camera in a position that matches the camera that rendered our walking_woman image. Shake can import precise camera data from an animation program, which you’ll do in the next example. For this project, however, make the camera adjustment manually. wall_plane walking_woman 5 In the Side pane, select the camera, then use the pan controls to move the camera up and forward until the scene is framed.
Here are the camera settings for the project shown in the illustrations: 6 Open the Globals tab, then click the Auto button to adjust the timeRange parameter for the length of the walking_woman clip. 7 Click the Flipbook button in the Viewer shelf to render a preview the composite (and keep the Flipbook window open for the next section). 8 Press the period key (.) to play the Flipbook. Note: Pressing period (.) plays forward in the Flipbook. Comma (,) plays in reverse. The Space bar stops/starts playback.
3 In the Top pane, move the camera position—but do not move the camera target—to the left edge of the floor. 4 Move the playhead to frame 62. 5 Now move the camera to the opposite end of the floor to create the camera move. For the first keyframe, the camera settings should be as follows: translate = –1, 12.527, 16.994 and rotate = –8.392, –20.18, 0. At frame 62 the settings should be: translate = 25.246, 12.527, 10.766 and rotate = –8.322, 47.414, 0. 6 Click the Flipbook button to preview the results.
The first 10 frames look okay. At about frame 40, however, we begin to see just how two-dimensional and superficial Betty really is. Fortunately, Shake has a useful control that will take care of Betty’s 3D shortcomings: faceCamera. This parameter automatically rotates an element in the 3D space to face the camera, at every frame. To force a 2D plane to face the camera: 1 In the MultiPlane parameters, click the Image tab and open the subtree for the L3 walking_woman layer.
If you had camera data for Betty’s animation, you could import it into Shake and get a better lock on the camera move. The betty-DONE.shk file, located in the $HOME/nreal/Tutorial_Media/Tutorial_03/scripts/ directory, takes this project a little further by adding simulated lighting and shadow effects to the composite.
Importing Camera and Animation Data In this example, continue with the MultiPlane node, and create a composite by combining 3D and 2D elements with camera data imported from 3D animation software. A script is already set up to help you get started. To load and preview the MultiPlane example: 1 Click the Load button at the top of the Node View.
2 Browse to the $HOME/nreal/Tutorial_Media/Tutorial_03/scripts directory, select multiplane-start.shk, then click OK. 3 Double-click the MultiPlane1 node to review the structure of the composite. Remember the clipMode option from Tutorial 1? The MultiPlane node has a similar feature, called clipLayer. This lets you select the layer that has the resolution you want to pass to the next node in the tree. 4 In the MultiPlane1 parameters, open the Images tab, then change clipLayer to L8 (sunsky).
If you look in the Perspective pane, you’ll now see these elements: The image sequences include moving objects and other elements that have a noticeable change in perspective. For everything else—the detailed city background elements— you’ll use simple still images that must be matched to the animated camera move. Only the still images will make use of the MultiPlane camera move.
3 Expand the subtree beneath the L8 (sunsky) layer and set the camera distance value to 2500. Note that this changes the position of the layer along the Z axis, but the camera lock ensures that the view from the camera’s perspective does not change. In this case, it allows the sunsky layer to appear behind everything else in the composite.
Before you import camera data, it’s very important that the in/out frames on the Time Bar match the start/stop frames for the camera data. In our example, our camera data starts at frame 95 and ends at frame 156—and the project Time Bar is already adjusted accordingly. To import 3D camera data: 1 Display the Time View and turn off the Shift Curves option. This step is very important, so that Shake will not adjust the frame data from the imported camera. 2 In MultiPlane1 parameters, click the Camera tab.
To adjust the position of the still images: 1 Display the Image tab in the MultiPlane1 parameters. 2 Expand the subtree beneath the L7 (city_panorama) layer, then adust the pan values to –1580, –258, and –1300. Or, just select the layer in the perspective panel and move it with the translate handles. 3 Set the L7_scale to 2, 2, 1. 4 Set the L7 layer faceCamera option to “Camera_1_1.” 5 Expand the subtree beneath the L6 (mg_city_still) layer, and set its pan values to –1032, –366, and –1370.
The point cloud data can help you determine the placement for layers in the composite and verify the camera move. You can move the pointer over a data point to get the precise location of the point. You can hide the point cloud by clicking the Point Cloud Display button: Click here to hide the point cloud data. You can also completely remove the point cloud data from the project. To clear the point cloud data: 1 In the MultiPlane parameters, scroll to the bottom of the Camera tab.
4 Working With Expressions 4 This tutorial shows how to generate animation with expressions, rather than keyframes. Starting with one image of a ceiling and five frames of a rotating fan, you will create an animated effect using filters, local variables and expressions.
Step 1: Set up the basic composition, both in the frame and in time. Since you have only five images of the fan, loop the animation using the Time View. Also, add a RGrad gradient behind the ceiling image to act as a light. Step 2: Using expressions, add a flickering effect to the RGrad node, and use local variables to better control the expressions. Step 3: Add a radial blur (RBlur) effect to create a volume-rendering feel.
4 Click the Home button in the playback controls to load the new frame range into the Time Bar. To composite the images together: 1 In Node View, select the fan node and add an Layer–Over node. 2 Attach the ceiling node to the second input (background) of the Over1 node. The fan image is layered over the ceiling image. 3 Select the Over1 node, add a second Over node, and attach RGrad1 as the background. 4 Your copy of RGrad1 may be a different resolution than the other elements in the composite.
5 Toggle the clipMode parameter of Over2 to set the resolution to foreground. The image should now look like this: Creating a Light Source With RGrad Since you have only five frames of material, you can add a little kick to the composite by animating the position of the RGrad gradient shape to simulate a moving spotlight. To animate the RGrad node: 1 Go to frame 1. 2 Click the left side of the Over2 node to load it into the Viewer, then click the right side of the RGrad1 node to load its parameters.
4 Using the onscreen controls, position the gradient shape in the upper-right corner, then drag the middle ring to reduce the size of the RGrad. 5 Go to frame 75. 6 Using the following illustration as a guide, move the center of the gradient to create a second position keyframe. Now drag along the Time Bar to preview the dramatic animation. You’ll note that the fan blades disappear after frame 5, somewhat reducing the realism of the scene! You can fix this in the Time View.
Looping Frames in the Time View Click the Time View tab to view the clip length of your nodes. Only image generators, such as FileIn and Grad, and layer nodes that combine two branches together (Over, IDisplace, and so on) appear in the Time View.
2 In the fan node parameters, open the Timing tab. 3 Set the outMode to Repeat. The inMode and outMode parameters tell Shake what to do with a clip that is extended beyond the number of frames available from the image sequence on disk. In the Time View, you can see that the fan clip repeats; the triangles mark the looping points. 4 In the Time Bar, click the forward arrow button to play back the sequence.
Creating Flicker on the Light m In the Node View, select the RGrad1 node and insert a Color–Fade node between the RGrad1 and Over2 nodes. You can, of course, enable Autokey for the Fade1 value, then manually animate the fade for a flicker effect on the light. You can automate this with an expression. To insert a function into the value text field: 1 In the Fade1 parameters, click the value text field to select the current value.
3 Edit the value expression so that it reads like this: rnd(time) This returns a random value between 0 and 1 with time as your seed. Without the time seed—or a variable with changing values, the rnd() function is not truly random. Use a static number for the seed, and the fade value will be identical for every frame. By using time as your seed, you guarantee that the values differ from frame to frame.
You can’t edit this curve in the Curve Editor because each value is generated by the expression. However, you can create additional variables, which are “local” to the Fade1 node, then use them to control the values generated by your original expression. The result will be a curve or “envelope” that shapes the random values. To help control the expression: 1 Right-click inthe Fade1 Parameters tab, then choose Create Local Variable from the shortcut menu. The Local Variable Parameters window appears.
8 Set keyframes for animVal at frames 1, 40, and 75. One of the keyframes—it doesn’t matter which one—should be set to a value of 1. The other two can be any decimal number between 0 and 1. The only parameter that matters to the Fade1 node is the value parameter. The other parameters are not hooked into the value parameter yet, so they have no effect. To make things a little easier to work with, swap the rnd function from the value parameter to the rndVal parameter.
Note: To frame the curves, position the pointer in the Curve Editor and press the Home key. This trick makes everybody warm and happy. When you change the shape of the animVal curve, you’ll see how it controls the shape of the random values. This creates a flickering light with random values that are more “organic.” 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.
3 In the RBlur parameteres, set the iRadius to 35. The default values do not greatly modify the RGrad, so you need to make some adjustments. To give the RBlur more definition: 1 In Node View, select the Fade1 node. 2 Shift-click Layer–Outside to insert a new layer node. 3 Drag a second connection from the Over1 node to the second input of the Outside1 node. 4 Connect RBlur1 to Outside1, as shown below.
As a result, the RGrad gradient shape appears only where there is no alpha in the ceiling/fan composite. RBlur1 now has a slightly more interesting effect. 5 In the RBlur1 parameters, do the following: • Set iRadius to 0. (There is no area of the center that is non-blurred.) • Set oRadius to 300. (This 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.) • Set quality to 0.1.
To link the node parameters: 1 In the RBlur1 parameters, expand the center parameter subtree, then type the following in the xCenter field: RGrad1.xCenter 2 Type the following in the yCenter field: RGrad1.yCenter These expressions are similar to rnd(time) or animVal * rndVal, except that they check the xCenter and yCenter in the RGrad1 node for their values. Note: If you enter new values for xCenter or yCenter, or drag the sliders for these parameters, this breaks the links to RGrad1.
6 Connect the output of Fade1 to the second input of Over2. The Fog_Add (IAdd) node adds the two images together. Over2 places the volumetric effect and the fan/ceiling elements over the RGrad.
If you scrub through the Time Bar, you might see a frame where the RGrad is mostly outside the workspace (probably an early frame), and light improperly bleeds in from the edges. Where does this come from? The Shake engine has a normally divine feature called the Infinite Workspace. With the Infinite Workspace, nothing is cropped if it extends outside the frame. Outside1 should cut off the RGrad, except when viewed through the hole in the ceiling element.
2 Drag the Viewport onscreen controls to enlarge the canvas to reveal that the RGrad exists outside of the frame boundary. You can drag a corner or an side of the transform overlay. To correct this, use one of the following (but not both) solutions: Solution 1: Control the Background Color Background Color is considered everything outside the Domain of Definition (DOD) of the image. The DOD is normally the frame of the image, but could be smaller.
2 Display the alpha channel (press A with the pointer over the Viewer) and it will look similar to this: This area outside of the DOD is called the Background Color, and its color can be controlled with Color–SetBGColor. 3 In Node View, select Over1. 4 Insert a SetBGColor node from the Color tab. 5 In the SetBGColor1 parameters, set the alpha value to 1.
The solid alpha value is extended infinitely, and masks the RGrad outside of the ceiling frame. 6 View RBlur1 (click the left side of the node). The bleeding from the edges disappears. 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.
You are finished with this stage. 3 Display the Viewport1 node and compare the difference between the output of the Outside1 node and the output of the Crop1 node. Just reconnect Viewport1 to check the output of each. Outside1 Crop1 4 When you’re finished, delete the Viewport node. Concatenating Color Adjustments Use the following steps to punch up the effect, add a bit of color to the flaring, and brighten the image. To concatenate the color corrections: 1 In the Node View, select the RBlur1 node.
2 Insert a Brightness node and a Mult node from the Color tab, then set Brightness1 as the active node in Parameters. Both nodes should be between RBlur1 and Fog_Add. You’ll now create an expression to take the animation values from Fade1, double them, then apply the result for the Brightness1 value. 3 Enter this for the Brightness1.value parameter: Fade1.
4 In the Mult1 parameters, set the color to blue using the Virtual Color Picker. Hold down the B key and drag to the right to boost the blue color. It is rather subtle, but Brightness1 and Mult1 are concatenating their color corrections. The Mult should tint the entire RBlur blue, but you can see that the center remains white because Brightness1 internally raises 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, .
Adding Motion Blur to Pre-Animated Elements As you view the animation, the fan movement appears too... well... mechanical. The problem is a notable lack of motion blur in the image of the moving fan. Although it’s best to render this sort of thing into the animated images, Shake has a few tricks to help you add this, post-render. There is one caveat: Shake generates motion blur only when it’s creating motion with one of its transform nodes.
• Under the postion parameter, set yPos to 140. Your result should look like this: Note: To update the Text thumbnail in the Node View to reflect your changes, select the node and press R. To mix the Text node with the fan node: 1 In the Node View, select the Text1 node. 2 Attach a Layer–Mix node. This is a temporary node that will let you see the placeholder over the fan clip. 3 Connect the second input of the Mix1 node to the fan node.
Because the fan is dark, boost the fan node brightness (with a Brightness node), or view the alpha channel. Because this subtree is temporary, do not insert it into the rest of the tree. Next, match the fan animation. Start with the initial position. To match the placeholder to the fan’s position: 1 Go to frame 1. • In the Node View, select the Text1 node and insert a Transform–Move3D node. 2 Expand the Move3D1 subtrees for pan and angle, then set the following parameters: • Set fieldOfView to 15.
• • • • Set xAngle to –7.5. Set yAngle to –25. Set zAngle to –195. Leave center (x, y) at 80. The result looks similar to this: To animate the X element: 1 In the Move3D parameters, click the zAngle Autokey button to set a keyframe. 2 Go to frame 5. 3 Set the zAngle parameter to –122. 4 Use the Left Arrow and Right Arrow keys to step through the animation. The animation matches between frames 1 and 5, but stops at frame 5. Use the Curve Editor to correct the problem.
Instead of a flat value before and after the two keyframes, the zAngle parameter keeps the same slope into infinity. KeepValue mode KeepSlope mode 8 Test the animation again with the Left Arrow and Right Arrow keys. The animation continues and is matched beyond frame 5. You are almost done. Honest. To delete the Text node and apply the animation to the fan: 1 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.
When you view Move3D1, the transformation moves the fan image, but that’s not what you want. You want to use the Move3D1 to generate motion blur only, so now you’re going to tell Shake to use the input as a reference, but ignore the transform. To apply fake motion blur to the fan: 1 In the Move3D1 parameters, set motionBlur to 0.5. The result still is not correct—the fan is transformed. 2 At the bottom of the Move3D1 parameters, enable useReference.
That’s it. Now you’ve learned how to create simple volumetric effects and animation through expressions.
5 Using Keylight 5 This tutorial covers the basics of using the Keylight node, including how to pull keys, apply masking, create holdout mattes, and perform spill suppression. The Keylight node is a plug-in developed by Framestore CFC. In addition to pulling keys in the examples, you’ll learn a few masking and color-correction tricks that can be applied to other nodes as well. The first example in this tutorial uses images from the television miniseries, Merlin, courtesy of Lions Gate Entertainment.
Using Keylight to Pull a Key The first section of this tutorial demonstrates the basic steps for using the Keylight node. To pull the key on the “merlin” image: 1 Add an Image–FileIn node, then browse to $HOME/nreal/Tutorial_Media/Tutorial_05/ images. 2 Read in the merlin_fg.jpg and merlin_bg.jpg images. Note: To read in both files simultaneously, drag in the File Browser window to select both files, then click OK. merlin_fg.jpg merlin_bg.jpg You are correct: That’s not Merlin.
5 In the Keylight parameters, click the screenColour control (the blue-colored box), then drag the pointer across the lower portion of the greenscreen color in the Viewer. The greenscreen color appears in the screenColour. (Although Keylight also works with bluescreen backgrounds, it does not work well with secondary colors such as cyan, magenta, or yellow.) The result of your initial color pick is a fairly good key. 6 To view the alpha channel, position the pointer in the Viewer, then press A.
To test the mask using a Viewer lookup table: 1 Click and hold the VLUT (Viewer Lookup Table) button in the Viewer shelf, then choose VLUT2 from the pop-up menu. If you right-click the VLUT2 button, you’ll see that the Gamma/Offset/LogLin VLUT is now active. Note: There are only two Viewer lookup tables installed by default—Gamma/Offset/ LogLin and Truelight—but you can add your own. For more information, see “Viewer Lookups, Viewer Scripts, and the Viewer DOD” in Chapter 1 of the Shake 4 User Manual.
3 In the Parameters2 tab, boost the Viewer gamma level by typing “2.2” into the viewerGamma value field. viewerGamma = 1 viewerGamma = 2.2 The heightened gamma level reveals noise in the image. If you lower the viewerGamma, holes are revealed in the mask. You probably don’t see much until the value drops below 0.5, so don’t worry about the holes for this composite. However, try to correct the background noise.
4 Set screenRange to 0.03. The edges soften, and the mask is filled in, but some of the hair detail drops off. 5 Return the screenRange value to 0. You can see that this parameter can be clumsy. The second set of mask opacity controls are the Gain parameters found in the fineControl subtree. Raise or lower the Gain parameters to increase or decrease the mask in the shadow, midtone, or highlight areas. 6 In the Parameters1 tab, click the plus sign (+) next to fineControl to expand the fineControl subtree.
So right about now, you may be thinking that these parameters are useless and ought never be touched. To the contrary, these parameters are often useful, but this example reveals problems you must consider when keying—noise and edge detail. In this case, another approach should be taken, which is the use of masks. Hair is one of the hardest keys to pull. Filling in the inside of the mask is one of the easiest things to do.
6 Connect the RotoShape node to the fourth input (GarbageMatte) of the Keylight node to remove the gunk on the side of the image. Now the rotoshape matte must be inverted. 7 In the Node View, select the RotoShape1 node. 8 Apply a Color–Invert node to the RotoShape node. The mask is reversed. 9 Activate the VLUT2 button. Hold down the button, then choose VLUT2 from the pop-up menu. You do not have to modify the Viewer lookup values; they are saved for the session.
The Blur node is faster than using the RotoShape feathering. 11 In the Blur1 parameters, adjust the values of the xPixels and yPixels. As soon as the blur is activated, the top of the head gets clipped off. What’s up with that? The RotoShape node is 486 pixels high by default, while the other images are 540 pixels. Be aware that Blur is the only function that let’s you work with the Infinite Workspace on or off.
Color Correcting the Foreground Image To venture away from keying for a moment, this section discusses color correcting the foreground. Since the woman is composited into a red room, cast the woman with a red hue. You do not want to color correct after the Keylight composite, because that would alter the background. Likewise, you cannot color correct before the Keylight node, because that would change the greenscreen. You seem to be in a pickle.
When the output is switched to “unpremult,” the composite looks terrible. This unpremultiplied state is temporary, until you composite with an Over node. 2 To remove the background image input from Keylight1, Command-click or Control-click the noodle. Now use a Compress node with an Over node to re-composite the background. 3 In the Node View, select the Keylight1 node. 4 Attach a Color–Compress node. The Compress node is used for the color correction. 5 Attach a Layer–Over node to the Compress1 node.
Here is the crucial trick: 7 In the Over1 parameters, activate preMultiply. The nasty gunk around the character is removed. For the color correction: Once again, you are matching a foreground image to a limited background image. 8 Load the Compress parameters by clicking on the right side of the node. 9 In the Compress node parameters, click the Low Color control and scrub in the dark corner of the background. The low color is selected.
Although this is an extreme color correction used for illustration purposes, the principal concept here is that you spit out an unpremultiplied image, do your color corrections or transformations, then composite with preMultiply enabled. You can alternatively use On Black for your output from Keylight, apply a Color–MDiv, do your color corrections, then apply a Color–MMult to get the same result, but this complicates the tree. Testing a Color Correction The following is a handy trick.
To begin the composite: 1 Add an Image–FileIn node, then load the saint_fg.1-5#.jpg and saint_bg.1-5#.jpg image sequences. The Joy of JPEG Never use JPEG images for any footage you have to key. The compression causes major problems, as you will find in this tutorial. Also, do not use JPEG images for video interlaced footage, as the fields become corrupted. The first thing you notice is that these are anamorphic frames, so everything is squeezed.
3 In the Node View, select the saint_fg node and apply a Key–Keylight node. 4 Connect the saint_bg node to the second input (background) of the Keylight1 node. 5 In the Keylight1 parameters, click the screenColour control and scrub the back window of the car. This is a good place to scrub because there are no reflections (like the side window). The lesson images are logarithmic (that is, filmic, rather than linear digital or video) color-space images.
Using fgBias to Remove Blue Spill Some blue spill appears on the actor’s hair, on the right side. Since the blue spill is subtle, you can linearize the “log” plates to return them to something resembling the real world. To linearize the log plates: 1 In the Viewer shelf, turn on the VLUT2 button. 2 Right-click the VLUT 2 button, then choose Load Viewer Lookup Controls into Parameters2 Tab from the shortcut menu. 3 In the Parameters2 tab, set the viewerLogLin parameter to LogToLin.
To minimize any yellowness that may occur in the image, you can decrease the fgBias saturation. The stronger the saturation of the fgBias color, the stronger the yellow tint. 2 Position the pointer over the fgBias color control, press and hold S, then drag left. The saturation of the color is decreased. You can also set the balance parameters to 1 to reduce the yellow tint. It does not reduce all of the yellow—her scarf and map may still retain some yellow—but it helps.
4 Connect the HoldKey node to the third input of the Keylight node. 5 In the HoldKey parameters, boost the screenRange to 0.3. The mask becomes solid. When the holdout matte is plugged in, it acts as a mask for the foreground. You are, of course, not obliged to use Keylight. You can also create a holdout matte using other nodes, including RotoShape, Primatte, ChromaKey, LumaKey, and so on. The following illustrations show the Keylight1 alpha channel and the HoldKey alpha channel.
6 Insert a Filter–DilateErode node and a Filter–Blur node between the HoldKey and Keylight1 nodes. 7 In the DilateErode1 parameters, set xPixels and yPixels to approximately –3 to chew into the matte. 8 In the Blur1 parameters, set xPixels and yPixels to approximately 6 to soften the matte. HoldKey matte with dilate and Keylight The holdout matte strengthens the normal key pulled by Keylight1.
m To test the effect of the holdout matte: In the lower portion of the Keylight1 parameters, expand the plumbing subtree, then enable useHoldOutMatte. Without holdout matte With holdout matte Using the replaceColour Parameter You can also use the holdout matte with the Keylight replaceColour parameter to help eliminate the yellowish tint. This is for areas that are keyed out by mistake because they are lit with more blue light than white light, and are also included in the holdout matte area.
6 Using Primatte 6 This lesson describes the basic use and mechanics of the Photron Primatte keying plug-in, as well as masking and spill suppression. Tutorial Summary • • • • • The basics of pulling a key in Primatte Inner mechanics of Primatte Masking Primatte Spill suppression in Primatte Alternatives The Basics of Pulling a Key in Primatte The example images for this lesson are located in the $HOME/nreal/Tutorial_Media/ Tutorial_06/images directory.
3 Add a Key–Primatte node, then connect the bg node to the second input (background) of the Primatte node. In Primatte, you select a “center” value that is the average color of the key you want to pull. (The concept of center is explained in “Inner Mechanics of Primatte” on page 186.) Unlike Keylight, Primatte is ready to scrub your background color as soon as you add the node.
The alpha channel reveals the basic key. The majority of the background should appear black in the alpha channel. Note: If most of the background is medium gray, the center control was not selected when you scrubbed for the bluescreen color. Make sure the center control is active, then scrub the bluescreen again. Output, one of the first parameters in Primatte, determines what is passed out of the node. The output is set to “alpha only” by default.
The composite appears in the Viewer. Inner Mechanics of Primatte So, what is Primatte doing to the image pixels? Whereas Keylight is based on a model of light and its properties, Primatte works by assigning color to one of four different zones through a series of color scrubs. Each zone has its own qualities. These zones are constructed in a 3D space created with the three RGB axes. The following illustration is a 2D representation of this 3D space.
m To view the color zones in the composite: Click the “status” button in the Primatte output parameter. As you can see, the pixels of the bluescreen—ideally, any pure blue pixels—fall inside zone 1 (Background). Note: While we’re talking about blue, don’t confuse the blue pixels from the keyed image with the blue color-coding that Primatte uses in status mode to display pixels assigned to zone 3. The color zones in status mode are merely a way to show you how Primatte is allocating pixels in a composite.
The foreground operator is assigned and a new color control is automatically activated. 3 In the Viewer, scrub the shirt area. Note: The Undo function and Primatte are not best friends. To remove an operator, use the delete op button in the Primatte parameters. To pick a different color, click the color control (under the delete op button), then scrub in the Viewer. 4 To sample more foreground area, click the foreground button again and scrub in the Viewer.
When scrubbing fails, it may be time to apply some rotoscoping to the key. In this case, a holdout matte will work better to mask problem areas such as the dark portion under the woman’s arm. This technique is covered in the “Masking Primatte” section below. If you tried to remove the dark area with a foreground operator and failed miserably, delete the operator. m To delete an operator: In the Primatte1 Parameters tab, click the delete op button, below the currentOp parameter.
By using the foreground and background operators, you have assigned pixels to either zone 1 or 4. Picking any of the eight operators assigns color to a different zone. The following image is a chart of the operator/zone assignments. This illustration demonstrates (roughly) how each operator dimples the surface of the zones through the use of successive color picks. You may have seen implementations of Primatte in other software using a real 3D representation of the color space using polygons.
The currentOp slider scrolls from 0 (the Center pick) to the number of applied operators. Each operation can be accessed by using the slider. The Center pick is always 0, and cannot be deleted. m To modify previous operators: Use the currentOp slider to select the operation you want to modify. Operations are numbered in the order applied.
3 Show the composite (Primatte node) in the Viewer (click the left side of the node). 4 Make sure the QuickPaint1 node parameters are loaded (click the right side of the node). 5 In the QuickPaint controls in the Viewer shelf, click the Hard/Soft brush button (this is the default) to toggle the selection to Hard. 6 Drag the brush across the text to “erase” it.
To create a holdout matte: 1 Add a second QuickPaint node (a RotoShape node would also do the job), and connect the node to the fourth input (holdOutMatte) of the Primatte1 node. Note: To identify inputs on the top of a node, position the pointer over the input and read its name in the Info field at the bottom-right portion of the interface. 2 Using the brush in the QuickPaint node, paint a holdout matte along the line under the woman’s arm.
By default, Primatte replaces the alpha channel, but you can also add, subtract, or multiply the two masks. With this technique, you can create several masks and combine them in Primatte. Since there is no incoming mask in this example, the arithmetic parameter has no effect. In this example, there are three primary areas where the blue spill is apparent: The edge of the woman’s hair, the shadows on her shirt, and possibly the little transparent bit of her skirt at her knees.
2 In the Viewer, drag along the purplish edge of the woman’s hair. 3 You may need to apply two or three spill sponge operators. The spill sponge operator applies a precalculated amount of spill suppression, and replaces the blue color with an alternative color. For the spill on the shirt, you could use additional spill sponge operators. But, for this example, use the fine tuning operator instead.
2 In the Viewer, drag along the bluish part of her shirt. 3 Adjust the spillSponge slider (under the color control). The more you slide, the greater the range of suppressed area. 4 To view the affected areas, toggle output to “status,” then move the spillSponge slider up and down. The green zone (spill suppression) increases and decreases in size. The spill-suppressed image appears slightly transparent when you return the output operator to comp.
5 Connect the Blur node to the replaceImage input (the last input) on the Primatte1 node. Since the black chair backing has lost its definition, the shirt appears less transparent. The alpha channel remains solid. An alternative to spill suppression is to set the replaceMode parameter to “use color,” which fills the spill areas of the image with a solid color specified in the Replace Color parameter.
Under the right circumstances, this can reduce blue or green spill quite nicely. Under the wrong circumstances, it can create a fuzzy halo around your edges—so use with caution. 4 Set the replaceMode parameter back to “use image.” You can also remove blue (or green) spill, before keying, by replacing it with a color from your background. Other nodes that can remove spill suppression include Key– SpillSuppress, Color–AdjustHSV, Filter–Blur, or Color–Monochrome applied to the foreground image.
4 Turn on the affectAlpha button, then view the alpha channel of the node to test the area you are modifying. 5 Set all the hueRange, satRange, and valRange parameters to 0. 6 Set the hueFalloff, satFalloff and valFalloff parameters to 0.2. 7 Load the Primatte1 node into the Viewer and you’ll see the results. You may need to do some fine tuning operations in the Primatte1 parameters after you’ve used ColorReplace for spill suppression.
Compositing Outside of Primatte Primatte has a great deal of flexibility because you can composite within the node or pass its alpha channel to other layer nodes for compositing. You have the most flexibility when you do not composite inside of Primatte, because you can control how and where color-correction and effects are applied to your images. In the following process tree, the Primatte output is set to “alpha only,” and preMultiply is enabled in the Over node.
7 Tracking and Stabilization 7 This tutorial demonstrates the primary uses for Shake’s tracking technology, including removing unwanted motion from an image sequence and “matchmoving” an element to the motion of another element in the composite. Tracking allows you to do two things. First, you can eliminate unwanted movement in a plate, such as the movement caused by film gate weave. This is known as stabilizing.
• Transform–Stabilize: This node generates one, two, or four tracking points, or uses points generated by other tracking nodes. It performs either stabilization or matchmoving. • Transform–MatchMove: This node performs matchmoves and composites. It can also create its own one-, two-, or four-point tracks. Stabilizing an Image Sequence In the first section, stabilize a moving clip. Later, track the “Eat At Joe’s” sign onto the image.
The Time Bar range is set from frame 1 to frame 15. This does not affect your rendered frames, but helps you adjust your track points. You have by now no doubt discovered that the plate drifts to the left. This is a prime candidate for stabilization, which locks the image down. 4 In the Node View, select the stab node, then add a Transform–Stabilize node. A tracker appears in the Viewer. When the pointer is positioned over the tracker box, the tracker is highlighted.
5 Drag the tracker box to a high-contrast area— for example, the large window in the middle of the image. The tracker is composed of the track point (the center), the reference pattern (the inner square), and the search region (the outer square). Here’s how it works: Shake analyzes the reference pattern (the area of your image isolated within the inner square of the tracking box), then in subsequent frames looks for that pattern within the search region (the outer square of the tracking box).
Note: When tracking large plates, turn on limitProcessing in the Stabilize parameters to decrease image load times. 9 Press Play to test the stabilized plate. Note: You can also test the stabilized plate by launching a Flipbook. The window stays in the same position for the duration of the15-frame sequence. When the plate drifts, the Stabilize node moves it back to the original point. This eventually causes a black border to appear around the image.
Converting Stabilization Data to MatchMove Data Use the same building clip to build a simple matchmove. In this case, remove the stabilization data from the building clip, invert the stabilization data, then apply the data to a second image. To convert stabilization data to MatchMove data: 1 Add another FileIn node (do not delete the node tree built in the previous section) and read in $HOME/nreal/Tutorial_Media/Tutorial_07images/stabilize/eatatjoes.iff.
The eatatjoes image drifts away from the background image. The Stabilize node is trying to stabilize the image—the opposite of what you want. To match the eatatjoes image to the movement of the building clip, invert the transform by setting the shrewdly named invertTransform button to “match.” 6 In the Stabilize Parameters tab, set inverseTransform to “match.” The eatatjoes sign moves with the background plate. As shown, you can use the Stabilize node for stabilization and matchmoving.
Using the MatchMove Node The next example uses more complicated tracking information to match a background clip that changes perspective. The MatchMove node is used to match the movement of the background. In this example, read in a clip of a moving bus and an advertisement image, then apply the image to the side of the moving bus. This tutorial also discusses some solutions for common tracking problems.
5 Connect the bus2 node to the second input of the MatchMove node. Although this project calls for a 4-point track (one for each corner), begin with only one tracker to keep things simple. Several intentional mistakes occur in this tutorial to help you better recognize problems with tracking your own footage. 6 Go to frame 1. 7 Position the tracker box in the lower-left corner of the sign on the side of the bus. Leave the tracker at the default size, and precisely position the track point on the corner.
The search region is too small to encompass the movement in the clip—the bus moves too far to the right. In this illustration, the desired area, artificially marked in green, extends beyond the zone of the tracker search region (the outer red box). If the search region is too large, you waste time processing. If the search region is too small, the tracker does not find successful matches. There is also a black line around the sign along the bottom of the pattern.
Gee, everything was going fine until around frame 34, right? At that frame (results vary), the tracker spitefully decided that the words on the sign were the best match to the original reference pattern at frame 1. The tracker continually compares the new images back to frame 1 (or whichever frame you used to start the track). As the bus moves away, the sign gets smaller. At a certain point, the words match the original thickness of the sign border from frame 1 better than the sign border itself.
12 In the MatchMove Parameters tab, set the referenceBehavior pop-up menu to “update if below reference tolerance.” 13 Find a frame with a high correlation. Although you can track from frame 33 (the frame before the tracker got confused), it is better to find a frame with a high correlation. The correlation is displayed in the yellow text next to the tracker box. Ideally, this is of course frame 1, but you may find a high correlation at approximately frame 14. 14 Click Track Forward.
The three extra trackers are activated. Each tracker is located in the relative corner where it should stay. For example, the upper-left corner of the foreground image is connected to track4 of the MatchMove. Shake uses Cartesian coordinates, so the trackers are ordered according to the following image. Yes, you are right, this is different from some other prominent systems. Deal with it. The first track point, track1, is already set, and its keyframes are visible.
This ensures the track is not overwritten. An active tracker is green in the tracker list. 3 Go to frame 1. 4 Following the same principles of the first tracker, position and shape each of the remaining trackers on the remaining sign corners. 5 Click the Track Forward button to start the tracking analysis.
When finished, the three points should be reasonably accurate. If not, use the visibility toggles to isolate problem trackers and repeat the above steps to correct your track. Note: Manual tracking? Don’t ever ever ever believe a product demonstration— tracking, like keying, is rarely straightforward and usually involves a lot of manual labor. Make sure Autokey is on and away you go. You frequently must adjust points by hand.
2 Toggle applyTransform to active. If an image appears brighter in an Over operation (in effect adding the two images), you should immediately suspect the absence of a mask in the foreground. Because the sign image is a JPEG and does not support alpha channels, you must add an alpha channel to the image. 3 In the sign node parameters (the FileIn node), enable autoAlpha. The autoAlpha parameter examines the input image for an alpha channel.
To adjust the foreground sign position: 1 Go to frame 1. 2 Ensure that the Viewer Autokey button is deactivated (unless you want to animate the image, which you do not). 3 Click the BG/FG button on the Viewer to show the foreground display. This displays four corner markers in the Viewer. These points correspond to what is matched to the four trackers. By default they are located in the four corners of the image. 4 Pull the corners in. The corners represent the track location points.
The image is now slightly larger in the composition. Color Correct the Foreground Element Anybody who has visited Los Angeles knows that a clean bus is a mythical beast. As the final step, color correct the sign to better match it to the bus. Before After To build the color correction: 1 In the Node View, select the sign node. 2 Using the following illustration as a guide, insert these nodes from the Color tab: Compress, Mult, Saturation, and SetBGColor. 3 Add an Other–AddShadow node.
Note: You do not need a MDiv/MMult set because you are working on the full frame. For the color correction, first adjust the whites and blacks with the Compress node. Because the sign has pure whites and blacks, and the bus has good representations of what should be white and black, Compress works well. 4 In the Compress1 parameters, click the Low Color control. 5 Scrub color in the Viewer that represents the blackest part of the bus, for example, under the wheel well of the bus.
The sign is a neutral grey color. Some warm color makes it stick out a bit and draws the viewer’s attention (though not too much—it still has to be integrated into the scene). You can tint it yellow with Compress1, but you then must have the same modification for all of your keyframes, which is cumbersome. A better idea is to use the Mult node to tint the image. As Compress and Mult concatenate, there is no loss of color quality. This is good. Very good. 5 Load the Mult1 parameters.
3 Set shadowOpacity to approximately .7. No shadow With AddShadow Note: For additional fine tuning, look at the script bus_track2.shk script in the $HOME/ nreal/Tutorial_Media/Tutorial_07/scripts directory. This script adds some color correction and masking to take care of the reflections that go across the side of the bus from frames 36 to 40. Stabilize as an Alternative to MatchMove You may have noticed that tuning the corners of the sign using the FG/BG Viewer controls was less than ideal.
6 Insert a CornerPin node above the Stabilize node. CornerPin is used to position the foreground over the background.
To copy the tracks into Stabilize: 1 Right-click the trackNames, then choose Load Track from the shortcut menu: The Select Track window opens. 2 Choose MatchMove1.track1 from the pop-up menu, then click OK. Track1 is copied from MatchMove1 to Stabilize1. 3 Repeat the process for track2 through track4. 4 Activate the transformation with applyTransform. 5 Set the inverseTransform parameter of the Stabilize node to match.
You are currently applying the motion to only one point, so toggle your trackType to “4 pt.” Things don’t quite line up in the Viewer. Oops. Frame 1 Frame 30 MatchMove has controls for adjusting the foreground position. Stabilize, by default, assumes that frame 1 has the relative position that you want. The selected frame can be modified with the referenceFrame parameter, but it still doesn’t modify the relative position.
8 Working With Macros 8 This tutorial demonstrates how to create reusable groups of commands, called macros. In this example, you’ll set up a basic macro for a motion blur effect that is adjustable to any angle.
The following images demonstrate the creation of a macro. The first image shows four connected nodes—the Text node and the three nodes that combine to create a blur effect. Following a long, arduous process, the second image shows the completed macro attached to an icon (RotateBlur icon) in the Filter Tool tab. The third image shows the completed macro, the RotateBlur node, applied in the tree—it looks like any other node.
4 Attach a second Rotate node. In this example, the algorithm works by rotating the image, blurring the image on the X axis, then rotating the image back to the start position. Therefore, if Rotate1 has an angle of 45 degrees, Rotate2 must have an angle of –45 degrees. The best way to make this happen is by entering an expression to link Rotate1 to Rotate2. To link the Rotate1 and Rotate2 angle parameters: 1 Click the right side of the Rotate1 node to load its parameters into the Parameters tab.
To test the effect: 1 Load the Rotate2 parameters into the Parameters tab. 2 Adjust the angle parameter. The blurring rotates, but the text stays in the same spot. If the Rotate2 angle parameter is 67 degrees, then the Rotate1 angle is –67. Warning: Do not modify Rotate1, because that will break the link to Rotate2.
4 In Shake, drag to select the Rotate1, Blur1, and Rotate2 nodes in the process tree. 5 Press Command-C or Control-C to copy the nodes. Note: You can also select Copy with the right-click shortcut menu in the Node View. 6 In the text editor, paste the nodes (press Command-V or Control-V). The Shake source code is pasted into the editor, and it looks something like the following: Rotate1 = Rotate(0, -Rotate2.angle, 1, width/2, height/2,0, .
The text in your editor is raw script, meaning it is not formatted as a macro. If you paste it back in, you get three more nodes. You need to format the text as a single function— a macro. 7 Delete the layout information—that is, everything in the text editor window including and below the “User interface settings” line. These lines tell Shake where to place the nodes if you paste them back in again. You do not need the lines, so remove them. You are left with this: Rotate1 = Rotate(0, -Rotate2.
1 Add the formatting for the macro body and declare the macro type and name: image RotateBlur( ) { Rotate1 = Rotate(0, -Rotate2.angle, 1, width/2, height/2, 0, 0.5, 0); Blur1 = Blur(Rotate1, 200, 0, 1, "gauss", xFilter, "rgba"); Rotate2 = Rotate(Blur1, 42.61728, 1, width/2, height/2, 0, 0.5, 0); } Next, you need to declare the information that is passed into the macro. You can potentially change all parameters—the rotate angle, center of rotation, motion blur parameters, blur filter, and so on.
4 Indicate what you want to spit out of the macro with the return line. This is the final image (or float, int, string) that you want to extract out of the macro function. Remember the semicolon at the end of the line—in this case, return Rotate2, as it has the result you need. Add the return line: image RotateBlur( image input, float angle, float blur ) { Rotate1 = Rotate(input, -Rotate2.angle, 1, width/2, height/2, 0, 0.
m To test the macro: Go to the command line in Terminal. You might be saying to yourself right now, “Hey, why am I testing this in a Terminal?” All you have done so far is create the macro—you have not plugged it into the Shake interface. You have not written anything that tells Shake to build this function into the interface. You do that in a moment.
Now try your new macro on an image. If you do not have an image, use the sample image in the $HOME/nreal/Tutorial_Media/Tutorial_08 directory. To test your new macro on an image in the Tutorial_08 directory: 1 In the Terminal, type the following: cd nreal/tutorial_media/tutorial_08/images The “cd” command at the beginning of the line tells Terminal to change directories to the specified path—in this case, the Tutorial_08/images directory. 2 Press Return.
3 Set the xSize parameter to 75. 4 Set the ySize parameter to 40. The result is an image that is 75 x 40 pixels. To save the icon file: 1 Attach an Image–FileOut node to the Fit node. 2 In the File Browser, use the Directories pop-up menu to navigate to your $HOME/nreal directory. 3 Open the icons directory. You should have created this directory in the first step of the tutorial. If not, use the Create Directory button to make this directory. 4 Type “Filter.RotateBlur.
Important: Shake assumes you have matched the tab name with the file name, so if you actually did place this into the MySwankFunctions tab, you have to rename the icon file on your disk to MySwankFunctions.RotateBlur.nri. Creating a Node Without an Icon If you do not have an icon, create a plain button with text on the button by placing an @ sign before the word: nuiToolBoxItem(“@OopsNoIcon”,RotateBlur(0,0,0)); As this example shows, the button name can differ from its actual function.
• If there is nothing at all, you have made an error in your ui file. Check the error messages for an indication. • If the icon is there, but nothing happens when you click the button, check the spelling, capitalization, and number of arguments of the call to the RotateBlur function. Make sure there are no extra commas. • Make sure you saved your ui file in the ui directory, and that it ends with a .h extension. How to Set Slider Ranges This section discusses how to test the sliders created in your macro.
This sets the slider range from 0 to 400 for the blur parameter of the RotateBlur function. Spelling and capitalization are important, which is why that tiresome rule explained earlier starts to make sense. You do not have to set a range for angle, because it is already set between –360 and 360 in the default Shake setup files. To change the angle slider range, duplicate the blur line and modify it to say angle.
The node tree appears in the Node View. 2 In the Node View, select the Rotate1, Blur1, and Rotate2 nodes that build the macro. 3 With the pointer in the Node View, press Shift-M. Note: You can also right-click in the Node View, then choose Macro > Make Macro from the shortcut menu.
The Shake MacroMaker is launched. The top portion of the Shake MacroMaker window contains text fields for the name of the macro, and specifies in which tab the macro is placed. By default, MacroMaker assigns a name, “UserMacro,” and assigns the macro to a new Tool tab called “User.” You can change the name of the macro and its tab. 4 Name the macro “RotateBlur.
• The “Shake directory” is the /include/startup directory. When this option is checked, the macro is available to all users who open Shake using that specific binary in that specific directory. You may have permissions problems writing to this directory. The “Macro’s output is” pop-up menu tells you which node is the final output node of the new macro. Shake usually makes a good guess, but you may need to explicitly specify the node if you have multiple branches selected.
7 Make sure the float angle Visibility button is on. The Rotate1 “image In” parameter is activated automatically. This is because an image is fed into it, but is not accounted for by the nodes that you selected. This can cause problems (though not in this case), as all unattached image inputs are activated. 8 Click OK. A new button called RotateBlurA appears in the Filter tab, identical to the macro you previously created.
9 Creating Clean Plates 9 This tutorial demonstrates how to stitch images with the AutoAlign feature, and how to use SmoothCam to stabilize footage. You will also use the QuickPaint node to create a clean background plate. Tutorial Summary • Stitching images • Stabilizing and stitching background plates • Creating a clean plate with QuickPaint Stitching Images The AutoAlign node lets you stitch up to three images to create a continuous image for backgrounds, panoramas, and other similar elements.
To stitch images using the AutoAlign node: 1 From a new Shake script, insert an Image–FileIn node. 2 In the File Browser, navigate to the $HOME/nreal/Tutorial_Media/Tutorial_09/images/ stitching directory. You’ll see one image sequence, photo1369-1371@.JPG. By default, Shake assumes that sequentially numbered frames are part of an image sequence, and displays a single file name in the File Browser. These are the still images you want to read in, but you don’t want to read them as an image sequence.
Now that the the images are connected, you can tell AutoAlign to analyze and stitch them. There are two different modes for analyzing the pixel data: precise and robust. 6 In the AutoAlign1 parameters, change mode to robust. 7 Click the analyze button. When Shake completes the analysis, you’ll see a simple stitch operation, without blending or color matching. Note: If you do not see acceptable results, switch from robust mode to precise mode, then click the analyze button again.
9 Turn on the matchIllum option to fix the color match between images. Now you should have a fairly good background plate. Notice that Shake arranged and stitched the images correctly, even though they were not connected in the order that they should appear in the panorama. This is possible because there is enough overlap between the images (about 20 to 30 percent) to allow accurate calculation and positioning.
This image is attached to the first input of the AutoAlign1 node, and is designated as the “locked” plate—meaning that it will not be distorted. From the lockedPlate list, you can choose an alternate image and the other images will be distorted to match it. Stabilizing and Stitching Background Plates AutoAlign also stitches moving images. In this section, the process is almost identical to the previous example, except you will first stabilize the images to eliminate unwanted movement.
You may already be familiar with the Stabilize node and wonder why we’re not using that to stabilize the footage. These clips were all shot without the benefit of a tripod or camera mount—that’s right, they’re handheld. The SmoothCam node can stabilize and adjust for translation on all three axes (x, y, and z), and can also stabilize for zoom and perspective changes. The Stabilize node adjusts for transformations on the x- and y-axes only. To open the stitch-2_start.
To stabilize the clip1 image: 1 Select the clip1 node, then insert a Transform–SmoothCam node. 2 In the SmoothCam1 parameters, the frame range (1-11) should appear at the top of the parameters. (If not, type “1-11” in the analysisRange field.) 3 Set the steadyMode to lock. Choose lock instead of smooth because you want to remove all camera movement from the shot, if possible. Now, you need to specify which types of movement to eliminate. 4 Expand the lockdown subtree.
7 Now insert Transform–SmoothCam nodes for the clip2 and clip3 nodes, and repeat the stabilization process for these images. When you’re finished, you may want to load each SmoothCam node into the Viewer and then create Flipbooks to preview the results. To stitch the clips together: 1 Double-click the AutoAlign1 node to load it into the Viewer and the Parameters tab. 2 Again, check the frame range for analysis. If it’s not correct, type “1-11” in the analysisRange field.
To crop the stitched plate: 1 Select the AutoAlign1 node, then insert a Transform–Crop node. 2 In the Viewer, drag the borders to crop the portion of the image you want to use in a composite. Now you’ll remove some of the distortion in the image. You can remove lens distortion before you stabilize and stitch; otherwise, the locked plate image influences any motion or perspective in the stitched image. In the spirit of simplification, use the LensWarp node at this point to remove some of the distortion.
To adjust for lens distortion: 1 Select the CCrop1 node, then insert a Warp–LensWarp node. 2 Load LensWarp1 into the Parameters tab and select Undistort. 3 Expand the factor subtree and set xFactor to 10, and yFactor to 6. 4 Set kappa to 0.05. 5 Change the center to 620 (xCenter) and 495 (yCenter). 6 Click the analyze button. That’s should do it. It’s not perfect, but it’s a quick little fix. 7 Double-click the output node and you’ll see the result.
There are many ways to accomplish this. You might immediately think “Clone brush” in QuickPaint, and you are in fact partly correct. You can create a clean plate by cloning image information, but you’ll also use the Reveal brush to layer an image from another frame over the frame you want to clean. The images for this example are courtesy of Mr. Ron Brinkmann from his film, Hope, © 2002 Precipice Pictures. To load the tutorial images: 1 Start from a new Shake script, then insert an Image–FileIn node.
When creating a clean plate, try to select frames with as little overlap of the foreground characters as possible. Because this is not always practical, you should always request a clean plate shot whenever possible (and save yourself the tedious task of going through this tutorial). bridge001 bridge038 You will modify frame 1 (in this case, named bridge001) because the people are smaller, which means less area to clean up. Before you can use one image to fix the other, you need to align the two plates.
2 Add a Color–Invert node to the Move2D1 node. 3 Select the bridge001 node and add a Layer–Mix node. 4 Connect the Invert1 node to the second input of the Mix1 node. The combination of Invert and Mix let you clearly see the differences between the two images. 5 Load the Mix1 node into the Viewer (click the left side of Mix1) and load the Move2D1 node into the Parameters tab (click the right side of the Move2D1 node). The Move2D onscreen controls appear.
The images are aligned when most of the background noise disappears. Not aligned Aligned 7 In the Node View, select the Invert1 node, then press Delete. 8 Select the Mix1 node, then Command-click or Control-click the QuickPaint command button in the Image tab. The Mix1 node is replaced by the QuickPaint1 node.
9 In the QuickPaint controls in the Viewer shelf, click the “frame” button twice until it reads “persist.” When Persist (Persistent) mode is set, the paint strokes remain on all frames. If you’re curious about the other paint modes, Frame places the paint strokes only on the frames displayed when you paint the strokes. The third mode, Interp (Interpolation), uses the frames with paint strokes as keyframes, and blends or animates the strokes between the frames.
5 If you paint too far to the left, and reveal the actors in frame 38, use the Eraser to tidy up. Unfortunately, there is a small area where the actors overlap in the frames, and the Reveal Brush cannot do the whole job. The Clone Brush can help you clean up that last bit by copying some of the nearby color from the water. To paint with the Clone brush: 1 Click the Clone Brush button. 2 Press the Shift key and drag to relocate the brush from the clone source.
Once you have a clean plate, add an Image–FileOut node and render the clean plate as a new image or image sequence to include in the main composite. Here you’ve cleaned one frame. You could apply the same techniques to clean an image sequence or clip.