Controlling depth of field

In most panoramic pictures you will want everything to be in sharp focus so you want to make sure you are maximising your depth of field. The lazy way to achieve this is to stop the lens down to its smallest aperture (f/22 perhaps?) and focus on infinity. Doing this does not give you maximum depth of field and your lens will give its worst optical performance at the minimum aperture because of diffraction.

To get best results you need to stop and think about the depth of field you really need for the scene, and also take into account the optical characteristics of your camera and lens. If you shoot a panorama indoors the furthest thing from the camera is quite likely to be only a few metres away, so there's no need to have a huge depth of field. If you stop down to f/22 you will not only end up shooting very long exposures and risking camera shake, but probably get a disappointingly soft image because of diffraction. You need to understand the hyperfocal distance and diffraction.

What is the hyperfocal distance?

The hyperfocal distance is the distance from the camera to the optimum focusing point to achieve maximum depth of field. The distance varies according to the lens focal length (f), lens aperture used (a) and the circle of confusion of the lens (c, which is a constant: 0.036 for 135 format):

If your lens has markings on it (usually the case for SLR lenses) you can use these to control depth of field (see below). You can also work out the hyperfocal distance mathematically using the equation above. My Nikon CoolPix 990 digital camera allows me to manually set the focus, by setting the distance from the camera that I want to focus on - by knowing the hyperfocal distance, I can correctly set this to maximise depth of field. (Note however that in practice the automatic 'landscape' mode will cause the camera to use the hyperfocal distance and achieve maximum depth of field).

If you want to work out the hyperfocal distance for your lens(es) you can use the equation above (note for digital cameras you will need to know the 135 format "equivalent" focal length). There is also a great Depth of Field calculator on dofmaster.com. There are various applications you can use on your PDA or mobile phone if you want to, such as DOF for Pocket PC users and HyperPhoCalc for Windows SmartPhone 2003. It can also tell you the near and far limits of depth of field for every aperture of your lens, and work out the aperture and focus point you should use to achieve a specific near and far distance.

What is diffraction?

When you stop down to a very low aperture (high f-stop) light rays passing through the aperture of the lens will travel further to the edge of the camera sensor (or film) than light rays hitting the centre of the sensor. As a result rays of light may move out of phase of one another or interfere with one another.

In practice this is true at any aperture but risks becoming noticeable at smaller apertures and when the image sensor (or film) is high resolution. (To put it another way, it risks becoming noticeable if you are intending to blow up the image quite large compared to the size of the sensor (or film frame) in the camera.)

Since the majority of digital cameras have sensors that are smaller than 135 film (36x24mm), digital cameras are more suseptible to diffraction at small apertures than film cameras are. Similarly large format film and digital cameras are better able to produce sharp images at low apertures.

There is much more detailed explanation of diffraction and diffraction limit calculator on the cambridgeincolour.com website, and of course elsewhere on the web.

Getting best results in the real world

So what does this all mean in practice? Well, if you are wanting the best possible front-to-back sharpness you should ideally determine the "sweet spot" of your lens (the aperture range at which the lens produces the sharpest image). Note that the sweet spot gives the sharpest image but not necessarily the greatest depth-of-field, so you may need to compromise. To give you some idea, this is generally about 3 stops wider than the minimum aperture of your lens. You may be able to find the sweet spot for your lens by searching websites such as slrgear.com

In general terms you should simply avoid a large aperture. If you can achieve the depth of field you require with f/8, do that and do not bother reducing the aperture further to f/11 or f/16.

Wide-angle lenses give a larger depth of field than long focal length lenses, and so when using a wide angle lens you should not need to reduce the aperture as much in order to achieve a sharp image. For example, the Canon EOS EFS 10-22 wide angle lens at 10mm, can be stopped down to f/22 but for most purposes f/11 or less will give a sharp image for subjects from infinity to less than 1m away.

Controlling depth of field by using lens markings

If you are using an SLR camera, chances are your lens(es) have markings on them to make it easy for you to determine depth of field and the hyperfocal distance. Check your camera/lens manual for information specific to your camera/lens. The following is an example using my Sigma 18-35mm:

Here I have focused on infinity. The red line shows the actual depth of field this achieves assuming the aperture to be f/16. By reading the scale you can see that everything from infinity back to approx 2.3 feet will be in focus. What if there was something even closer than that to the camera?

Now I align the infinity symbol with the aperture (f/16) to the right. Now I have increased depth of field: everything from approx 0.5 metres to infinity will be in focus.

Note that in this case the lens markings indicate a minimum focusing distance of 0.5 metres. Therefore I could increase the aperture to f/11 (which means faster exposures) and still get maximum depth of field.