Tuesday, April 25, 2017

Getting the best out of Hyperfocal focusing



As I am about to release a new version of my Landscape Auto Bracketing Script (LABS), I thought I would write a piece on why hyperfocal focusing is not (sic) the best focusing strategy for landscape photography.

As most readers will know what the hyperfocal distance (HFD) is, I will only provide a simple reminder here.

  • A (normal, ie non-tilt) lens is only in focus at one distance, ie the point of focus (PoF), really a plane of focus;
  • Either side of the PoF, the lens becomes progressively more out of focus;
  • The eye-brain system is only able to assess things as ‘out-of-focus’ when they become ‘visable’, ie below a certain level of ‘out of focusness’, things look in-focus, even when they are not at the actual point of focus;
  • For non-macro lenses, the zone of (acceptable) focus (ie the depth of field) in front of the PoF is (much) less than the zone of focus (DoF) behind. More correctly, the DoF is the zone of ‘acceptable out of focusness’;
  • There is a PoF where the far DoF is ‘just’ at infinity: this is termed the hyperfocal distance (HFD);
  • Photographically, ie from a camera-lens perspective, infinity can be quite near;
  • Most lenses are not symmetrical, ie they have pupillary magnification (the ratio of the diameter of the exit pupil to the diameter of the entrance pupil), but to illustrate things, and practically for this post, it is convenient to assume they are symmetrical, ie we ignore pupillary magnification;
  • Conventionally, the amount of acceptable out of focusness (blur) is measured as the Circle of Confusion, which is a sensor plane measurement. Many web sources will quote a CoC figure for a full frame camera of 0.029 or 0.030mm, however, this CoC is about the ‘worst’ you should consider living with, ie acceptable for on-screen presentation only, ie not for printed art viewed up close!
  • The CoC will vary with camera format, and in general the viewing distance and image size should inform the CoC (see this post - http://photography.grayheron.net/2015/06/could-this-be-optimum-focus-stacking.html);
  • A rule of thumb, is that the CoC shouldn’t be less that two sensor pixel widths on the camera sensor, eg a Canon 5D3 has a pixel pitch of about 6.3 microns, giving a minimum CoC of, say, 13 microns (0.013mm);
  • To make things more complicated, diffraction blur needs to be added to sensor blur, to create a ‘total’ blur. This is normally done in quadrature, ie total_blur^2 = senor_blur^2 + diffraction_blur^2

Graphically the above looks like this first illustration, showing a 24mm lens at F/8, with a total blur of around 0.03mm (blur =1), focused at the HFD, with and without the effect of diffraction accounted for. All the charts use a CoC of 0.03mm, and the plots show the relative blur, i.e. unity equals 0.03. 

Anything below a blur of 1 meets the total CoC criterion, ie sensor blur + diffraction (if being used). The chart also shows the classical focus characteristics, ie not much focus in the near field and the far field approaching the unacceptable limit way before ‘infinity’, ie a strong asymptote:



We can also clearly see the effect of diffraction and can now see, that the HFD represents a compromise across the entire (landscape) depth of field, ie from the nearest object we wish to see in focus, to the furthest. But, and this is the key problem associated with focusing at (sic) the HFD, way before infinity the image is only ‘just’ within the acceptable (out of focus) criterion; and we should worry about this, as the blur (eg CoC) has a direct relationship to the visible quality of the image, especially a printed image, as halving the blur, ie going from 1 to 0.5, doubles the lp/mm.

This leads to an obvious question for landscape photographers, especially those printing their work: can we do better than the HFD, ie over the entire scene?

The quick answer is: yes!

Alternative #1: Focus at Infinity

Clearly if we focus at infinity, then, by definition things will be the most in focus at that point. But how much depth of field will we lose in the near field? The answer is: not much. But we need to be careful, as modern lenses will focus 'beyond infinity'.

The depth of field either side of the PoF, if we focus at the HFD, is simply HFD/2 to the ‘left’ of the HFD, ie the near field, and, infinity to the right of the HFD, ie the far field. Thus, if the HFD was, say, at 1m, then the DoF will be HFD/2 to infinity, ie 0.5m to infinity.

If we now focus at infinity, clearly the far field DoF, ie to the right of the PoF doesn’t mean anything, ie we are focused at (photographic) infinity, ie 100m in this case. The near field DoF, ie to the left of the PoF will obviously move toward the PoF, ie infinity in this case, but by how much?

The answer is that it will move to the HFD. That is you can never get less near field DoF, ie the acceptable focus to the left of the PoF, than the HFD. In the example above, the ‘loss’ in DoF is ‘only’ 0.5m, ie the near field DoF has moved from being at 0.5m (HFD/2) to 1m (the HFD). Graphically, using our 24mm example, things look like this, where I have assumed I’m shooting with a typical ‘lofi’ total CoC (0.03mm) with diffraction accounted for, at F/8:



The above also hints at how we can do better than the HFD, as, clearly, the blur in the far field, ie beyond about 5m in the above example, is worst for the HFD focus than focusing at infinity.

An alternative interpretation of focusing at infinity is to note (thanks to Harold M. Merklinger) that one doesn’t need to worry about HFDs etc, ie by focusing at infinity and stopping down the lens aperture to F/x, the smallest resolvable feature will be at FL/x. Thus, with a 10mm lens set at F/10 and focused at infinity, the smallest (in focus) resolvable feature will be 1mm. With a 200mm lens at F/10, it will be 20mm.

Regarding infinity, this following graph, for our 24mm and F/8 illustration, shows the impact of focusing at 10m vs 100m:


Alternative #2: Focus slightly beyond the HFD

As was hinted above, the worst place to focus is at the HFD; as, from a landscape photographers perspective, the main scene will only ‘just’ be in focus.

What about just (sic) focusing beyond the HFD, ie rather than at infinity; could this help. Yes and dramatically!

As a working assumption, let’s assume we focus at twice the HFD. As the next graph shows, we lose a little in the near field DoF, but look what we gain the far field DoF. Bluntly, for the majority of the scene we will have a sharper (less out of focus image). The loss in the near field is FL dependent, but very small for a ‘typical’ wide lens. The following graph illustrates the difference between a 24mm lens focused at the HFD and at about 3xHFD, ie 8m.



I think most will agree: a rather dramatic and surprising result, ie similar to focusing at 100m (infinity).

This also leads to a key finding, that we don’t need to use high apertures, eg F/16, to get large depths of field. This is important for landscape photography as we wish to not only maximise the depth of field, but also the image quality across the sensor. Without going into detail, a good rule of thumb is that the ‘best quality’ for a lens, across the full FoV, will be found at about 2 stops down from the the widest aperture. 

For illustration in this post, lets stay at F/8 and plot our 24mm at an HFD F/16 (with diffraction) and at 3 x HFD at F/8 (with diffraction):



Yes there is some loss in of DoF in the near field, but look at the focus quality in the far field. Remember half the blur is equivalent to doubling the lp/mm quality.

To illustrate the diffraction loss, let's look at two cases using our illustrative 24mm lens, We will set one to F/8 and one to F/16, and focus both at 8m. What is clear to see, is that at F/16 we get slightly more in the foreground in focus, but only about 0.5m. But look at the loss in the background, ie from about 2.5m and beyond. All because we stopped down and diffraction kicked in. Remember, the closer we are to zero in these plots, the less blur, or out of focusness, we will see; and closer you are to 1 the greater the chance you will see 'softness' in your image, especially if you print your image for critical appraisal. Remember from an early posts (see link above) that blur has a linear relationship with the line pairs quality of your printed image, and a CoC of around 0.03 on a full frame is not that exacting for print. In all the charts in this post, where I've assumed a total blur of 0.03, achieving a relative blur of 0.5 at infinity means a doubling of the lp/mm quality when printing.


Alternative #3: HFD Focus Bracketing

Because this post is directed at landscape photographers, I’m assuming a tripod is in play. Based on this, we could do even better than Alternative approach 2, ie we could focus bracket.

As we have seen above, once you focus a little past the HFD, say between 2xHFD to 3xHFD, there is little point in focusing beyond that, ie at infinity. However, even if you focus at infinity, your DoF will be acceptable from the HFD to infinity.

But what if you wanted to get more of the near field in focus. Well this is where landscape focus stacking comes into play. Unlike macro focus stacking, where the near and far DoFs are symmetrical (and very small) and you can use macro rails, the near and far DoFs in landscape focus stacking are non-symmetrical.

Attempting to overlap the acceptable focus zones, as one refocuses, is difficult, unless you have technology to help you, eg my Magic Lantern Auto Landscape Focusing Script, that move the lens and ensure the correct focus overlaps.

But what if you don’t have ML and Lua scripting in your camera? Well all is not lost as it is very easy to undertake a simple two focus bracket set around the HFD, ie by using your lens focus markings. That is take one image for the near field at HFD/2 and one for the far field at 2 to 3 x HFD. This graph (24mm at F/8) shows such a focus bracket set and what is gained in the near field. The HFD is at about 2.7m, so I focused at 1.4 and at 8m:



It would be a simple matter to focus stack these two images in, say, Helicon Focus or even Photoshop.

Bottom line: Although the common wisdom is to focus at the HFD and use small apertures, it is clear that this is far from an optimum strategy for landscape photographers on a tripod. It is far better, assuming you don’t need to get things that are very, very close to the lens in focus, to focus at 2-3 times the HFD, or even at infinity; and don't stop the aperture down too much, ie use a sweeter spot at, say, two stops down from the widest aperture. The ‘worse case’ is you will have everything in focus from the HFD to infinity and the blur over the main scene will be less than if you focused at the 'exact' HFD. That is, by adopting a 2-3xHFD or infinity focus strategy, your main scene will be as sharp as if you had chosen a much more demanding CoC.

Finally, for those wishing to explore HFD-based and other focusing strategies, I can recommend the cBlur App: http://www.cblur.org/en/. Although this is a German web site, there is sufficient English on the site and in the App to be usable for the non-Germans amongst us. Many thanks to Heiko Kinzel for this very useful tool.

1 comment:

  1. Wow, reminds me of my undergraduate physics courses. New perspective to remember on location. Great writing.

    ReplyDelete