One of the greatest challenges in macro photography is dealing with depth of field issues. In my line of work I often have to provide technical photographs of circuitry. I typically use a top of the line macro lens like the Nikon AF-S Micro-NIKKOR 105mm, for these photographs. Even though this lens produces amazing images, I am forever striking a balance between elaborate lighting setups and limited depth of field (DOF). Presuming I even produce enough light to shoot at the maximum DOF of f32 for this lens, I still find at these extreme close-ups depth of field can be an issue.
Thankfully post processing techniques provide us with a tool that makes all of this a bit easier. Focus stacking is not that different than HDR. In essence we are taking several images with one variable adjusted (in this case focus) to create one image. The result is an image that gives a resultant image with greater depth of field than the source image.
This technique can be used in all sorts of macro photography, from nature photographs to microscopy. Thankfully the technique is made painfully simple with modern imaging tools. There are a number of tools that can achieve these results (CombineZM, Helicon Focus, Magnification, etc.) however we are going to use Photoshop CS5 for this tutorial.
Shooting for Focus Stacking
The first general rule of Focus Stack imaging is to shoot with one exposure setting. There should be no variation in exposure from shot to shot. The only variable that should ever change is the focus. When Focus Stacking you are going to combine multiple images into one and as such require that those images be identical except for focus. For this reason you do not want to mix varying exposures, or at least not for this basic lesson.
The second general rule of Focus Stack imaging is that you must use a tripod. This serves two purposes. If you are shooting a long exposure it will keep your image sharp.I will also ensure that the view remains the same throughout the exposures.
The third general rule of Focus Stack imaging is to shoot raw. I know this is going to be a bone of contention for some of you, but the flexibility is important here.
For this tutorial I shot images with a very shallow DOF on purpose, however in the real world you should always attempt to maximize your depth of field for your lighting conditions. As with any photograph that is scientific in nature you want to avoid blowing out your highlight or losing detail in the shadows. To accomplish you would typically use a light box, ring flashes and/or ambient diffused light.
Technical Notes from My Shoot
In these images I pretty much used all three methods of lighting discussed above. The exact equipment used was:
- Nikon D90
- Nikon AF-S Micro-NIKKOR 105mm
- Nikon R1 Wireless Close-Up Speedlight System
- Portable light box
All images were exposed at f4.0 @ 1/100th. I shot slow because I wanted to include some of the ambient fluorescent light in the lab I shot in to fill in shadow areas. Naturally using fluorescent ambient light could introduce white balance issues, so to resolve this I shot RAW and used the supplied Fluorescent flash filters from the Nikon Flash kit to resolve white balance issues. You’ll also note the presence of the neutral gray ruler in the image, this will make white balance correction effortless in post processing.
Focus Stack Post Processing
To begin, we are going to use Adobe Bridge and Camera Raw as we usually do to prepare the images for manipulation. To do this, copy the supplied tutorial images into a working folder of your choosing and then browse to them in Bridge.
Once we know where they all are, we are going to have to adjust them. In this example, I shot the images with fluorescent lighting filters on the flash to compensate for fluorescent ambient light. As a result there will be a greenish cast to the images. To correct this we will have to open our RAW files and correct the white balance.
This process is expedited by doing this to only one image. So to correct this image we right click on an image and choose Open in Camera Raw.
In Camera Raw, adjust the white balance of the image by selecting the eye dropper tool and clicking on the neutral grey of the ruler. When complete click Done.
Now that we have measured the white balance and applied it to our image we now must apply the same setting to all our images. Remember, because the only variable that changed from shot to shot was the focus, all settings should be the same. Because we shot RAW as well, any changes are just referential. What this means is that we are defining the instructions that tell the software how the RAW files should be processed when the time comes to do so, we are in no way modifying the actual file. This is yet another example of how shooting RAW can actually save you time. But I digress.
To perform a white balance on all our images with just a few clicks, we are going to copy and paste these settings. When back in Adobe Bridge, right click the image you corrected and choose:
Develop Settings –> Copy Settings
Once you have copied your settings you can apply the white balance adjustment to all our images by selecting them all, right clicking on any image and choosing:
Develop Settings –> Paste Settings
This will result in all your raw images having the same Camera Raw adjustments. Our images are now fully prepared for our Focus Stacking process in Photoshop.
To complete the effect we need to load all the images in a Photoshop document with each image on its own layer. This is easily achieved by selecting all our images (if not already selected) and accessing the Tools menu and choosing:
Tools –> Photoshop –> Load Files into Photoshop Layers….
This may take some time depending on the speed of your computer. When it is complete you will see all your images loaded in one Photoshop document with each image on its own layer.
In some cases you may need to align the layers so that they match. In this example this is not necessary because we shot with a tripod and a remote trigger. What this means is that basically each shot is identical save for focal adjustments. So in this example aligning is not necessary. If you ever need to align your images you would do so by selecting all layers (hold Ctrl and click each layer to highlight blue) and choose menu option:
Edit –> Auto-Align Layers…
We will skip this step in this tutorial as it is unnecessary.
The final step is the real magic of this tutorial, we are going to get Photoshop to auto-magically blend all our images together. Photoshop is now going to analyze each layer for contrast and “focus” and mask out /hide on each layer any areas that are not in focus. The areas in focus on each layer will show through resulting in a depth of field not optically possible with the equipment and exposure settings we used.
To do this select all your layers and choose menu option:
Edit –> Auto-Blend Layers…
In the resultant dialog choose:
Stack Images & Seamless Tones and Colors
Hit OK and watch the magic happen!
The final image is your completed focus stack. You’ll note the extended DOF where all the fuzzy portions of the images are masked out and the sharp elements are shown.