Hello, sailors, and welcome to New York! These guys, probably shot in the 1930s, are going to help us learn how to bring static 2D images into an animated 3D space with Photoshop and After Effects. It's a useful and effective technique that can really help liven up the presentation of all kinds of still images in video and film. We're going to begin by pre-processing an image in Photoshop so we can work with it in 3D space in After Effects, then create a simple camera animation to show off the effect.
There will be quite a few steps in the first of this two-part tutorial, so let's get started.
This 2D/3D technique works best with images that have a strong foreground element or elements against a simpler midground and background elements. I found this old public-domain photo online of sailors coming into New York harbor that I'm going to work with:
You'll notice that the sailors are well in focus in the foreground and strongly outlined, for the most part, against the midground water and background cityscape. You can use whatever image you like, of course, but bear these conditions in mind. You'll also want to work with an image that's as high-resolution as possible - mine is 1000 x 1400 pixels. Throughout this tutorial, I'm going to work with this image and assume you have a similar image of your own.
Our next step is to make a selection of our sailors and cut them out from the background. To create this effect in After Effects, we're going to need to separate the foreground, midground, and background elements from each other and put each one on its own layer in Photoshop. Then, in After Effects, each layer is going to placed on its own plane in separate positions in 3D space, so that when we animate our camera, parallax will create the illusion of depth.
Parallax is essentially how we are able to perceive the relative distances of objects. Because we have two eyes, we see two slightly different images, from two slightly different angles, of objects in our field of vision. The relative viewing angle, or parallax, of objects close to our eyes is greater than for distant objects, and our brains use that information to determine whether objects are closer or further away. What's more, when our eyes are moving, objects in the foreground appear to move a greater distance relative to objects in the background, even when all the objects are stationary. That's the phenomenon we'll simulate in After Effects, once we've set our layers up correctly.
But first we need to set up the layers. So, select your image in the layers palette and duplicate that layer - I'm calling the duplicated layer "Sailors". Then duplicate the layer twice more, once each for midground and foreground layers, call them "Water" and "City", respectively, and turn off the visibility for all but the Sailors layer:
Now we need to outline these sailors to create a selection of just the sailors. There are a few approaches to this, but you'll probably need to use several different selection tools to outline the sailors.
Start with the Magic Wand, set to a fairly low tolerance, and begin by clicking in the black area of the sailor's uniforms:
Then add to that selection by holding down Shift and continuing to click on the sailors. In cases where the selection runs into the water, hit Undo and try somewhere else. When you can't successfully select any more of just the sailors, switch to the Rectangular Marquee tool and select larger areas within the sailors pixels. Whenever you select too much, either Undo or switch to holding down the Option key while dragging around the excess selection - Option-selecting with any selection tool removes pixels from the existing selection.
Remember to hold down Shift while dragging so you add to the current selection rather than replace it. Finally, when you get to the point where you have to carefully trace the edges of the sailor's hats, switch to the Lasso tool and, zooming in on the image as needed, Shift- or Option-drag with that to finalize the sailor selection:
When you have just the sailors outlined, save the selection by choosing Select > Save Selection... and setting the Save Selection options as shown here:
If you look in the Channels palette, you'll see your selection as an alpha channel:
We've now successfully isolated the sailors from their background. Next we need to do the same for the water and skyline.
Now it may seem at first that we have to tediously trace the sailors again to isolate the water from them, but since we've already done that once, we don't need to again. Start by turning off the visibility for the Sailors layer and turning on the Water layer. Then choose Select > Load Selection... and set it up as shown below:
By inverting the Sailors Selection when we choose it, we'll be selecting everything in the Water layer that isn't the sailors, thereby saving us the trouble of tracing them again. Next, grab the Marquee tool and Option-drag it over the city, from all the way at the top of the image to just above the waterline. Finally, Option-drag with the Lasso to refine the water selection:
As with the Sailor Selection, choose Select > Save Selection and save the water selection as "Water Selection". (You should save your image as a Photoshop file at this point, by the way, if you haven't already, to preserve these selections. Make sure to enable Save Alpha Channels and Save Layers when you do.)
Next, as you might guess, we need to select the city part of the image. Turn off the visibility for the Water Layer and turn on the City layer. Load the inverted Water Selection into the City layer to select everything except the water, then load the Sailors Selection, but use these settings:
By choosing Subtract From Selection, we'll remove the Sailor selection from the existing inverted Water selection, leaving just the City selected - no tracing required. As before, save the remaining selection as "City Selection".
Next, turn off the visibility for all three non-Background layers, turn on the Sailors layer, select it, and load the inverted Sailors Selection (Select > Load Selection...) Hit Delete to remove everything except the sailors from the Sailors layer and create a transparent background:
Do the same for the Water:
and City layers:
making sure in each case to select the layer before loading its selection, to make New Selection, and to Invert the selection. You now have each major element in the image - foreground, midground, and background - isolated on its own layer.