Why Focus Stacking is Often Essential for Macro Photography

A Guide to Depth of Field (DoF) in Macro Photography: From understanding the theory and setting up your equipment for focus stacking to post-processing techniques that empower you to reveal subjects in macro photography with unprecedented clarity.


The need for focus stacking arises due to the problem of insufficient depth of field (DoF) in macro photography. DoF is particularly shallow when it comes to objects that are very close to the lens. Therefore, when a subject fills the frame, i.e., the sensor, it is often so close to the camera that the DoF simply does not cover the entire depth of the subject. As a result, it may not be fully in sharp focus. This sharp focus is defined using a property called “circle of confusion”.

DoF Formula

DoF can be mathematically defined using the following formula:

\[\text{DoF} \approx \frac{2u^2Nc}{f^2}\]


Note that formally the DoF varies inversely quadratically with the focal length and the distance to the subject. These will therefore have a high impact on the DoF.

Example DoF Calculation

Now, to create an example, let’s say I go to photograph a subject that is 1 cm long (z-plane) with a full-frame camera and a macro lens with the focal length of 105mm at aperture f/4. The subject is 30 cm away from the lens. What will the DoF be?

In this example:

Using these values, you can calculate the DoF as follows:

\[\text{DOF} = \frac{2 \cdot 4 \cdot 0.00003 \cdot 0.105}{(0.30)^2}\]

Now, let’s calculate the DoF:

\[\text{DOF} = \frac{0.0000252}{0.09}\] \[\text{DOF} = 0.00028 \, \text{m}\]

So, in this example, with a subject at a distance of 30 cm (0.30 m), an f-number of 4, a focal length of 105 mm (0.105 m), and a circle of confusion of 0.03mm (0.00003 m), the DoF is approximately 0.00028 meters, which is equivalent to 0.28 millimeters. This means that the area around the subject, which is within this range in front of and behind the subject (approximately 29.986 cm to 30.014 cm), will be in acceptable focus.

DoF Limitations

In the above mentioned example the resulting DoF is 0.28mm. Therefore the task of capturing the entire subject acceptably sharp in a single photo becomes impossible. Many practical examples of macro photography in the wild, such as mushroom photography, often offer limited flexibility in adjusting these parameters. For instance, changing the aperture to a high value, like f/22, introduces the challenge of ensuring sufficient light reaches the sensor without resorting to high ISO settings, which can introduce noise into the image. To address this, many photographers turn to external flashes to provide adequate lighting.

However, even with these measures, achieving sharp results in macro photography can remain a significant challenge. Changing the aperture value to f/22, as in the above example, results in a DoF of 7.7 mm. While this extends the depth of field, it may still fall short of covering the entire 1 cm subject in the z-plane.

Conclusion: Our ability to capture macro subjects in sharp focus is ultimately constrained by the limitations of depth of field, aperture, and available lighting.

Overcoming these Limitations

Drumm roll…

Focus-Stacking 📷

As the name suggests, focus stacking involves capturing multiple images with varying focus points in the z-plane, from the front to the back. These images are then merged using specialized software that identifies and combines the sharpest parts of each image, resulting in a final image where the subject is in complete focus.

Equipment Setup

Here’s an detailed list of the key equipment needed:

Equipment Description
Full-Frame ILC A full-frame Interchangeable Lens Camera (ILC) stands as a preferred choice for focus stacking in macro photography. The larger sensor size of full-frame ILCs provides greater control over depth of field, allowing to capture fine details with precision.
Macro Lens A macro lens is specifically designed for close-up photography, making it ideal for capturing detailed shots of subjects at close distances. These lenses provide high magnification and are capable of rendering fine details.
Tripod A sturdy tripod is crucial and keeps your camera stable, eliminating camera shake and ensuring that each frame is perfectly aligned. Even the slightest movement between shots can disrupt the stacking process.
Click here to see optional equipment
Remote Shutter Release A remote shutter release or cable release allows you to trigger your camera’s shutter without physically touching it. This minimizes the risk of camera shake caused by pressing the shutter button. Alternatively, you can use your camera’s built-in self-timer function to achieve a similar effect.
Lighting Equipment Depending on the shooting conditions, you may also need lighting equipment, such as a ring flash or external flashes. Controlling the lighting is crucial in focus stacking to ensure consistent exposure and avoid shadows.

Capturing the Image Sequence

When using a camera without built-in focus stacking capabilities, capturing a series of images with varying focus points is a manual process that demands precision and attention to detail. Here are key considerations for taking the pictures:

Point Description
Tripod Begin by setting up your camera on a stable tripod. Even the slightest movement can impact the final result, so a sturdy support is crucial.
Manual Focusing Use manual focus mode on your camera or lens to control the focus yourself. Ensure your camera is in manual focus mode, and manually focus on the closest part of the subject.
Select Focus Points Determine the range of focus points you want to capture. This usually means a sequence of focus points along the z-axis, from the closest to the farthest part of the subject.
Consistent Settings Maintain consistent camera settings throughout the shoot. Keep the same aperture, shutter speed, and ISO for all images. Consistency in exposure settings is vital.
Capture a Series of Images Begin taking a series of shots while adjusting the focus manually. Start at your initial focus point and gradually move the focus towards the ending point. It’s essential to overlap the focus points slightly to ensure a smooth transition when stacking.
External Release or Timer Minimize any potential camera shake by using an external shutter release or the camera’s built-in timer to trigger the shutter. Avoid touching the camera during the capture process.
Proper Lighting Maintain consistent lighting conditions throughout the shoot. Any changes in lighting can make it more challenging to merge the images seamlessly.
Click here to see top secret advice 🤫
Practice and Patience Focus stacking can be a skill that requires practice and patience. Experiment with different subject distances, aperture settings, and focus point intervals to refine your technique. Over time, you’ll become more proficient in taking pictures for focus stacking. 😉

Post Processing

After being out in the field and capturing a stack of images of your prefered subject it is time to invest some time in the post processing process. Both Adobe Photoshop and Helicon Focus provide functionality to stack the images and do some post processing. Adobe Lightroom can be used for the final touches regarding lighting and color grading. Due to the fact that this is a very subjective task, i won’t cover it in this post. Rather i will focus on Helicon Focus for the part of stacking the images.

The first step of stacking the imgaes will be that you open the stack of images in helicon focus. The software supports the following formats: JPEG, TIFF and various RAW formats with 8 and 16 bits per channel. Helicon focus is able to open RAW formats due to its integration of Adobe’s Digital Negative Converter. This enables you to convert camera-specific raw files, such as ARW for Sony cameras to a more universal DNG raw file with the emphasis lying on backward compatibility.

Which Focus Stacking Method?

Helicon Focus provides you with three different stacking methods: a) weighted average, b) depth map, and c) pyramid. Which one of the methods (a, b, or c) will work best for you depends not only on the image itself but also on the number of images in the stack and whether these images have been taken in consecutive order. Helicon Focus suggests some of these for particular situations, but there is no guarantee that the stacked image will turn out without any artifacts.

Helicon Focus recommends the methods as follows:

For mushrooms where the stack has been captured in consecutive order, I personally recommend method B. Feel free to try out the other methods as well.

What Parameters to Choose?

The most important parameter for processing is the Radius. It is advised to try different values, starting from its minimum of 0, and work your way up from there. Increasing the value will generally yield less noise or artifacts, which are particularly visible as halos along the edges of your subject.

It is especially advised to use a low radius level (3-5) if your images contain a lot of thin lines and very fine details. You will need to find a balance between fine details and less noise and a halo effect around the edges of the subject. Increasing the radius will always help you reduce or get rid of the halo effect. Generally, you can stop increasing this value if the halo isn’t noticeable. The higher you go with this value, the more details you will lose.

How come increasing the radius parameter leads to a decrease in the halo and also to a decrease in the details?

The radius parameter specifies the pixel neighborhood size used for contrast calculations. Each pixel undergoes an assessment to determine its sharpness. Subsequently, the software combines those pixels that exhibit higher contrast, as they are presumed to be sharper.

Here is a visualization of the Method depth map with different values for the parameter radius and how it effects the image:

Method: B = Depth Map, Parameter: R = Radius; S = Smoothing

This is generally how all focus-stacking works. The algorithm finds and combines sharp areas.

Here, another parameter is introduced: Smoothing. Smoothing defines how the sharp areas are combined. The relation here is that a lower value produces a sharper image. But you have to keep in mind that the transition areas may contain some artifacts, which can be mitigated when the smoothing value is increased. The advice here is to start with the lowest smoothing value and then work your way up. Not enough detail in the image? Decrease the smoothing value. Too much noise and too many artifacts? Set a higher value.

Here is a visualization of the Method depth map with different values for the parameter smoothing and how it effects the image:

Method: B = Depth Map, Parameter: R = Radius; S = Smoothing

End Product Sample

Here, you can observe the result of stacking 27 images of two mushroom specimen discovered on a dead tree trunk in a local forest. It is evident that not only the caps of the mushrooms are in focus, but also the gills and the stems, thanks to the focus stacking method.