Using Photoshop to simulate narrow depth of field

STM

Senior Member
I got a PM last night from a fellow Nikonite in response to a comment I made about blurring the background on the following thread:

http://nikonites.com/photo-feedback/36518-how-can-i-improve-photo.html#post559067

I mentioned that since it was just a "quick and dirty" recommendation I just blurred the background in a couple of progressively blurred blocks instead of using layer masks. I was asked if I could give a quick tutorial on how to do it the "right" way using layer masks (actually alpha channels). It is not all that difficult a process (though it is a little time consuming), though it may seem like it the first time if you are unfamiliar with using masks, but if there is enough interest I can put something together and post it here. Here is an image I did just for this thread. It too is a little "quick and dirty". It is an image I pulled off the web because it seemed like an easy one to try. The process took me about 12 minutes or so, the longest probably doing a careful selection of the subject (which is very important).

Of course you should strive to get things right in the camera so you don't have to do a lot of PS work afterwards but it is always nice to know it is there. I know depth of field control is more difficult with crop sensor cameras because your focal lengths are shorter for the same magnification as FX. When doing outside portraiture, I always use either my 105mm f/1.8, 180mm f/2.8 or even my 300mm f/2.8 one stop down to get the shallowest DoF possible. This PS thing is not a perfect simulation of what shallow depth of field looks like using just aperture, but it is pretty close. As you can see in the image, it makes a HUGE improvement in the aesthetics of the image. No sharp horizon going through the middle of her head.

blur comparison.jpg
 
Last edited:

paul04

Senior Member
Good job,

another thing I've noticed, in the left picture, there is more than 1 thing to focus your eye on, like the sea, the sand, the lady and the horizon,

In the right picture, only 2 to focus on, the sand and the lady.
 

STM

Senior Member
Good job,

another thing I've noticed, in the left picture, there is more than 1 thing to focus your eye on, like the sea, the sand, the lady and the horizon,

In the right picture, only 2 to focus on, the sand and the lady.

This is why I always go for very shallow depth of field in portraiture. It focuses your eyes on the subject not the background. You don't necessarily want the background detail completely obliterated though, because then you can lose a sense of place. It is a balancing act. But again, try to get it as right as you can in the camera and use PS if necessary to tweak it.
 

BackdoorArts

Senior Member
One thing to think about with shots like this. What you have is not just an area you want to blur, you have an area that also has depth. True DoF blur would increase with that depth. In cases like this you want to blur for the farthest point and then apply a gradient to it so that it decreases more naturally to the point where it comes into focus again. This complicates the masking process but it can still be done in a single mask. After making your detailed selection save the selection for later use (right-click in the selected area and choose Save Selection) - you don't want to have to do that twice. Duplicate the layer, add the blur, apply the gradient mask, then reapply the saved selection area (it's in the Channels panel - just ctrl/cmd-click on it and then go back to the layers panel). After reapplying it, go back to the layers panel, click on the gradient mask, and then paint 100% black inside the selection to add the selection to the gradient mask.
 

STM

Senior Member
For those of you asked, this is how you do it. I have never used Adobe Elements so I don't know if you can do all of this with that program. Pretty much all of this is pretty basic stuff so I am guessing you can. I also use Window and not a Mac so any short cut keys may not work with the Mac.


1. Carefully select the subject you want to remain sharp. I use the polygonal select tool in PS and set the feather to either 0 or 1 pixel. Don’t do any more or your subject’s out line will look fuzzy and the whole thing will be a waste. This is probably the most critical part of the whole process as everything else is built on this first step. Success or failure of the process will depend on how carefully you isolate what you want to remain sharp.

2. Once you have carefully selected the image, hit “Q” to do a quick mask to see if this is what you want. Hitting “Q” again removes the mask

3. Although there is always more than one way to do pretty much anything in PS, using an Alpha Channel, though it is more work, will get rid fo the “halo” you will always get around a subject when you use and kind of blurring tool with PS (Box Blur, Gaussian Blur or in the case of what we are going to use, Lens Blur)

4. The first thing you will do after you make your selection, is to make your Alpha Channel and your “Depth Map”. If you have ever worked with layer masks before you know that anything that is black in the mask will be hidden and anything in the white will be revealed.

5. Make sure you have both the Layers and Channels Windows selected when you do this because you will be switching back and forth between them.

6. The next thing you are going to do is turn your selection black. So, under the Layers window go to the New Adjustment Layer Icon (that little icon that looks like a half black and half white circle) and choose “solid color”. Make sure your color is completely black.

7. The next step is to create another layer that will have a seamless graduation from sharp to blurry so go to the back to the New Adjustment Layer tool and click on gradient. This creates a second layer which will work with the first one to get your progressive blurring. Click on the graduated rectangle in the top of the gradient tool and make sure you click on the “Reset Gradient” and then click OK.

8. Click on the rectangle again and adjust the degree of graduation change. There are 4 little markers, similar to what you see in a word processing program to indicate tabs. Slide the little white one on the bottom right to the left to adjust the graduation. Remember that white will be to slide it, however you can go back in mid process and readjust if necessary. Press OK to get out of that and OK once again to get out of the Gradient box.

9. Next you want to group these two layers you just made. You can “ungroup” them if you want to go back and adjust the gradient. Click on the gradient layer and move it down below the black outline of the subject layer. Now hold down the shift key, select both and then hit Ctrl G to group them together.

10. Now you have to go to the Channels Panel. You will see 4 boxes, RGB, and Red, Green and Blue. Choose any of the three colors, it really doesn’t make any difference, and duplicate it by dragging it down to the Duplicate Channel Icon. Double click on this duplicate channel and rename it. You can choose anything you want but I just rename it Depth Map. This will come in handy for finding it once you start to blur the background. Go back and click on the RGB box at the top,

11. Go back to the Layers panel and disable the Group you made (click on the little eye to disable it). Now since blurring is destructive to the image, make another layer. Click on the layer marked “Background” and hit CTRL J to make another layer.
This is the one you will be blurring. If you goof it up, you can always just delete the layer and make a new one and start again.

12. With the duplicate layer selected, go to Filter, Blur, Lens Blur. I normally select “None” is the depth map box before I start and when I like the amount of blur, I go to the name of the channel I created. It is entirely up to you how much you want to blur the image. Again, the more you do it the more you will get a feel for it. It is very important you have “Preview” checked so you can see what your results will look like. This is an easy step to forget but you will soon realize you did it when you don’t see any changes!

13. Next the Depth Map rectangle (about a quarter down the box) and select your Alpha Channel (the one I named Depth Map). Now you will be able to see what your image will look like. Play with the sliders there to achieve the look you want. Radius increases or decreases the blur. The rest; shape, blade curvature, etc, don’t seem to have much noticeable effect. One that does have some effect is the Specular Highlights one. You can play with this one to achieve a smoother bokeh, but the effect is subtle from all the way left to all the way right. I prefer to use the blur tool once I am done to soften harsher specular highlights. Lastly is noise. For those of you who longer shoot and scan film this may not have any use, but if you do shoot an indoor at a higher ISO, you may see some noise. The blurring will eradicate any noise so it will look out of place if you leave it like that. You can put some noise back in to match what you lost.

14. You can clean up any other areas with the Blur Tool if you need to.

That is pretty much it. Practice it several times and once you become comfortable you can play around some with some of the settings to customize things to better suit your tastes. If you have any questions or get stuck, drop me a line. Once you practice it a few times it is pretty easy. Again, the most important part of this whole thing is getting your selection right. If you do not do a good job on that, nothing else you do can fix it.
 

Blade Canyon

Senior Member
Your first example looks great. That last post seems like a lot of work, but I will try it tonight. Usually I just create a duplicate layer and apply lens blur to that layer. Then create a layer mask on that layer and paint in the parts I want in focus. Using gradients (on the mask, not the image), you can get a very natural front to back (or radial) fall off in focus.
 

Blade Canyon

Senior Member
Really quick and dirty, only one duplicate layer with a mask, gradient, and touching up with a brush. I was trying to create more of the "depth" that Backdoor Hippie was talking about, but my gradient was gradual enough....

blur comparison2.jpg
 

STM

Senior Member
Your first example looks great. That last post seems like a lot of work, but I will try it tonight. Usually I just create a duplicate layer and apply lens blur to that layer. Then create a layer mask on that layer and paint in the parts I want in focus. Using gradients (on the mask, not the image), you can get a very natural front to back (or radial) fall off in focus.

You can go that way certainly but here is the problem you will run into if you use a lot of blur. When you just make a duplicate layer and blur it, be it with the standard blur, or box blur or Gaussian blur, it blurs EVERYTHING. If you do a lot of blurring you will get a 'halo" around the subject. By using a channel mask, everything that is black will not be blurred. That way there is no cleanup. It sounds like a lot of work but if it takes you 10 minutes to do, 8 of it should be spent on your selection, the other 2 minutes are all you need to do all of the masks and gradients. The more you do, the faster you get but the one step you should not rush is your selection. If you are sloppy with that, everything else you do from that point on will be a waste of time.

Below is an image I took several years ago. The image on the left is the minimally reworked RAW file, mostly just cropping. I used my 105mm f/1.8 Nikkor with an 8X ND filter so I could be at f/4 and still keep my shutter speed at 1/200 sec which is the max synch speed for wireless remotes. In hindsight I should have used my 180mm f/2.8 or even my 300mm f/2.8 @ f/4 because the depth of field is WAY too deep for my tastes. Using the technique above, it took me less than 10 minutes to do this and most of it was the selection. She has some flyaway hair and you have to be careful with your selection if you want to preserve it. You can adjust both bottom sliders on the gradient to give you just the right balance of sharp versus blur. The difference is pretty significant and much more aesthetically pleasing, to me at least. Outdoor portraiture with sharp backgrounds is just a pet peeve of mine. I wish I had a dollar for every good location portrait that was ruined by a sharp and distracting background and it is just not limited to hobbyists or amateurs either, I have seen professionals do it too, which is an unforgiveable sin!

I always do all the work on the image before I do the blur. In this case I removed the shadow on her left thigh made by the fill flash before I did the selection work

Christina blur comp.jpg
 
Last edited:
Top