Who's it For: Although intended for the beginner, this tutorial can also benefit more advanced editors wanting to hone their compositing skills.
The Following Were Used to Create This Tutorial:
*For more detailed information on the BCC AVX4 filters covered in this tutorial, please refer to the Boris documentation that came with your product.
What is Corner Pinning?
Corner Pinning is defined as a technique for manually repositioning the four corners of an image to map it to a specific area of another image. It can also be combined with the data derived from four-point image tracking to substitute objects in moving images, for example, replacing the license plate on a car driving down the street.
This tutorial will explore the process of corner pinning in-depth. As a compositor, my first inclination was to use Adobe After Effects or AutoDesk Combustion to do work of this nature. But, testing of BCC AVX4s filters led me to believe I might be able to pull this off
all inside of Avid! I decided to give it a try and I was not disappointed.
-Launch Avid and create a 30i NTSC project.
-Import the SF_Wharf and Boy_Computer clips, both are 720x486. Go to the Project Window and click on the Settings tab, then double click on General to open up the General Settings window. Make sure your Effect Aperture is set to ITU601 (720x486).
-First, drag the SF_Wharf clip from your Bin and drop it into the Timeline window where it becomes video track 1 (V1) in the Timeline.
-Create a new video track (Ctrl+Y) and edit-in Boy_Computer, which becomes video track 2 (V2). Select this track to make it active and you should see the Boy_Computer
clip appear in the Composer monitor.
-Choose Effects Editing from the Toolset menu and the Effect Palette appears in the Project window.
-Select the BCC Corner Pin filter from the BCC Distortion and Perspective category in the Effect Palette, and drag-n-drop it onto the Boy_Computer clip (V2) in the Timeline.
The Effect Editor opens and displays the parameters and values for the current effect in the window. At the same time, the Composer monitor becomes the Effect Preview Monitor.
-With the Timeline window active, click the Home key on your keyboard to bring the Control Time Indicator (CTI) to the first frame of the sequence.
-Go to the Corner Pin Source tab inside and near the top of the Effect Editor, and change it to 1st Below.
-View the Effect Preview Monitor and see that the effect gets applied to the SF_Wharp clip (1st Below) in V1.
Preprocessing the Image
Preprocessing the image makes tracking easier and more accurate.
-Scroll down in the Effect Editor and click the Disclosure Triangle next to Motion Tracker Preprocess group to expand its parameters.
-Check View Preprocessed Source. With this enabled, the four Trackers and their Target and Search Width region boxes are displayed on screen in the Effect Preview Monitor. The default tracker placement is: Tracker 1 going clockwise to Tracker 4.
Working in View Preprocessed Source mode allows you to:
- Adjust the Input Whites, Input Blacks and Gamma parameter sliders to produce a high contrast image, which is ideal for tracking.
- Adjust the Blur Sharpen parameter slider to soften noise, grain or aliasing that might disrupt tracking. You can also use Sharpen to better define the image if it is too soft.
-Enter the following values for Input Black, Input White, Gamma and Blur Sharpen:
Placing the Trackers
Now that we have enough contrast in the image to provide good reference areas for tracking, our next step is to place the trackers. You can manually move them by their Center Point.
-Make sure your CTI is on the first frame of the sequence.
-Go to the Effect Preview Monitor where the trackers are displayed on screen.
-Grab Tracker 2 (green) and drag it to the top right corner of the boys laptop screen, (It is important to be as accurate as possible with your tracker placement).
Tip: You can see the corner better by zooming in on the image using the Enlarge tool (magnifying glass) in the Effect Preview Monitor toolbar. Ctrl+Alt will allow you to move the image.
-Now, position Tracker 3 (Blue) on the bottom right corner of the screen.
Since the left side of the laptop screen is out of frame, we are going to have to find other suitable areas of the image to track.
-Inside the laptop screen on its desktop, notice there is a user interface (UI) window that has distinct edges. Place Trackers 1 (red) and 4 (yellow) on the upper and lower right corners, respectively, of that UI window.
Tip: Remember, it is important to place and arrange the four trackers so that they approximate the shape, angle and perspective of the laptop screen.
-In the Effect Editor, deselect the View Preprocessed Source checkbox.
Notice the four trackers Target and Search Width region boxes disappear, leaving only the Center Points behind. The SF_Wharf image is corner pinned to fit the dimensions designated by the Center Points.
At this stage, the resulting corner pinned image looks far from perfect. We will correct this after our next step - Motion Tracking.
Tracking the Laptop Screen
In order for the corner pinned image to match the movement of the boys laptop computer screen, it must be motion tracked.
-In the Effect Editor, expand the Motion Tracker group and check Track On the Fly.
The preprocessed colors re-appear, as well as the Tracker Target and Search Width region boxes. This means the clip is now ready to be tracked.
|This next step is for users who have acceleration hardware (Mojo) with their systems: |
-Before launching the tracking, increase the video quality of your image by right-clicking on the Video Quality Menu at the bottom of your Timeline window and set to Full Quality. Motion Tracking at a projects full resolution is always recommended for accuracy. (If you dont have a Mojo, tracking in Draft Quality will suffice)
-Click the Play button on the Effect Preview Monitor toolbar.
If all is functioning properly, there will be a green bar at the bottom of the image indicating the frames that have been tracked. Also, the Center Points should remain at their original starting position while the region boxes follow the movement through the clip. This is normal.
After the tracking reaches the end of the clip, it will stop. Let's render and preview the effect to see how the tracking did.
-In the Effect Editor, uncheck Track On The Fly.
-To speed up the render, reduce the preview resolution by right clicking over the Video Quality Menu (located on the bottom left of the Timeline window) and select Draft Quality.
-Go to the top of the Timeline window and select Render Effect. Then click Okay.
-After the clip is rendered, click the Spacebar on your keyboard or Play on the Effect Preview Monitor toolbar to preview the effect.
Notice the track data is applied and the SF_Wharf clip is securely pinned and matchmoved to the Boy_Computer clip. As we discovered earlier, our corner pinned image is askew because Trackers 1 and 4 could not be positioned on the left corners of the laptop screen (as they were out of frame). We can correct this with the Corner Offset controls.
Adjusting the Four Corners
-Hit the Home key on your keyboard to bring the CTI to the first frame of the sequence.
-Go to the bottom left corner edge of the Effect Editor window and click the Outline/Path button to turn off the on-screen graphics. This will hide the Tracker Center Points so you can better see the corners of the image while adjusting.
-Scroll up in the Effect Editor and expand the Scale and Offset group to reveal its parameters.
-Adjust Corner 2 and Corner 3s Offset X & Y sliders until the SF_Wharf clip is correctly positioned to match the dimensions on the right side of the laptop screen.
Since the left side of the laptop computer is off screen, you can't see those corners to match your offsets to. You can try guessing, but if your offset values are incorrect, your images perspective will be off. How do we make these adjustments blindly?
Heres an answer..
Tip: Feel free to temporarily substitute the SF_Wharf clip (V1) with a still image containing vertical lines, e.g. a grid, to act as a guide when adjusting your perspective. I used a BCC Brick filter from the BCC Generators category which worked fine.
-Adjust Corners 1 and 4 until you are satisfied the perspective matches.
-Delete the BCC Brick generator in V1 and edit back in the SF_Wharf clip.
Listed below are the final Corner Offset values I used. Enter these values or feel free to keep your own as your tracking results may have varied slightly from mine:
Now lets check our matchmove again with the newly positioned corners.
-Either render and playback the sequence or go to the timeline and scrub though the clip. Notice the image may drift slightly off the corners. If it does, we can correct this by adding Keyframes.
Improved Keyframing in Avid
An indispensable feature that Boris users can take advantage of is Avids Advanced Keyframing. Being able to set keyframes for individual parameters as well as assign Shelf, Linear, Spline or Bezier interpolation to them, are all welcomed additions to Avids AVX 2.0 plug-in architecture.
|Things to remember about Avids Advanced Keyframing: |
-It is important to add a keyframe BEFORE changing an effect parameter
-Presently, only BCC AVX4 (and above) can run on AVX 2.0. Therefore, BCC AVX3 users do not have Advanced Keyframing.
On to the keyframing..
-On the bottom edge of the Effect Editor, click the Promote to Advanced Keyframes button to expand the window
to reveal Avids Advanced Keyframing Tracks.
-Bring the CTI to the first frame of the sequence.
Since all of the corners look good on frame 1, we will add our first keyframe there to make sure these values are kept.
-In the Effect Editor, right click over the Scale and Offset Group keyframe track and select Add Keyframe. This applies a keyframe to all the corner parameters in that
Tip: Before keyframing any function, it is always a good idea to study the original clip to determine the type of keyframe animation (interpolation) that would best suit the task at hand.
-Go to the Bin and double click the Boy_Computer clip to open the Source pop-up monitor. Click Play to preview it and notice the camera movement is jerky and not very smooth. Since our goal is to match this movement, setting the interpolation to Linear would best achieve this.
-Right click over the Scale and Offset Group track again and select Linear from the list.
When previewing the effect, it was apparent that Corners 1 and 4 had drifted slightly by the end of the sequence. If this happened to you, an additional keyframe is needed so those corners can be re-positioned.
-Hit End on your keyboard to bring the CTI to the last frame of the sequence.
-In the Effect Editor, right click over the Corner 1 Offset Y keyframe track and add a keyframe. Now go to the slider and change that value to: 6.1 (or whatever works best for you)
-While keeping the CTI parked on the last frame, repeat the above procedure to add a keyframe to the Corner 4 Offset Y track. Drag that parameter slider to pin the image to the corner. A value of 27.4 worked for me.
If any of the other corners need refining, simply scrub the CTI to the offending frame, add a keyframe, and make the necessary adjustments. I ended up using two keyframes through the clip to re-position corners to where they needed to be. You may require more or less keyframes, depending on how well your tracking did.
Integration Making it Look Like it Belongs There
A vital part of any compositing process is integration. These are the final touches that are added to a composite to make it look real and convincing. To make the SF_ Wharf clip appear like it is actually being screened inside the computer monitor (and not pasted on), we need to:
- Blur the Edges to match the edge softness of the computer. Finessing the Edge Width, Edge Softness and Edge Smoothness sliders will give you complete control of how your edge looks.
- Use BCCs Light Wrap - which is a handy feature that will enable you to blend the corner pinned image into the surface of the laptop screen.
How it works - Light and color values from the background image are reflected around the edges of the foreground image. This marrying of the two clips gives the impression they exist in the same environment. (BCC AVX4 also offers a standalone BCC Light Wrap filter which can be used when keying, on titles, etc.)
- Use BCC Colorize to color match to the computer screen.
- Add a BCC Z-Blur - to match the depth of field shift on the Boy_Computer clip.
Tip: When adding the final aesthetic touches to a composite, it helps to have a background image with a collective range of detail, colors and tones that will provide good visual cues to match to. In this case, the Fishermans Wharf sign at the end of the sequence is sufficient.
-Before continuing, make sure your CTI is on the last frame of the sequence.
Applying Edge Blur and Light Wrap
-Go to the bottom of the Timeline window and make sure your Video Quality is set to Full Quality. This makes it easier to see the intricate adjustments we are about to do.
-Scroll down in the Effect Editor, expand the Light Wrap group, and enter the Edge/Light Wrap values below. Or, enter your own values:
Notice how the Light Wrap effect makes it appear as if ambient light is reflecting on the corner pinned image, giving us the impression it IS the computer screen.
Once the edge settings are dialed in, they may cause the edges of the SF_Wharf clip to erode slightly. If this happens, you can compensate for that by re-adjusting the Edge With and Edge Softness sliders. Or, you can scale the image up a few pixels to fill the gap.
-If you prefer to scale the image, bring the CTI to the first frame of the sequence where we already have a keyframe waiting for us. (We applied this keyframe earlier when all the parameters in the group were keyframed)
-Select the first keyframe (which resembles a triangle) in the Scale X keyframe track to make it active.
We only need to adjust Scale X since Scale Y is locked to it.
-Increase the Scale X slider and notice the image scales up evenly. A value of 103.7
worked for me.
Once you are satisfied with the Light Wrap and edge softness applied to the SF_Wharf clip, we can move on to color.
The next step in making your composite more believable is to color correct the corner pinned image to match the original laptop computer screen - which appears a monotone blue in color.
-Go to the BCC Color and Blurs category in the Effect Palette and drag a BCC Colorize filter onto the SF_Wharf clip in V1.
After BCC Colorize is applied to the clip, its parameters should appear in the Effect Editor. This filter has the controls that will give us that tinted effect we are looking for.
-Hit End on your keyboard to go to the last frame of the sequence so the Fishermans Wharf sign is visible in the monitor.
-Scroll up in the Effect Editor and check Color 5 On to enable it. Uncheck the other colors as Color 5 is the only color we need.
-Our SF_Wharf image now appears more magenta than the laptop screen image, which is bluer in hue. The contrast doesn't match either.
-Scroll down in the Effect Editor and expand the Gradient HSL group to reveal the HSL (Hue, Saturation, Lightness) parameters. Adjust your Black Point, White Point, Squeeze, Hue and Lightness controls to match mine below:
Here is how your image should look after these adjustments:
Matching Depth of Field
Study the laptop computer closely and notice it is defocused due to a depth of field shift. Our corner pinned image is not defocused however, which we will correct right now.
We will be using BCC Z-Blur for this effect. Traditionally, this filter is used with an outside z-depth map which enables the image to be defocused across relative depths and distances from the camera. Since our corner pinned clip is on the same focal plane as the laptop computer, a depth map is not needed. But, it still needs to be defocused.
Tip: The BCC Z-Blur filter more closely resembles a natural camera defocus than a standard blur filter does. Whatever it takes to fool the eye, use it!
-Go to the BCC Color & Blurs category in the Effect Palette and alt-drag the BCC Z-Blur filter and drop it onto the SF_Wharf clip (V1) in the Timeline.
-If the Z-Blur parameters do not load into the Effect Editor, simply select the V1 track in the Timeline window to make it active and they will appear.
-In the Effect Editor, scroll down to the Depth of Field slider and reduce the value to: 12.20
-In the Timeline window, make the V2 track active again so we can see the finished composite.
The last step in a composite like this would be to match the video noise or grain to the original image. Since these clips are pretty clean, that wont be necessary.
-Render the sequence and you are done.
Feel free to ask questions about this tutorial in our Boris FX forum or Avid forum at Creativecow.net.
Click here for more information on the BCC AVX4 filters