Macro Focus Stacking : A Primer

by Sean Setters
Before we delve into the different techniques for capturing focus stack images, it's important to understand why focus stacking is an important tool, especially in regards to macro photography. Focus stacking allows you to gain more DOF (depth of field) so a larger portion of your frame can be in sharp focus. Your DOF is determined by the relationship between format size (full frame or APS-C), focal length, aperture and focus distance. Macro photography, especially as magnifications of 1.0x (or greater) are achieved, necessitates focusing on very close subjects, which in turn produces a very shallow DOF even at relatively narrow apertures.
For instance, using a Canon EOS 5D Mark IV and an EF 100mm f/2.8L IS USM Macro lens set to f/5.6 with a subject distance of 11.8" (the lens' minimum focus distance), your DOF would be approximately 0.08" (2.03 mm). Switch out the 5D Mark IV for an EOS 7D Mark II and the DOF would change to 0.05" (1.27 mm). Note that if a 7D Mark II were used and the framing remained identical between the two cameras, the APS-C 7D II's DOF would be greater than the full frame 5D Mark IV's (see FOVCF).
With such a shallow DOF at f/5.6, why not just use a much narrower aperture to gain more DOF? There are two main reasons. The first is that even if you used f/16 with the 5Ds R under the shooting conditions listed above, your DOF would only increase to 0.23" (5.84 mm) which still won't be enough DOF to cover your subject under a lot of macro shooting conditions. And the second (probably more compelling) reason is that the cameras listed above have DLAs (Diffraction Limited Apertures) of f/6.7 and f/6.6, respectively. Noticeable sharpness and contrast penalties are incurred when using apertures significantly narrower than a camera's DLA, so shooting at f/5.6 allows you to obtain the sharpest image within your DOF.
In short, focus stacking allows us to obtain exactly the DOF we desire in a scene while maximizing sharpness at the same time (assuming an aperture wider than the camera's DLA is used).
Now that we've established why focus stacking is important in regards to macro photography, let's dive into ways you can capture the images necessary for focus stacking.
Really Right Stuff Macro Focusing Rail

Fixed Focus, Variable Camera Position
A perennial favorite for macro shooters is the use of a focusing rail to move the camera forward/backward at set intervals. Focusing rails are typically adjusted by rotating a screw on which the camera platform sits (or otherwise the platform freely slides along the rails until clamped into position) with markings provided to make precise interval shooting a breeze.
Move the camera forward so that the new plane of sharp focus overlaps with the previous shot and activate the shutter button. Repeat as necessary until the desired DOF has been captured.
If you prefer an automated solution, Cognisys, Inc.'s StackShot Automated Macro Rail can be programmed to do the work for you.
Note that if your macro lens features a tripod ring, you could attach an inexpensive macro plate (one with scaled markings) to the tripod ring and manually slide the camera, clamp, shoot and repeat to capture your focus bracket. This approach isn't as convenient and won't likely be as precise as using a geared macro rail, but it is much less expensive.
One issue that you may run into when using macro rails is that your perspective changes as you move the camera. However, most focus stacking programs are designed to properly align source images even with the perspective change.
Variable Focus, Fixed Camera Position
For this technique, the camera is mounted to a solid support system (typically a tripod) and images are taken as the lens' focus distance setting is changed to move the plane of sharp focus forward or backward. This can either be done manually by very carefully and minutely rotating the focus ring in between shots or the process can be automated through various camera remote platforms (CamRanger, CamFi, DSLR Controller). For the sample image atop this post, I used the Canon EOS 5D Mark III and EF 100mm f/2.8 USM Macro (and some extension tubes) to capture 17 RAW files while manually adjusting focus from the nearest in-focus element to the farthest.
Varying focus does not lead to perspective change. However, if the lens exhibits focus breathing (many do), the scene will be framed slightly tighter or looser as focusing is adjusted throughout the imaging sequence, making details larger or smaller in the frame. This change isn't typically an issue for most focus stacking programs.
Which focus stack capture technique should I use?
As a lens's maximum magnification is only achieved at its minimum focus distance, moving the camera position will enable you to achieve the lens' max magnification throughout your image sequence. Also, manually moving the camera via a macro focusing rail can enable you to capture a more precisely spaced set of images compared to manually varying focus (automated systems would likely be equal in that regard).
A focusing rail will not work as well for scenes with a lot of depth as your camera's travel distance will be limited to the length of your rail. In those cases, varying focus will be your only option. If you are on a limited budget and want to give focus stacking a try, the variable focus method doesn't require an investment in specialized equipment, making it much easier to just hit the ground running when the inspiration strikes.
Which focus stacking software should I use?
There are a few programs dedicated to focus stacking and at least a couple of general image editing programs have a focus stacking feature built-in. I decided to try three of them with the same stack of images to see how they compared.
To capture the stack images, I used the variable focus technique, manually adjusting focus between shots. Here's what the nearest focused and farthest focused shots looked like in the 20 shot sequence at f/5.6:
Focus Stack First and Last Shot

After processing, here were the results:
Photoshop CC Focus Stack

Adobe Photoshop CC - Auto Aligned, Auto Blend Layers (Stack Images with Seamless Tones and Colors)
Affinity Photo Focus Stack

Affinity Photo - Focus Merge
Helicon Focus Pyramid Focus Stack

Helicon Focus - Pyramid
Helicon Focus Weighted Average Focus Stack

Helicon Focus - Weighted Average (Default settings - Radius 4, Smoothing 2)
Each of the programs used did a decent job assembling the in-focus areas of the focus stack, but there were some notable differences. Photoshop seamed to do a great job assembling the in-focus areas, but it didn't handle the transitions to out-of-focus areas very well, especially in regards to areas showing depth. Affinity Photo seemed to do a better job handling the areas that troubled Photoshop, but it produced noticeable halos throughout the image.
It's important to note that Photoshop and Affinity Photo have very limited (if any) focus stacking options to allow for tailoring the stacking algorithm to best suit a given set of images. Affinity Photo provides no customization options for focus stacking while Photoshop CC gives you the option of Automatically Aligning the source images (highly recommended) in the Scripts/Load Files Into Stack dialogue box and provides two checkmark options – Seamless Tones and Colors and Content Aware Fill Transparent Areas – in the Edit/Auto Blend Layers/Stack Images dialogue.
On the other hand, Helicon Focus provides three separate algorithms for stacking – Weighted Average, Depth Map and Pyramid. And if you choose Weighted Average or Depth Map, you can choose specific Radius and Smoothing settings. The Radius setting adjusts how large of an area is analyzed around each pixel. Low Radius settings enable fine details to be better resolved, with an increased risk that halos will appear in the image. The Smoothing setting dictates how the in-focus to out-of-focus transitions will appear, with higher settings enabling a softer transition.
In the end, I liked the Helicon Focus Weighted Average result best, and with the ability to adjust its algorithms' variables, Helicon Focus will likely prove most adept at producing pleasing focus stacking results. But if you already own Photoshop CC or Afffinity Photo, give their focus stacking features a try to see if they work well for your needs.
Posted: 3/13/2018 10:10:40 AM CT   Posted By: Sean
comments powered by Disqus
Help  |  © 2018 The Digital Picture, LLC  |  Bryan CarnathanPowered By Christ!