Creating a shallow depth of field effect in SL

One of my 2010 goals is to become a better SecondLife (SL) photographer particularly to create my own modeling photos. Most often that means keeping the focus on the model as oppose to the background. There are a lot of ways of doing that, but a common one used in RL photography is to use a shallow depth of field. That’s a photography term that describes the effect of having the background out of focus. Unfortunately, if you take a photo of a scene in SL, it is always with a deep depth of field where the background and foreground are equally in focus.

I’ve been spending a lot of time learning how to use Photoshop. I recently found a way to create a picture based on second life that can produce a shallow depth of field effect fairly easily. This works best if you do not put the model in the original picture but instead create the backdrop that you want, import it into your photo studio then photograph the model in the studio with the backdrop that you created. Here’s how I created the shallow depth of field backdrop. (This works on Windows. I’m not sure what the equivalent commands are on a Mac)

1) Take the picture of the scene you want for your backdrop.

2) Import the picture into your photo editor. In both Photoshop and GIMP it will become the background layer. This is what my original picture looked like. Notice both near and far parts of the scene are equally in focus.

3) Immediately make a duplicate layer from the background layer. In both GIMP and Photoshop, you do that by right clicking on the background layer in the layers panel and selecting “Duplicate Layer” from the drop down menu. The new layer will be placed above the original background layer by default.

4) Next apply a blur filter to that new layer.  In GIMP, your best option is Filters -> Blur -> Gaussian Blur from the top menu.   In Photoshop, I like Filter-> Blur -> Lens Blur better. In both cases you’ll have to experiment with the settings. (To undo what you just did, press Ctrl-Z.) The duplicate layer will now appear totally blurred.  You can also add more blur to the layer later if you want.

To make the distant parts of the picture out of focus, we want to allow the blur to show through for the distant parts, but then block it totally or partially from showing as we approach the near parts of the picture. We do this by applying a gradient to a mask in the duplicate layer.

A quick aside about masks. A mask is something you apply to a given layer to hide parts of that layer. What shows as white on the mask allows that part of the layer to show completely. What shows as black on the mask completely blocks that part of the layer from showing. If you were to apply a mask to a single layer, what is black on the mask will show as transparent on the layer. Grey parts of the mask allow those parts of the layer to partially show through.

4) Add a mask to the duplicate layer. You do that in GIMP by right clicking on the duplicate layer and selecting “Add Layer Mask”. Select white as the default color for the mask. In Photoshop, while the duplicate layer is active, you click on the little icon with the white dot at the bottom of the layers panel. In both cases a new white rectangular icon representing the mask appears to the right of the icon representing the layer.

5) Open the mask. In GIMP you right click on the mask icon and select “Edit Layer Mask”. You won’t see anything different but anything you do will be applied to the mask and not the layer itself. In Photoshop, you alt – click on the mask icon. The white mask shows on the main screen. It should be totally white at this point.

6) Activate the gradient tool from your tool box. (In GIMP, it’s called the Blend tool). Make sure the active foreground painting color is black and the background color is white. You will want to use a linear gradient, painting from foreground color to background color.

7) With the gradient (blend) tool active click on the bottom of the mask and drag up toward the top. While you drag, a line will appear. Try to keep it as vertical as possible. When you let go of the mouse, the mask should be black at the bottom and gradually move to white at the top. It should look like this in photoshop. In GIMP you will see the same thing in the mask icon.

8) Unselect the mask. In GIMP, right click on the mask icon again and uncheck the “Edit Layer Mask” option. In Photoshop, simply click on the icon representing the layer. You will immediately see the effect of having applied the mask to the blurred layer. The white top of the layer mask allows the blur effect to show, while the bottom black part of the mask blocks the blur and makes that part of the layer transparent, revealing the layer below. If you were to unselect the background (bottom most) layer and just looked at the blurred layer you would see it gradually become more transparent top to bottom, like this.  You see it gradually merge into the background layer of this post.

With the background layer re-enabled, it will show up where the blurred layer is transparent. The final results should look like this.  If the distance is not blurred enough for you, add more blur to the blur layer.

9) Save the result as a PNG file, upload it into SecondLife and use it as the backdrop for your photo.

Incidentally, you could have done all this with the model in the original picture. To keep her/him in focus, you would have to select the model (not an easy thing to do) and paint the selection black on the mask to block out the blur effect in the blur layer. I find it easier to make your background and put in the model later.


~ by monicabalut on February 15, 2010.

One Response to “Creating a shallow depth of field effect in SL”

  1. Hey Monica,

    Fabulous explanation of this. I’d also like to pass on a little trick I have learned that goes hand in hand with this. Most people wouldn’t notice the details but for others everything is in the details.

    A good thing to do when taking your original picture is to take note of the direction you are facing and your current windlight settings. You’ll eventually end up with a spiral notebook with scribbles all over it containing this information but it makes the lighting match up so much better when you do this.

    Small detail but for me it’s an important one. 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: