We all know Photoshop is a powerful tool. In two tutorials, I'll take you through how to use Photoshop CS3's Lens Blur filter to do two things: today, we'll make images look like they were shot with a tilt-shift lens. Tomorrow, we'll create clipping masks for objects that aren't entirely in focus.
Lens Blur gives the effect of a narrower depth of field, so some areas of your image stay in focus, and other areas are blurred. Combined with an alpha channel that defines areas of blurriness, you have a powerful way to create masks and alter photos.
The easiest thing to do is show you first how Lens Blur works in pictures.
Let's set up a simple example.
First we can define, using a gradient, the areas we want to be perfectly sharp (white) and areas we want to be blurry (black).
We can define how blurry the blurriest parts of the image will get: I'll show you that in a second. When you use the Lens Blur tool with the image and the gradient, called a depth map, we see that the image becomes progressively blurrier from left to right.
Tilt-shift photography is a popular technique that uses a specially-constructed lens to create a very shallow depth of field. Recently, it's been used for what's called "miniature faking," an optical illusion as a result of using a tilt-shift lens that tricks your brain into thinking you're looking at a scale model of the scene, and not the scene itself.
Personally, it reminds me of the intro from Mr. Rogers' Neighborhood, if you were lucky enough to watch that show growing up.
Anyway, you'll notice the hallmark of the tilt-shift image is the very narrow band of things in focus. Everything else is blurred out, and the farther away from that band of focus you get, the blurrier the image is.
We can create this sort of look in Photoshop. First, open an image you want to apply the effect to. Landscapes work best, particularly aerial shots. I'll use a photo I took in Hawaii a few years ago:
So, in this image, we want to define an area in the middle of the image to keep in focus. For the purposes of this demonstration, everything I'm doing is in the RGB color mode. To change color modes, Choose Mode from the Image menu, and select RGB Color.
Select the Gradient tool.
In the toolbar, click the "Reflected Gradient" button:
Choose black for your foreground color, and white for your background color.
Make sure the gradient you're drawing is gradating from the foreground color to the background color.
In the Channels palette, create a new channel.
Click the channel visibility icon (
) next to the RGB channel (first in the list).
Now you can see your image (but tinted red), draw a gradient starting in the middle of the image (where the point of sharpest focus is) and drag about three quarters of the way to the top of the image.
Click the RGB channel in the Channels palette.
Martian! You've just created your depth map. That red band represents the narrow strip of focus we'll have in our finished image. We can make the channel you just created invisible now by clicking the visibility icon next to it. That should make the redness go away.
Before we apply the lens blur, let's make a copy of the image on its own layer, so we can do a little touching up later. Click the Layers palette, select the layer with your image on it, and type Command + J. That will create a copy of the image on its own layer.
Now, with that new layer selected, choose Blur from the Filter menu, then select Lens Blur.
This is the window that pops up:
For our depth map, the source should already be selected for us, Alpha 1 (or whatever you named the depth map channel we just created).
The Focal Distance controls how blurry the sharpest point in the image is. In this case, we'll want it to be zero -- meaning no blur is applied to that part of the image.
Next, we need to define how blurry the blurriest parts of the image get, and we do that with the Radius slider. Slide that over about halfway, and you'll start to see your fake miniature image take shape. If you want to fuss with the settings, you can choose a precise radius that gives the image the look you're after.
The settings for the other options on this panel I arrived at largely through experimentation. I prefer a hexagonal iris shape, a Blade Curvature of 12, a Rotation of 85, and the rest of the options left as their defaults.
You can "blow out" the brightness of lighter parts of your image with the Specular Highlights options. You can also add noise to the blurred areas of the image with the Noise options.
Also, if you draw your gradient the wrong direction (frequently guilty as charged, your honor), you don't have to redraw your depth map: just click the Invert checkbox.
Then, click OK. Once Photoshop is done processing your image (which may take a minute or two, depending on how fast your computer is, and the size of the image), we can make slight touch-ups to certain areas.
For example, in my image, the top of the dome is a little too blurry for my taste -- it should be in sharper focus. I can take the eraser tool with a fairly large, soft brush and take out parts of the layer we applied Lens Blur to and reveal the sharp layer below.
That's pretty much all there is to it! And it's a heck of a lot easier than buying or building a tilt-shift lens. You can see a large-sized finished version over on my Flickr page.
Tomorrow, we'll look at how to use the Lens Blur tool to clip out an object that's not entirely in focus. Until then, have fun!
The Indian Head test pattern came from NyQuil.org.