Consider a landscape where you want everything — foreground, mid-ground, and background — to appear sharp. If you focus on the foreground, the background is blurry. If you focus on the background, the foreground is blurry. If you focus half-way between, both foreground and background are blurry.
You could go to f 22, but that brings problems with some lens/camera combinations because light bends around the aperture blades at high f stops causing defocusing of sharp edges.
There are a couple of solutions. Focus stacking uses multiple source images blended together in software. The process is time consuming and requires a tripod to get the best results or any results.
The other option is to use the hyperfocal method. This method requires only one shot and the tripod becomes optional.
Hyperfocal distance is the focusing distance that gives your photos the greatest depth of field.
We can determine the hyperfocal distance using the following formula…
which reduces to
H = Hyperfocal distance
f = Focal length
N = Aperture diameter or f stop number
c = acceptable Circle of Confusion
Or you can use a simple chart
Or an app
The FF chart
And the APSc chart.
For and focal length and aperture setting, the chart for your style of camera will provide the distance that you should focus at. Remember to set the lens to manual focus.
If we use a 50 mm lens at f 8 on our APSc camera, and focus at 16.75 meters, everything in the image will be acceptably sharp from about 1 meter in front of the camera to infinity.
There are apps that do all the calculations for us.
Apps are available for iOS and Android.
Shot on a four-thirds camera, a moderate aperture setting of f 9.5 with the lens set at 45 mm and focusing at the hyperfocal distance calculated, this image is acceptably sharp from foreground to infinity.
Even with a wide lens (28 mm) and medium aperture setting (f 6.7), using the hyperfocal technique gives acceptable focus from foreground to infinity.