Get a free year on Tuts+ this month when you purchase a Siteground hosting plan from $3.95/mo
Wikipedia describes parallax as: "an apparent displacement or difference of orientation of an object viewed along two different lines of sight, and is measured by the angle or semi-angle of inclination between those two lines." What this means to After Effects users is that real camera moves have parallax and in this basix tutorial we learn how to recreate this effect in After Effects using a single still photograph.
The effect that we will be creating in After Effects is called a parallax. The basic idea behind a parallax is that 3 dimensional elements appear to move differently depending on their position relative to the observer. (Image driving in a car, objects closer to you move faster than those that are far away). We will take a sample image (seen below), and turn it into a pseudo-3D scene using After Effects. As you see in the sample video, this gives us the impression that elements in the foreground are moving separately from those in the background. This effect is often used in documentary films when they do not have film of an event, but only still-frames. Using the effect makes the image more interesting, and makes it seems like someone was there with a video camera and was panning back and forth.
1. Choosing an Image
Choosing an appropriate image is an important part of how the overall effect will look when done. As you see from the image above, we have several distinct 'layers' available to us. We have the wreath, the memorial, the big tree on the left, the large stand of trees on the left, the trees in the background on the right, and the background (skyline). Its generally harder to do this effect with an image that has things clearly linking the foreground and background. This could be a bridge, road, or power lines. The reason this won't work is that when we separate each individual layer and put them in 3D space, the individual elements are stuck in whatever perspective they are in the photo. So, the bridge would always looks the same, and not look 3D. You want to keep lines that go between the fore- and backgrounds as short as possible, such as the tomb and the road.
2. Edit the image
Open your image in photoshop and duplicate your base layer 6 times so we end up with 7 copies of the image. Name them Wreath, Tomb, Big Tree, Grass, TreesL, TreesR, and BG from top to bottom. Hide all the layers but Wreath. Add a layer mask to the Wreath layer, and trace the shape of the wreath using a combination of the pen tool and paintbrush. Make that mask so that only the wreath and stand are visible. Finally, with the layer mask selected, go to Filter > Blur > Gaussian Blur, and apply a 1px blur. This will make the edge less pronounced.
3. The Tomb Layer
As you have probably noticed, the tomb layer will be a little trickier because parts of the wreath cover up the corner of the tomb. Additionally, the wreath stand is on top of the marble steps. We will correct for this using the clone stamp tool. First, add a layer mask, and trace the outline of the tomb. We will also include the top step as part of that layer. Like we did with the wreath, apply a 1px Gaussian blur on the mask.
Now, lets whip out the clone stamp tool and cover up the remnants of the wreath. We want to get rid of the wreath on the tomb, as well as the stand (and shadow) from the step. Since this is not a photo shop tutorial, I'll gloss over the majority of this. When working with the clone stamp tool, you want to use a fairly small (15-20px), soft (50%) brush.You want your sample area to be a reasonable distance from the area you are drawing over, this helps prevent patterns from forming (which makes it obvious you've cloned). When trying to clone a straight line (such as the border between blocks on the steps), alt+click on a visible section of the line, then move your mouse in as straight a line as possible in whatever direction you want to clone. Otherwise you will end up with a wavy border. Once everything is cloned, you should end up looking like this:
The quality of your cloning here will determine how much you can move your final scene when you get into After Effects. While things don't need to be perfect, it needs to be good enough to stand up to the casual observer. Also, depending on what directions you want to pan your photo in, you may be able to get away with doing less cloning if a particular area of the image will never be visible.
4. Trees and BG
We will apply the same sort of treatment to the remaining 5 layers. The general principle we want to follow is to add a mask to define what is visible in every layer, and use the clone stamp to erase the traces of the layers above the current layer (like we erased the wreath from the tomb). You will also want to apply the 1px Gaussian blur to the mask of each layer. The following images show the end result of each layer:
Parts of the road and the last flower bed will need to be cloned, and the wreath will need to be erased.
Clone over the tomb.
Clone the buildings and trees near the top center to give us some freedom of movement. Tomb doesn't need to be completely covered.
For the tree layers, it is OK to leave some of the sky color intact, we will use AE to get rid of it. Save your psd, and close photoshop.
5. After Effects Comp Setup
Open AE, create a new project called Parallax, and create a new composition with these settings:
6. Import Assets
Go to File > Import > File... and select your psd file you created. Use the following import options:
You should end up with another comp, as well as a folder containing the layers from the psd as follows:
Go ahead and delete the composition that was created during the import, as well as any extra layers from the psd that aren't needed.
7. Add the PSD Assets to Our Comp.
Make sure that your Parallax comp is open. In the project pane, select all the layers from the psd folder, and drag them into the Parallax timeline.
8. Reorder Layers
You might have noticed that things don't quite look right. That is because After Effects imports the psd layers in alphabetical order, not in the order from the psd. So lets drag the layers to get them in the correct order. While we are at it, lets also select the 3D box next to each layer so we have 3D layers. One that is done, you'll see that everything looks pretty normal again.
9. Create a Camera
Go to Layer > New > Camera... and use the 35mm preset. The camera will allow us to actually move around the scene as if it were 3D. Here is what we should have now:
10. Set Up Our Viewport
Use the viewport select dropdown to select '2 Views - Horizontal'. Then set one view to 'Left', and the other to 'Active Camera'. (To do this, click on the appropriate viewport, and then use the view dropdown). Using the multiple viewports will allow us to see how the overall comp looks while we are adjusting the layers.
11. Camera Settings
Lets go ahead and set up our camera. Twirl down the property arrow next to the camera, and go into the Transform settings. Set the point of interest and position values as they are below. Your active camera viewport should look like the second image.
12. Distribute the Foreground Layers in 3D Space
For each layer, we will alter the position and scale. Once you select a layer, you can press 'p' to bring up the position attributes, and 's' to bring up the scale attributes.
By changing the Z-position and scale of each layer, we change the position and perspective of the layer in relation to the camera, which will alloq us to pan through the scene later. Note that we don't change the scale of the tomb layer.
As you can see in your viewport, each change we make to the properties of the layers changes how the scene renders. Sometimes we end up with empty black spots that we need to correct for. For instance the one below is because we haven't resized the background layers yet.
13. The Background Layers
The background layers are the three tree layers. Here are the properties for these layers.
Everything should now look pretty much like our source image.
Then, change the viewport selector back to '1 View', so we have just the Active Camera view.
14. Clean Up the Tree Layers
Everything looks pretty good in our comp so far, except for the edges of the tree layers, where there is some blue left over from our cropping. With each of the tree layers (Big Tree, TreesL, and TreesR), do the following:
Select the layer, and go to Effect > Keying > Color Key. Use the eyedropper tool next to 'Key Color' to select the color of the sky in thr BG. Then adjust the values of the tolerance and edge feather properties until the edge of the treeline disappears. I used a tolerance of 132, and a feather of 3.2.
Once you do that with the three layers you should end up with less obvious layer borders between the trees. There is one more thing we want to do in order to clean up the edges of the trees. We will add a mask to the TreesL layer. Go ahead and select the layer, and then select the pen tool to draw the mask. Make a shape similar to the one below, then go into the mask settings for the layer and adjust them as follows:
15. Animate the Camera
Now we will take care of animating the camera movement. Go back to the beginning of the comp if you have moved somewhere else in the timeline. Select the camera layer, and press 'u' twice to bring up the edited attributes. For now we will focus on animating the point of interest and position. Use the settings from the image below, and your viewport should look like the second image.
Then press the stopwatch next to Point of Interest and Position so we can animate these attributes. Move the time scrubber to around 4 seconds. Change the camera properties to match the image below:
Then, lets select the four keyframes for the camera, and press F9 to set them to easy-ease, so our motion is less jerky.
16. Layer Clean Up
We are almost done with our comp, but if you go to around 2:13, you'll notice a problem: we end up with some black spots where the layers aren't lining up right.
In order to fix this, lets change the Z-position for the Grass layer to -123. When you are doing this with your own photo, you want to make sure to occasionally scrub through the timeline to see if there is any tearing like this. Oftentimes it takes some trial and error to get the positioning exactly right. You can either move the layer around in space, or play with the scale to fill in the gaps.
17. Finishing Touches: Camera
Ok, so we're going to spruce up our footage a little bit by adding a cool effect to the camera called Depth of Field. If you look at our comp right now, everything is in focus as if it were the same distance from the camera. What depth of field does is allow you to focus the camera at a particular distance from the lens, making items outside that range out of focus. It gives a more realistic appearance to the footage.
So let's go to the camera layer, and twirl down the Camera Options panel. We want to enable 'Depth of Field', and set the focus distance to 1000px, which sets our camera to focus on the background. By setting the aperture size we are essentially determining the range of distances that will be in focus. The higher the number is, the more out of focus elements not at the focal distance will appear. For instance is you set the aperture to a low number, the foreground still appears in focus, while if you make it higher, the foreground will get progressively more out of focus.
Now go ahead and press the stopwatch next to the focus distance parameter so we can animate it. Now move the timeline scrubber out to the 4 second mark where our animation ends. Set the focus distance to 600. You should notice that the memorial and the wreathe should now be in focus, while the background is blurry.
NOTE: If you are going to be doing more work on your composition after this point, you may want to temporarily disable the depth of field effect, as it will take longer to render the viewport with it on.
18. Finishing Touches: Vignette
We are going to add a vignette over top of our image to give a little emphasis to the center of the film. Create a new solid at the top of your layer stack by going to Layer > New > Solid... Use the following settings:
Using the Ellipse Tool, draw a large ellipse that covers most of the center of the image.
Then, select the Vignette layer, and press the 'm' key to show the mask options and set them as such:
Which leaves us with this:
Now we could stop here if we wanted to stay with a color photo. As I said at the beginning of the tutorial, this technique is useful for documentary films where you don't have video footage. So what if you want to add a little bit of an antique feel to your footage?
19. Optional Sepia Tone
Go to Layer > New > Adjustment Layer... Drag the new layer below your camera layer. Then, go to Effect > Color Correction > Hue and Saturation. Check the Colorize box, and set the Hue to 44. Then, go to Effect > Blur & Sharpen > Fast Blur, and give it a blurriness of .2. Lastly, go to Effect > Color Correction > Curves. Give it a slight boost to give a little bit of contrast as shown in the image below.
Which will give us our final product:
I hope you've enjoyed this tutorial, and I hope you have a little better understanding of using 3D layers and cameras to move around in a 3D scene. This technique is very useful for adding emphasis and interest to an otherwise boring photo. In addition to a left and right pan, you can use this effect while zooming in and out, and panning up and down. Try this the next time you have to create an image slideshow, people are sure to notice!