Depth Maps for Lens Blur Filter in PhotoShop CS
It began in the POTN G-Series Speed Challenge #32: Point – Counterpointhosted by Bryan Bedell.
To better fulfil the challenge requirements, I used PhotoShop CS to create the depth of field in my photo, shot with the Pro1.
In the contest thread I briefly described the method used to create it using the Lens Blur Filter and a Depth Map reference built on an Alpha Channel. Below are the links to the original image (resized), the alpha channel and the final image after applying The Lens Blur Filter:
After the kind comments written by Bryan Bedell, BottomBracket, MegaTrixel and abat, I decided to post here a step by step description of the method that I used there, but using a photo that allows a clear description.
Earlier, in the hobby contest, abat posted upon my request an extra image of his beautiful scale model of the HM Bark Endeavour, this post is in retribution to his deference.
I am not pretending that the method described below is all mine, neither that it is the best nor the easiest, just that I enjoyed creating the effect this way and it yielded an interesting result.
I recreated for the Depth Map the procedures used by some 3D modeling and rendering programs to calculate what they call Z-Depth Channel. The main difference is that the 3D programs automatically calculate the Z-Depth Channel upon request and here the user must use subjective criteria to manually build the Depth Map. The results are rewarding, though.
This tutorial will allow you to apply the Lens Blur Filter of PhotoShop CS over a sample image using a Depth Map image provided.
I will focus mainly on how to create the Depth Maps and put them in Alpha Channels for their use with the Lens Blur Filter.
Following this step by step example you will learn the basic principle to apply it to your own pictures.
There are a lot of things about PhotoShop CS that I ignore. If you know a better procedure to perform a given task, feel free of use it instead of mine.
If you already know how to work with PhotoShop CS, go fast over the steps, if you are really new to it consult the program help for details not described here.
THE SAMPLE IMAGES
IMAGE LINK: http://sites.google.com …onthenet/tut1/sample1.jpg IMAGE LINK: http://sites.google.com …ut1/lineargradient_s1.jpg IMAGE LINK: http://sites.google.com …tut1/depthmapsharp_s1.jpg IMAGE LINK: http://sites.google.com …/tut1/depthmapsoft_s1.jpg IMAGE LINK: http://sites.google.com …enet/tut1/LensBlur_s1.jpg
Save the images to your hard disk using save target as…
An alternate method: click the thumbnails and save the full size 510x800 images from your browser. The five files will use less than 230KB of your hard disk.
To preview the depth of field created with Lens Blur in the sample image, click the LensBlur_s1.jpg thumbnail.
THE DEPTH MAP
The Depth Map is a gray scale representation of the distances from the camera to the objects that are part of the image.
The closest object represented will be black, the farthest, white and all the other objects in between will be assigned different shades of gray.
First, analyze the image to isolate the objects.
For this example I defined five objects:
1. The cleaning machine and its driver.
2. The crowd in front of the top right building.
3. The top right building, the people crossing the street and the bus, because all of them are at the same distance from the camera.
4. The far buildings at the top left.
5. The tiled floor and the street.
The objects 1 to 4 may be accurately represented by flat silhouettes painted with a solid shade of gray.
The fifth object, the floor, changes its distance continuously. It will be represented more accurately by a linear gradient that is black at the bottom and white at the top of the photography. You may search in the PhotoShop CS help for ‘Applying a gradient fill’ and read how to create a linear gradient.
I usually begin with the linear gradient in a new layer and then paint the objects’ silhouettes over it from far to near. Using that order, you do not need to draw an accurate mask for the hidden parts of the overlapping objects.
The best method to determine the shade of gray for each silhouette is to use the Eyedropper Tool to pick the color from the linear gradient at the base of the silhouette.
TIP: To create your own Depth Maps, work on a copy of the original image in a different layer.
When the mask to isolate an object is ready, select the layer with the linear gradient and use the menu edit>cut before painting with the Paint Bucket Tool.
NOTE: To further improve the Depth of Field simulation, I included in the lower left of the Depth Map the six foremost green posts.
The problem without the posts mapped is that the base of each post is sharper than its top creating a weird effect. In the remaining post the effect is almost unnoticeable.
BUILD THE SAMPLE ENVIRONMENT
Load the images provided as layers of the same image in PhotoShop CS:
1. Open sample1.jpg in PhotoShop CS
2. Open lineargradient_s1.jpg
3. Use the menu Select>All
4. Use the menu Edit>copy
5. Close lineargradient_s1.jpg
6. Use the menu Edit>Paste
7. Repeat steps 2 to 6 with depthmapsharp_s1.jpg
8. Repeat steps 2 to 6 with depthmapsoft_s1.jpg
At this point you have an image with background and three layers.
The layers 1 and 2 are for your reference or to reproduce the individual masks and create quickly your own Depth Map from scratch. The layer 3 has the finished Depth Map, including the application of a Gaussian Blur (radius 0.3) to lightly soften the borders of the silhouettes.
Now, you will copy the finished Depth Map to a new Alpha Channel:
1. Use the menu Windows>Layers to open the layers palette
2. Select layer 1 in the layers palette
3. Use the menu Select>All
4. Use the menu Edit>Copy
5. Click the channels tab
6. Click the third icon (next to the trash can) in the bottom of the channels palette to create a new Alpha channel.
7. Use the menu Edit>paste.
8. click the layers tab
9. Repeat steps 2 to 8 with layer 2
10. Repeat steps 2 to 8 with layer 3
You can delete layers 1 2 and 3 after creating the Alpha Channels.
USE THE LENS BLUR FILTER
Now you are ready to use the Lens Blur Filter.
Duplicate the background with the sample image and select it in the layers palette.
Be sure that the selected layer is visible and unlocked.
Hide all the layers above the selected layer in the layers palette.
Use the menu Filters>Blur>Lens Blur…
The lens Blur dialog pops up.
Preset the Lens Blur controls as follows:
Preview check box, checked
Faster Radio Button, selected
Depth Map Source dropdown list, select the desired alpha channel (Alpha 3 has the finished Depth Map)
Blur Focal Distance Slider, will be set later
Iris Shape, Hexagon (6)
Iris Radius, 12
Iris Blade curve, 20
Iris Rotation, 60
Specular Highlights Brightness, 0
Specular Highlights Threshold, 0
Noise Amount, 5
Monochrome check box, checked
Now you can play with the Blur Focal Distance Slider, with the Iris Radius and with the different Depth Maps available (Alpha1 Alpha2 and Alpha3).
Compare the results in the preview window with different settings.
When you are done, change preview to More Accurate, confirm the effect and click the OK button.
TIP: Instead of changing the distance slider, you can click inside the preview image to get the clicked spot in sharp focus.
I worked out the Depth Map to make the cleaning machine and its driver the main subject. Click over them to achieve the intended effect.
I hope this will help you to enhance the use of Depth Maps.
If you find something that is wrong or not clear, please let me now.
ABOUT THE SAMPLE IMAGE
I left the sample image out of a series of Street Candids because it is not the best example of the Pro1 capabilities, but it has just five big elements on it and the correct perspective for the tutorial.