Monday, July 06, 2009

Faking Depth of Field



You can use image editing software to fake depth of field effects. Just select your foreground image, invert the selection and apply gaussian blur. I may have gone too far with the blur, though.

7 comments:

  1. Totally cool and a great use of gaussian blur, one of the few filters in Photoshop that has much use.

    Without depth of field, Earl in his black suit would almost hopelessly blend in with the background. In images, you should strive to set up definitive background, midground and foreground information. Another way to break Black Suit Earl from the background would be a rim light (a powerful light offstage behind and to the side of Earl), but that's harder to do in Photoshop.

    Feathering your selection will make gaussian blur look even more natural. It also ensures that you don't have to be precise with your selection. You can fine tune your selection with an alpha channel, and even use it to make a variable gaussian blur, like a blur gradient (normally, gaussiam blur is applied equally throughout the selected area).

    I think the amount of blur you chose is fine. However, you can get into the habit of "bracketing". You need the original un-blurred image. Then you filter it to your liking (blur in this case). Save a copy, then undo the blur, and redo it but use less than you think you should need. Save that, and then blur it more than you think you need.

    Look at the three images. You've "bracketed" the middle image with a high and low value image each. Compare and contrast to see which one you like best. Don't forget to turn the images upside down to get a stronger impression of which one is working the best.

    Another neat trick is to make a duplicate of the image layer. Apply gaussian blur very heavily on the duplicate layer, which will sit on top of the original layer. Then reduce the opacity of the duplicate layer. You get a "vaseline" effect like they used to do when they smeared goo on the camera lens to make stuff look soft-focussed. Play with the gamma a little bit to brighten up the image.

    ReplyDelete
  2. The previous comment makes the comment I am about to make seem a little simple, but I will say it anyways.

    Oooh, look! Earl is holding a picture of Beef Ball Moo!

    ReplyDelete
  3. Beef Ball Moo coerced Earl into posing for the picture, more likely.

    ReplyDelete
  4. I did that effect some years ago with this image that was originally drowning in detail.

    http://www.flickr.com/photos/allanx/228957361/sizes/o/

    It was a pain because of the complicated selection (needed because of high resolution), but it was a nightmare because of something else.

    Mixing blurs and selections is a pain because blurs virtually always exceed the selection boundaries and end up looking unnatural. Intuition says to feather select the foreground, copy and paste it so it's now a layer floating above the background, then blur the background (lower) layer. But this doesn't work because the pixels of the foreground element are still in the background and get blurred. You end up with an unnatural halo around your foreground element. To fix this I cut the foreground pixels right out of the background then painted in similar colored pixels into the edges of the hole so they'd blur without halos, carefully protecting the actual background with an antialiased mask.

    At one point I considered doing a third depth of field layer for the iron fence. Thankfully I regained my sanity in time.

    The whole thing was a huge pain in the ass and I probably spent more time on this one image than any in recent memory. Still not sure it was worth it.

    ReplyDelete
  5. P.S. You can see the halo I'm talking about around the Beefball Moo card, where there's a lot of contrast. In this case it would be easy to paint the halo out, but it's nearly impossible if the halo is intruding on background detail.

    Oh, you can see even with all that work I still wasn't entirely successful. You can see halo around Mickey's right thumb. Light halo is better than dark halo, though, because bright light naturally halos somewhat. Darkness doesn't.

    ReplyDelete
  6. It helps to use all 256 shades of grey in the alpha channel! That way you can set up variable rates of blur without resorting to breaking your image up into layers. It's fairly painstaking, but it's an operation that takes minutes rather than hours. Once you have your initial selection, copy it to the alpha channel, then make a copy of the copy to work on with the greyscale.

    ReplyDelete
  7. Thanks very much for the tips, guys! And Allan, I know I've said it before, but your photographs are astounding.

    ReplyDelete