Wednesday, May 10, 2017

To Infinity…but not beyond!

Modern lens are technical marvels and simple to focus via their Auto Focus (AF) feature. However, this simplicity hides some complexes: take infinity focus.

On older manual lenses there tended to be a hard infinity, ie the lens stopped focusing at infinity. These lenses were usually ‘calibrated’ by the manufacturer; thus one could set infinity focus in the dark, ie rotate the lens focus ring until it stopped. They also tended to have rather impressive markings on the lens to find specific distances, eg the hyperfocal distance.

With a modern AF lens, scales are rather ‘difficult’ to read and infinity is rather confusing, as you can focus beyond infinity, ie you are in the dreaded lazy L zone.

The lens manufacturers say that the Lazy L is there mainly to account for temperature variations in the glass and when you need to focus at Infra-Red frequencies.

OK, this sounds rather nice, but for the majority of photographers, the lazy L zone is rather wasted, eg how do you know by how much to adjust the infinity at a given glass temperature.

Because of the ‘confusion’ over infinity and the lazy L, I’ve decided to add a working-infinity feature into my Landscape Focusing Helper Script (see HFD2 on the right).

For those interested in the ‘simple, ie arm-waving, science’, the logic goes like this:

  • The human eye can only resolve details down to a certain limit. For someone with ‘normal’ eye sight it is said that one can resolve 5 line pairs per millimetre (lp/mm) at about 250mm away (10 inches);
  • The camera’s sensor has thousands of pixels, eg on my 5D3 the pixel pitch is about 6.3 microns. Thus, on the sensor, a lp is about 13 microns, ie 2 x 6.3 microns, equivalent to about 80 lp/mm on the sensor;
  • It is reasonable to consider a ‘focus blur’ (some may prefer to call this a circle of confusion) on the sensor as having a minimum that relates to this sensor-blur limit, ie about 13 microns;
  • The total (system) blur that we record is an amalgam of many sub-blurs. Once again, simplifying  things we may reduce the sub-system blurs down to two main ones: the optical blur that the lens creates, and that varies over the depth of the scene, and the diffraction blur, that is flat across the scene;
  • For the optical blur, we will simplify things even more and assume the lens is symmetrical;
  • We now have a way of defining a working-infinity, which we will define as a focus distance that creates a specified optical blur on the sensor. From the above, we can sensibly say that this blur can not be less that one pixel on the sensor, so let’s use that as our blur criterion;
  • The focus distance at which a specified blur (on the sensor) gives a specific value at infinity can be estimated (sic) by:
  • Where fd is the focus distance, f the focal length, k is the blur criteria and N the aperture number. Of course, the above calculates the HFD if you use that blur criterion, eg 30 microns;
  • As an example, at a focal length of 12mm, an aperture of f/10 and a blur criterion of 6.3 microns (our sensor pitch or size), infinity comes out at about 2.3m! Bluntly, focusing beyond this distance will not provide any more 'infinity detail' or in-focusness or 'acceptable out of focusness'.

Pulling all this together, how would I use the landscape infinity focus helper script on my 5D3? That is using Magic Lantern and my script

Here’s how, ignoring all the other ‘stuff’ like exposure and composition:

  • First, decide on the blur criterion you wish to use at infinity, remembering that on a full frame 5D3, a total blur of, say, 30 microns is ‘OK’, ie good enough for an HD monitor presentation (but worry about that 8K monitor you will buy in the future), and ‘OK’ for looking at a 10x6 (in) image at arms length - about a 5 lp/mm result on the print. For gallery and/or competitions, consider a total blur criterion at infinity of half the above, say, 15 microns: ie taking a hit on the near field DoF distance;
  • Ensure the ML settings are OK, ie diffraction aware on and DoF visible in LV;
  • Switch to Live View (LV) and look at the script’s info box. Let’s assume we are using a 12mm lens at f/8;
  • Focus towards infinity until the total (system) blur is around 15 microns. To illustrate things, here is a screen dump from my 5D3:

  • At the bottom we see that ML is reporting that the lens is focused at about 1.51m, giving an ML reported DoF from 46cm to infinity (based on a set 29 microns total blur in ML);
  • The script is showing additional info, ie that the infinity is anything beyond about 2.7m (!!!), and that a total blur (RMS of diffraction (11) and optical (12)) is about 16 microns at infinity, giving a near DoF of 64cm. That is we have achieved enhanced focusing (15 micron total blur) from 64cm to infinity;
  • As we haven't yet reached the lazy L zone, let's keep focusing towards the lazy L infinity zone;
  • The first thing that occurs (above) is the total blur turns red, warning us that the total blur is now less than the sensor limit, ie about 13 microns on the 5D3. This means that it is not really 'worth' focusing any more towards infinity. Remember, the more you focus towards infinity, the more DoF you lose in the near field (note we are now at 1.1m). But let's keep going, as the lens allows us to keep moving towards the lazy L zone. The optical blur (the centre blur reported above) turns red (below), warning that we are now focusing at or beyond an optical blur of zero;
  •  Going beyond this means we are over focusing. Note that our near DoF is reporting 1.6m: and we still could go on!
Bottom line: If using my script, good practice is to ensure there are no red warnings. Once you decide on your infinity total blur, eg between 15 and 30 microns on a full frame camera, getting the optimum landscape 'infinity focus' is simplicity itself. There is no need to worry about 'where is infinity'.

A final word of warning: appreciate the 'limitations' of the script, ie it is suited for 'shortish' lenses, ie don't expect to use the script on your 70-200; use it on your wide angle lenses.

As usual, I welcome any feedback on this post and any ideas to make this approach to landscape focusing better.


  1. I am a bit confused.I was trying to use your script(s) to achieve the greatest infinity focus point possible. Should I be using the Focus Bar? If so, how? Should I be using the "landscape infinity focus helper script" ?.What exactly is that and how does if differ from the Focus Bar. Thanks in advance.

  2. As my scripting experiments have matured, some of the earlier ones are now not that useful.

    Personally I only use the Focus Bar, ie I don't bother with auto focus bracketing, as it didn't work with all lenses, for example EOSM lenses.

    I'll write a new post about which scripts to use and remove some of the older ones.

    Bottom line: use the Focus Bar.

    Finally don't hesitate to ask any questions about FB's use. All I would say is, once you think in blur space, rather than focus distances alone, you will get better focus control.

  3. Thanks for responding. I will take your "bottom line" advice and do my best to understand and use the Focus Bar. My personal way of doing these investigations is to read whatever documentation is available, in addition to the source code.

  4. If you read my various posts you should 'get it'. The thing to remember is that distance-based depths of fields are calculated from a blur that you specify, ie the Circle of Confusion.

    This CoC is used, via simple equations/assumptions, to calculate the near and far DoF distances. But these, defocus, distances ignore diffraction. When you account for diffraction, ie diffraction and defocus together meet your CoC limit, the (near and far) defocus DoFs reduce.

    Also, if you 'only' use the hyperfocal distance, this will give you a defocus blur at infinity that just meets your CoC, or blur, criterion, accounting for diffraction if you have set this (which you should).

    If you focus at infinity then the blur at infinity will be zero, of course. But you have lost near field focus. So somewhere in between the hyperfocal distance and infinity is a 'sweet spot', which is important to find if you taking a single image.

    The focus bar will show/tell you the defocus blur at infinity and the diffraction, as well as the total of these. You can then decide what to do, ie find your focus sweet spot.

    That is accept the loss of near DoF, for a more in-focus image at infinity, or use the focus bar to grab another one or two images for focus stacking. Once again the focus bar gives you the focus stacking data, ie the DoFs and the overlap blur.