Focus Stacking in Macro Photography

In the world of photography we often work hard to obtain a shallow depth of field. When we take portraits and wish to separate the subject from the background, we use bulky lenses with large apertures just to get that magical 3D effect we're striving for. In the world of macro photography, as demonstrated in a previous article, things are entirely different.

I couldn’t have gotten this red-eyed tree frog shot without use of a special image-combination technique. Its body is very deep and if shooting conventionally, I wouldn’t have been able to get all of the subject’s interesting parts in focus.

Canon EOS 7D, Tamron 180mm f/3.5 macro lens, 2 shots both at 5 sec, ISO 400, f/16. LED torches were used to light the subject and background, and I took this shot in La Fortuna, Costa Rica.

As I’ve mentioned before, depth of field (DOF) depends almost entirely on two factors: aperture value and magnification. The wider the aperture we shoot at, and the closer we get to the subject, the shallower the depth of field becomes. When doing macro work, we often shoot at 1:1 magnification or more, compelling us to be extremely close to the subject. This inevitably means that depth of field is extremely shallow - so shallow that in many cases, most of the subject goes out of focus, even if it’s as tiny as a fly, and even if we close the aperture to f/16 or more. 

This robber fly was shot at f/9, a medium aperture setting, and it’s not
even close to being entirely in focus. Canon EOS 7D, Sigma 150mm
f/2.8 macro, 1.3 second exposure at ISO 200, f/9.

This phenomenon simply results from the rules of optics, and can’t be solved conventionally unless we close the aperture so much that it will critically hurt image quality (and sometime even that doesn’t suffice). Yet it turns out that if we're willing to put in a little more effort and work carefully, we could take macro pictures at any magnification, with close-to-optimal apertures guaranteeing high quality and still get our desired depth of field – all by using a method called focus stacking.

The same fly, focus stacked from 8 different images, all 1.3 sec
exposures at f/9. ISO 200.

Focus stacking is a process that involves two tasks. The first task is to take a series of pictures at different focal distances, such that the entire depth range we want to have focused is covered by the series. For example, say we’re shooting a fly from the front. We could take one picture where the fly’s head is in focus, one with its thorax (middle body-segment) in focus and one with its abdomen in focus. 

Another robber fly, focus stacked from 11 different shots. Each shot
supplied sharpness in a different part of the subject's body- the first
shots were focused on the front legs, then the eyes, thorax and so on up
to the back part and wings.

Canon EOS 40D, Tamron 180mm f/3.5 macro + extension tubes,
1/6 sec, ISO 100, f/7.1.

This may sound easy, but when shooting a live subject in nature (and moreover, as I usually do it, in natural light and extreme magnifications), there are a number of things that can go wrong. For example, the lighting may change if the clouds move, or the subject might decide it doesn’t feel like staying put, move and destroy this sensitive process. You must remember that it’s critical to get all the images in a stacking series at the exact same conditions and parameters: aperture, ISO, shutter speed and white balance.

This might seem obvious but when the light changes, auto WB might shift and shutter speed could change, altering the images to be stacked, which could result in a strange outcome. I recommend shooting in the shade as during periods of as little wind as possible, to get the consistency needed to produce a good stack.

A dragonfly, final image stacked from 8 shots, all at 1/50sec, ISO 100, f/5.6 .

Canon EOS 40D, Tamron 180mm f/3.5 macro, Rishon Lake, Israel.

I am a nature photographer, and I only shoot wildlife in the field and not in studios. There are studio-stacking artists out there who produce stacks from hundreds of images, but to do this you have to use some kind of precision rig, as well as studio lights and probably a stone-dead subject, and that’s just not what I personally do.

I shot the red robber fly shown above in nature, under pouring rain. This shows you that focus stacking can be done even in the roughest conditions- it’s just a question of technique, will and patience. Now that’s nature photography! By the way, can you see the reflection of the red/white umbrella in the final image? 

Image courtesy of Shay Habba.

Click here to go to page 2 of this article - Focus Stacking in Macro Photography

The views and opinions expressed in this article are those of the author and do not necessarily reflect the views and opinions held by dpreview.com or any affiliated companies.

Comments

Total comments: 127
12
AndreyT
By AndreyT (Apr 12, 2013)

Your use the term "focal distance" in rather confusing manner. People typically use this term as a synonym for "focal length". You said you changed your focal distance. Meanwhile, it is obvious that you never changed the focal length of your lens but rather refocused it for different distances (at different points of the subject).

Comment edited 38 seconds after posting
0 upvotes
Mike CH
By Mike CH (Apr 12, 2013)

In my experience, people do not use focal distance and focal length as synonyms. Where did you pick that up?

4 upvotes
AndreyT
By AndreyT (Apr 12, 2013)

Oh, let me elucidate.

Firstly, people don't generally use the term "focal distance" at all in the field of photography. "Focal distance" is something one could sometimes encounter in theoretical optics. And there's no meaningful context where "focal distance" would be "changed", at least as freely as the author suggests.

Secondly, in the rare cases when the term "focal distance" pops up in the field of photography, it is either synonymous with "focal length" or refers to "flange focal distance" of camera body (the latter not being changeable at all).

Thirdly, use the combination "to change focal distance" in reference to refocusing is simply wrong in any field. Nothing in the process of refocusing the lens has an y connection to any changes in focal distance (in any meaning of the term).

Comment edited 3 times, last edit 3 minutes after posting
1 upvote
sotirius
By sotirius (Apr 12, 2013)

By changing the focal length you also change the magnification. The proper way to do this is by keeping the lens at max magnification and using a slider to move the whole camera. If not done like this you will distort the actual dimensions of the object you are taking images of. You need something like this http://www.youtube.com/watch?v=wwyBzPdeq2s

0 upvotes
StanRogers
By StanRogers (Apr 12, 2013)

At very high magnifications, moving the camera in tiny increments also changes the subject size on the sensor by a significant amount, so a focusing rail (which is not the same thing as a "slider") is not better or worse (other than tending to suffer from backlash and being another piece of kit to carry). And if the lens you're using is a "pure" internal-focus design, it actually focuses closer by reducing the focal length of the lens rather than by increasing the lens-to-sensor distance, maintaining both magnification and field of view (and, by he way, compensating automatically for exposure by maintaining the same physical aperture size while reducing focal length and increasing "bellows draw", which is pretty neat).

1 upvote
Erez Marom
By Erez Marom (Apr 12, 2013)

I've mentioned focusing rails in the article. My main problem with them is the lack of stability in extreme magnifications.

0 upvotes
Deleted pending purge
By Deleted pending purge (Apr 12, 2013)

Perhaps exaggerating the size of your support might help, like using bigger rail system (perhaps from some other application?), the simplest and sturdiest tripod,the largest head, and added weight...?
I had to photograph a night scene once and there was pretty strong wind, but I was using the old, heavy theodolite stand (weighing around 30#), and the pictures came out okay, even with 30 sec exposure time.
Since then, I use more portable tripods, and a self-made triangle shaped net (fastened to tripod legs by Velcro) and put some additional weight in it. Sometimes it is water bottles, sometimes just plastic bags filled with rocks or shingle, whatever can be found in the vicinity.
Like with most problems, the best solutions are the simple ones. :)

Comment edited 6 minutes after posting
0 upvotes
Erez Marom
By Erez Marom (Apr 12, 2013)

Still, when a 0.2mm movement can ruin your image, any addition can harm the result significantly.

0 upvotes
Deleted pending purge
By Deleted pending purge (Apr 12, 2013)

True, that's exactly where sturdiness proves its worth. The idea is to mount the camera on as solid a base as can be arranged. Of course, there is this tradeoff to portability... So, let's hope the new cameras solve things for us with focus stacking software, it sure hints on things getting simpler.
I wish you Good Light and more success! :)

2 upvotes
Brian Wadie
By Brian Wadie (Apr 12, 2013)

a useful article, thanks

2 upvotes
joe6pack
By joe6pack (Apr 12, 2013)

Live subject at 1.3sec, and then shoot multiple of them and stack them? Wow!

7 upvotes
StyleZ7
By StyleZ7 (Apr 12, 2013)

I believe, it's possible only in some early morning and early season, when insects are really sleepy and inactive.
I tried this in midday of summer with no luck, especially with dragonflies or usual flies..
In midday probably some slow bugs could be better models ;)

3 upvotes
Erez Marom
By Erez Marom (Apr 12, 2013)

Knowledge, technique and patience allow you to do anything :)

2 upvotes
Augustin Man
By Augustin Man (Apr 12, 2013)

As the rest of his articles, this one is very informative and superbly illustrated by examples. I like that it also remarks the many difficulties such an action involves.
In short, a top professional work.

5 upvotes
poochpie
By poochpie (Apr 12, 2013)

very interesting technique

2 upvotes
chrisnfolsom
By chrisnfolsom (Apr 12, 2013)

absolutely beautiful and informative - I am waiting for this feature to be automated as with the panoramic features now currently in most new cameras... I know to "purists" that would be wrong - I still make my own pans, but it is so damn easy working with the automatic tools and they get your pretty close. I even on occasion use my phone to take pictures/document *gasp* ;)

3 upvotes
giornata
By giornata (Apr 12, 2013)

Some of the latest Sony NEX cameras allow you to install apps. One of these apps, 'BracketPro', lets you automatically bracket photos by shutter speed, aperture, focus or flash. The focus option looks useful for this stacking technique, though it is limited to only three exposures. You can control the range of focus shift. I haven't really tried this yet, but I shall certainly give it a go.

0 upvotes
agentul
By agentul (Apr 12, 2013)

also, since even the author compares it to HDR, I don't see why we wouldn't have this option in the camera software.

0 upvotes
eopix
By eopix (Apr 12, 2013)

Yes wouldn't it be nice to have the camera adjust the focal distance automatically! Just tell it to take say ten shots at such-and-such an increment, that would have the advantage of removing human interference, touching the equipment. Cameras already control focus distance in AF using motors, so this is doable. And inevitable. But in the meantime all praise to people like Erez who take the time an care to work with available equipment. Excellent article.

I have photo-stacked immovable objects like pianos, and am awestruck that Erez does this in the field with live subjects.

0 upvotes
lamah
By lamah (Apr 15, 2013)

Magic Lantern firmware for Canon cameras can now do this focus stacking for you automatically.

1 upvote
kff
By kff (Apr 12, 2013)

sw which that allowed would be built in the camera ... it is about fantasy camera's makers :)

Comment edited 1 minute after posting
0 upvotes
StyleZ7
By StyleZ7 (Apr 12, 2013)

If you can find auto HDR stacking in latest DSLR's nowadays, then probably Focus stacking isn't so far away as we think..

1 upvote
ptodd
By ptodd (Apr 12, 2013)

Especially since this dark age of unprogrammable cameras is showing signs of passing. We'll not always be at the whims of camera makers to determine how we can use the hardware...

0 upvotes
Erez Marom
By Erez Marom (Apr 12, 2013)

The problem is that auto focus mechanism on some of the best macro lenses is bad to nonexistent, so how could they implement it?

0 upvotes
_sem_
By _sem_ (Apr 12, 2013)

Focus stacking is not relevant exclusively to macro - though it its indeed macro where this is most needed due to the desperate lack of DoF.
The problem is indeed in lens precise focus positioning. In AF, positioning is done by image sharpness, not distance. Many lenses have distance gauges but most of them are not precise, so focus positioning for focus stacking can only be performed in open-loop and crudely. This would generate more complaints to Support than praise, so it is better left to unofficial hacks like Magic Lantern, CHDK. But some lenses, for instance the recent Canon ones, do have accurate focus distance sensors.

0 upvotes
MarkInSF
By MarkInSF (Apr 15, 2013)

I guess we'll just need a new generation of macro lenses with proper modern focusing. No doubt it will happen, as the advantages for macro shooters are so great and plenty of other lenses have fast, precise focus motors.

0 upvotes
love_them_all
By love_them_all (Apr 12, 2013)

There is a mistake in the article. Auto blend layers is under Edit, not File.

0 upvotes
Erez Marom
By Erez Marom (Apr 12, 2013)

Thanks, it will be corrected.

0 upvotes
Camediadude
By Camediadude (Apr 12, 2013)

Finally dpreview, you post something worthy. Beautiful work!

This makes up for the other non-stories you have been pushing lately, like the recent trollish one about the talentless hack drive-by flasher Johnny Tergo.

Stick to genuine photographers like Erez Marom, and we will continue visiting and reading. Promote those other 'controversial for the sake of publicity' arrogant types like Tergo and we will be forced to seek our photography news and stories elsewhere.

7 upvotes
Bill Foz
By Bill Foz (Apr 12, 2013)

Great article. I could really learn something from this technique. Thanks.

6 upvotes
24Peter
By 24Peter (Apr 12, 2013)

Thanks Erez for your article. I use this technique for product photography. I have clients that produce micro-precision adjusters and other parts. The entire product must be in sharp focus for their catalogs & other marketing materials. I don't like to use the auto-blend option in Photoshop however. I use the File>Scripts>Load files into stack with the auto align option but then manually mask my layers to find the sharpest points of focus. The Photomerg/auto-blend processing in CS5 is too hit or miss for me.

Comment edited 42 seconds after posting
2 upvotes
f8pc
By f8pc (Apr 12, 2013)

You can manually adjust the Photoshop masks that Photomerging makes automatically. Could save you a lot of time.

0 upvotes
24Peter
By 24Peter (Apr 12, 2013)

I understand that but as I said I find it too hit or miss and I end up spending more time adjusting Photomerge's masks than if I just mask the layers myself. I stack my images in order (for instance, closest focus point at the top and so on) so it is easier to do it manually.

0 upvotes
larpad81
By larpad81 (7 months ago)

Great article, and beautiful images!

May I have a question here?
Is focus stacking available in PS CS6, or the CS6 extended version is required?
I guess it should not be an extended feature, as it is available in CS4 and CS5 if I know well. Just want to make sure.

Thanks for answers

0 upvotes
MichaH
By MichaH (Apr 12, 2013)

I'd like to thank you not just for the article but for the Print view feature that allows me to save the article in a clean, readable form as a pdf for later reference. Thanks DPReview!

4 upvotes
Nicotinix
By Nicotinix (Apr 12, 2013)

@Henry M. Hertz - having never done that, I'd like to venture a guess. The animals are probably not fully animated if you find them on a cold morning.

Can anyone confirm?

2 upvotes
xeriwthe
By xeriwthe (Apr 12, 2013)

good call, sometimes bugs will fall asleep too (as far as i can tell), I was taking macros of a fly from a few inches and it wasn't moving at all (it wasn't dead either)

2 upvotes
ikewinski
By ikewinski (Apr 12, 2013)

I've found honeybees passed out cold inside flowers. At first I thought they might be dead and had a "wow they died sucking the nectar right out of life!" moment. Then I poked one and it started to wake up.

Robber flies are also great subjects who are often quite tolerant of people. I've had the problem that the fly decided to land on my camera to get a better look at me.

http://www.flickr.com/photos/ikewinski/8037049735/

2 upvotes
Timmbits
By Timmbits (Apr 12, 2013)

I believe that in one of the articles on macro it is mentioned that the best time is early in the morning, when they aren't moving so much, because it's still cool.

1 upvote
Deleted pending purge
By Deleted pending purge (Apr 12, 2013)

True, and the best time of the year for this is in the Spring, when they've just emerged from the hibernation. Often you also get a lot of dew on them, which is a nice touch sometimes. So, the proper time to go search is about right now...

1 upvote
Henry M. Hertz
By Henry M. Hertz (Apr 11, 2013)

well the stacking process is easy, the software does 95% today. but what nobody really explains is how to get the creatures not moving while you shot. even 2mm movement of the subject will ruin the resulting stack.

1 upvote
Erez Marom
By Erez Marom (Apr 12, 2013)

Hi Henry,
You can read all about that in a previous article:
http://www.dpreview.com/articles/3957977643/finding-macro-wildlife

0 upvotes
rusticus
By rusticus (Apr 11, 2013)

thanks!!!

2 upvotes
CG33
By CG33 (Apr 11, 2013)

Agree with j2l3m7. Very good article.

2 upvotes
j2l3m7
By j2l3m7 (Apr 11, 2013)

Very nice presentation, and a lot of great instructions.

8 upvotes
Total comments: 127
12