Stack Your Focus

By Roger (30 Jan 2014)

While I have Mark's light tent set up, let's talk about making some close-up, or macro, photographs.

Just so you know, the technical definition of macro photography is one in which the size of the subject on the sensor is life size or greater. Most people today use the term to mean any photograph at a very close range, whether a macro lens is used or not. I wouldn't nitpick a close-up that isn't really macro, but you should know the correct meaning.

Besides the obvious attraction of photographing very small slices of life, many photographers love the very shallow depth of field inherent with macro photography. Depending on your lens' focal length and selected aperture, the acceptable area of focus can be as small as a couple of millimeters. You can use this to drive the viewers eye to your subject; the rest of the photo will be lost in bokeh.

With a macro lens, even a weed can look nice.

With a macro lens, even a weed can look nice.

But when you want to have everything in focus, you'll have to resort to a post-processing technique called focus stacking. This technique is nothing fancy, but you'll need a photo-editing software, like Photoshop, to make it work.

I start by stealing my wife's sculpture of Neu Schwanstein and putting it inside the light tent. The light tent helps give me nice even lighting. You can see the castle is about eight inches from front to rear.

20140129-_RD43372.jpg

When I focus on the front gate with my Nikon 105mm Micro lens, set at f8, you can see that only about half an inch is in focus. The front of the sculpture is way too soft, and the back is completely lost in the bokeh.

With a macro lens, your depth of field will be very narrow.

With a macro lens, your depth of field will be very narrow.

To keep everything consistent, I put the camera on a tripod and use manual mode on both the camera and lens. In any of the auto modes, the camera will calculate its settings every time you depress the button and may give you different solutions each time. That isn't what you want. You can use the camera's first solution as your starting point for exposure. Just read the back of your camera; switch to manual; and dial in the settings.

With your lens in manual, you will make a series of photos, moving the focus through the subject a fraction at a time. I usually do this from front to rear and then rear to front. Make sure you rack through the entire range. You may want to turn on Live View, so you can track your progress on the rear LCD. It is easier to see the minute differences in focus on each photo when you're looking at the LCD.. Now, import the photos into Lightroom; make any adjustments you want to the first image; and synchronize those settings across all your photos. Consistency, remember?

Getting the photos into Photoshop, is easy. Highlight all your images in the series; right-click on them; and choose “Open as Layers in Photoshop.” It may take some time, depending on the file size and number of images, but you'll get one Photoshop file, with each of your images on a separate layer.

Highlight every layer and choose “Edit>Auto-Align Layers.” Even with the camera on a tripod, you may have had some movement. Next, (with all layers still selected) choose “Edit>Auto-Blend Layers>Stack Images.” Make sure you check the box that says “Seamless Tones and Colors.” Photoshop will create masks for each layer, revealing only the portions that are in sharp focus. Something like this.

Photoshop will create the complex masks.  You don't want to try this manually.

Photoshop will create the complex masks.  You don't want to try this manually.

From here, I flatten the image and make any touch-ups I want and save the image.  You don't have to flatten the image if you're a stickler for non-destructive editing, but your final file size is going to be ridiculously large. Voila! You have the entire subject in focus. I threw in a background color that I took from the image, so there was a little less white and cropped it.

Final image, composed of stacked layers.

Final image, composed of stacked layers.

Like the compositing I showed last week, this is not a very complex technique and can yield a photo that isn't possible with one photograph. Take your time and get all the different focus points before you move the camera. This one took 20 images and still isn't perfect when you zoom in to 300%. If this was more than just a demonstration, I would do another round. Have fun.