Depth of Field on Steroids for your Macro Shots
When you are doing macro photography, the benefit is you can find heaps of subjects in your garden (if you have one) or around where you live. No need to pay for a trip to Iceland or Paris or New York. Great macro opportunities are everywhere.
My guess is that you already know that if you read an article about focus stacking, so I won’t dig into what macro photography is and what you need. I assume you have a good macro lens or closeup filter or anything to get you close to your subjects.
One annoying side effect of macro photography is the very (very!) shallow depth of field. I am talking about millimeters or even less. Most subjects will not fit into an acceptable depth of field to be sharp in all the right places. If you are in a camera club and entered macro images into a competition, and the judge said something like “Nice subject, but the [insert body part of your little critter here] is not in focus, try some focus stacking next time!”, then I can help you with that.
Let’s get into it. I’ll tell you something about:
- What is Focus Stacking?
- Why do you want to use it?
- When is an excellent opportunity to do it?
- How do you do it?
- What are the common pitfalls?
- Software alternatives
What is Focus Stacking?
Focus stacking is basically merging/blending several images with different focal points. In post-processing, you use software to more or less automagically merge the in-focus parts into one image which then appears to have a greater depth of field than the original single images. It’s a bit difficult to put it into words, I’ll better show you what I mean.
This is what you might get in sharp focus when you want an acceptable shutter speed:
This is an image of a very coöperative moth sitting on our house wall. Wasn’t moving much, so I could go back to get my camera, set up my tripod and shoot a series of images intending to post-process them with focus stacking.
This is just one example image of the series. You can see that not everything is in acceptable focus, only a small slice is sharp (enough), the stuff inside the green marked area. That’s not good enough. But I am already at f/8 and 0.4 seconds. So to get a greater depth of field, I have to decrease the aperture (make the hole smaller, bigger f/number). But I found that going to f/22 would increase the shutter speed to several seconds, and even with my patient subject, it was still moving a little bit and the result was not very sharp. You also get a problem with decreased image sharpness caused by diffraction, so just using a smaller aperture is not always the solution.
I could have increased ISO to get to a smaller aperture without increasing the shutter speed, but that would have introduced noise I wanted to avoid.
Instead, I took a series of images, moving the focus (by using the focus ring of the lens, more on that later) a bit between each image to cover the legs at the front, right up to the legs at the back. Here are the two front and back images, I spare you all the 22 images in between:
As as you can see from my highly sophisticated illustration, we have one focus plane in the front where parts of the front legs are in sharp focus, and we have the rear focus plane with the one visible leg in focus. The other 22 images cover all focus planes between them, with a little of overlap.
Focus stacking is now the magic which takes all the sharp parts of the 24 images and merges them together in an image which looks like you have a depth of field which covers the complete subject from front to back. this is the result:
So the software has not only to recognize what is sharp, but it has to properly align all images beforehand, and it has to deal with ghosting and maybe different lighting conditions between the different shots. More on that further down.
Why do you want to use it?
We already touched on that above. If you are in a situation where you can‘t get enough depth of field with one shot only, either because the shutter speed is then too slow, or your maximum smallest aperture of your lens is still not small enough to get everything in focus, you can use focus stacking to still get everything in focus. It is a software solution to increase the depth of field by stacking the shallow focus planes of multiple images. It therefore increases the possible images you can create beyond the physical capabilities of your lens and camera combination.
When is a good opportunity to do it, and when should you avoid focus stacking?
There are several things you need to control to have a successful focus stack that ties in with the common pitfalls, so I’ll cover both in this paragraph.
Some complications you might experience when doing a focus stack are lighting and subject movement. Basically, you need as much as possible equal conditions for each shot in the series. Keep the changes between each image to a minimum. Best would be to only change the focus plane. That is not always possible, we come to that in a second.
So what could change?
Lighting, for example. If you have a cloudy day and it transforms between being sunny and, well, less sunny, the software has to handle different exposed images besides the different focus planes. That of course only if you shoot in manual mode, which I would recommend. If you shoot in aperture priority mode, the shutter speed might be different between shots, possibly increasing it beyond what your subject will tolerate.
Which leads to the other key thing which could change between shots, that is the position of your subject between shots. Even if you think your subject is still, it might not be. With the moth is looked like it was motionless, but infinitesimal movements of the antenna or the tail were only visible when looking through the images in post processing. The focus stacking software might encounter problems when it tries to decide which part of which image it wants to use for the final image when it can’t align all images perfectly. This is where you might need to help the software later to decide. Still objects are suitable, moving things are bad.
Alignment is another issue. Did you notice that between the left image above (the one with the front legs in focus) and the right image, there is not only a difference in the sharp focus plane but also in the subject’s size (the magnification). That is an effect called ‘focus breathing’. Worth another article, but to explain it quickly, it is the effect that a lot of lenses do not keep exactly the same focal length when focussing from near to far, causing the image to display the treats of that different focal length. Most notable here is that when I focused to the farther end of the subject, the subject got smaller in the frame, probably because the focal length changed to be a little bit wider.
The camera was still solidly planted on my tripod, and I didn’t move the tripod between shots. You can test if your lens also has notably focus breathing. Just shoot two images, leaving everything the same but the focus, one focused to the closest distance, one to infinity. Compare the two images. Any differences? Then you have a problem the software has to solve trying to match/align the magnification of all the images in the stack.
Ok, you say, then I just leave the focus ring alone and move the camera with the lens to get different focus planes! Brilliant! But unfortunately, that can introduce changes in the perspective, and you again introduce issues the software has to solve. Here is an interesting article about the two different ways to focus for a focus stack. It is not as easy as it looks.
Is it better to use a focus rail or the ring on my lens? The short answer is that it’s usually better to use the ring. But this is a surprisingly complex question. There are a lot of factors to consider and the decision is not always clear-cut. There may even be …
How do you do it?
So how do you do the focus stacking? We have two phases, one is exposing the series of images, the other is the post-processing.
Shooting the image stack
You need to shoot a series of images, all identical apart from the focus point. How do you do that? Get your camera on a tripod. Then you want to decide if you focus with the focus ring of your lens or use a focus rail to change focus by changing the distance of your camera to the subject. If you do the latter, you know what to do: put your camera on the focus rail and turn off your auto-focus. And as your camera is on a tripod, turn off any image stabilizing (in body, or in-lens, or both).
Now move your focus point to the closest point you want in focus. Make sure you are in manual shooting mode. Use a cable release for the exposure to reduce camera shake. Remember, we are doing this elaborate process to increase the sharpness of your macro images!
Now comes the tough part, you need to decide how much you change the focus point for the next image. Ideally you want some slight overlapping of focused areas between the different images, and you don’t want to miss areas. So if you are in doubt, shoot more images with fewer change of focus, just to make sure you haven’t missed an area. It would annoy if you have to throw away the entire series of stacked images just because you are missing sharp focus in an important part of the image. As you are touching the camera for the focus change (unless you have a fully automated system), be extra careful to leave the camera position intact. Make sure you cover the whole depth of field you want to achieve.
Post-processing the images
Select your software tool of choice (see ‘Software Alternatives’ below), and load the image stack. Some programs do not allow raw files, so you have to convert the images before you can load them into the stack to process. If you have restricted computer resources and not much patience, you might also opt for using .jpg images, just because it is faster with smaller file sizes.
All the focus stacking software alternatives have some means to correct which part of each focus layer is used and blended in, so you probably have to use that and correct the spots where the software made the wrong guesses. It is correcting the masking of the layers.
Areas which often need attention are the ones where images with similar good focus have not aligned properly, maybe because of subject movement. The software does not know which image should take precedence, and it might be blended together awkwardly.
So if you try out a stacking software, make sure you test how easy it is to blend in parts from one layer and hide parts from another.
I used Affinity Photo for my focus stack. Here is a tutorial video for how to do it (they call it ‘Focus Merging’):
There are several alternatives, all having their strength and weaknesses. When trying all the alternatives, have a look at the price (obviously), is it a specialized product, or do you already have a license for a general product which can also do focus stacking. Can it handle raw files directly (is that important for you?), how fast is the process if you have lots of big file stacks? How is the quality without manual interference, how easy is it for you to change which layer part is used? Is the software still maintained and current, support, user forum, etc. all the usual stuff when you try and buy new software licenses. Maybe you also contemplate about having an automated focus rail, then you might want your software to work with that process. So lots of things to think about.
Find a quick tutorial here about how that works in Adobe Photoshop:
When we look at a scene—for instance, a landscape with flowers near us and mountains in the distance—nearly everything appears tack sharp because …
Using Photoshop is a bit less automated, but you get a better sense of what parts of the images are used by examining the layer masks. A lot of photographers might already have a license for Adobe Photoshop, so there might not be additional costs involved.
Helicon Focus and Zerene Stacker
These two software packages are specialized on focus stacking. I haven’t used any of them yet, mainly because I do not use focus stacking very often, so I didn’t want to pay for another software package. But your use case might be different, so get a trial version and check them out.
Have fun getting close and sharpen your stack!