Hyperfocal Distance, Depth of Field, Circle of Confusion, Diffraction, and Print Size
If these topics give you a headache, you aren’t alone! If you’ve never heard of these terms and they sound like gibberish, you might want to grab a cup of coffee and some ibuprofen. Hopefully this article will help explain these concepts better, and more importantly the relationship between them and how one affects the other.
I shoot a lot of large panoramas that are often a gigapixel or more and are printed extremely large with companies like VAST. I’m often asked how I get my images so sharp. Some of it is post-production with good noise-reduction and sharpening techniques, but the majority of it is getting as much in critical focus as possible in the camera while shooting, and sometimes using focus stacking when critical focus cannot be achieved for an entire scene. So, let’s dive in and cover these topics one at a time and see how they interact with each other.
Depth of Field (DoF)
This one is easy, and a term you are probably already familiar with. For any given aperture and subject distance (where the lens is focused), there is a Depth of Field (DoF) that will be in focus and sharp, and anything outside of it is blurry and out of focus. This is not a hard edge of course, objects gradually fall out of focus the further they are from the focus point, so how acceptably in focus and sharp is up to other concepts like the Circle of Confusion (CoC) to define what is acceptably sharp or not the further you get from the focus point—more on that in a moment.
Your aperture will control your DoF. A smaller aperture (stopped down, higher f stop like f/8 to f/13) results in a greater or larger DoF, and a larger aperture (more wide open, lower f stop like f/2.8 to f/4) will result in a shallower depth of field. A longer focal length will also result in a shallower depth of field at any given aperture, as will a closer subject. For example, a 100mm focal length at f/8 will have a shallower depth of field than a 50mm lens at the same f/8 aperture. And both lenses will have a shallower depth of field with a closer subject focused at 4ft than they would with a further away subject focused at 8ft. You can see all of this with an app like PhotoPills in the DoF module. Experiment with different focal lengths, apertures, and subject distances to see how changing the lens, the aperture, and the subject / focus distance changes the total DoF. Portrait photographers typically use 85mm to 135mm with an aperture of f/1.4 to f/5.6 for a very shallow DoF to isolate their subject from the background. Landscape photographers typically use 14mm to 35mm at f/8 to f/16 for a greater DoF to get as much of the scene in focus as possible.
Above is a screenshot from PhotoPills with a 50mm lens @ f/8 on a Nikon D850 focused at 8ft. The total DoF is 3ft, 10in with 1ft, 6in in front of the subject acceptably sharp and 2ft, 5in behind the subject. Anything closer than 6ft, 6in to the camera will be blurry, and anything further away from the camera than 10ft, 5in will be blurry. The important thing to note here is that the focus distance is NOT in the middle of the total DoF, it’s roughly about 1/3 into the DoF, meaning about 1/3 of what is sharp will be in front of your subject or focus point, and 2/3 of what is sharp will be behind it. This will be useful information when we get to the next topic on hyperfocal distance.
The middle section of the above screenshot shows all of this information in pictorial format making it easy to visualize. On a phone with a smaller display, you can swipe left to right to see those three lower segments; on a tablet with a larger screen you can see all three segments side by side.
Hyperfocal distance is the closest distance you can focus and still get objects far away at infinity to be acceptably sharp; it is the maximum DoF you can achieve for any given focal length and aperture. This is especially useful for landscape photographers where they want a mountain in the distance to be sharp, and still have a foreground object sharp. In the above screenshot, for a 50mm lens @ f/8 on a Nikon D850, that magical distance would be 34ft, 4in, where everything half that distance to infinity would be sharp. That means anything closer than 17ft, 2in would not be sharp (without focus stacking). If you change the focal length and aperture to 24mm @ f/13, the hyperfocal distance becomes much closer at 5ft, where everything half that at 2ft, 6in to infinity becomes sharp.
Circle of Confusion (CoC)
The first two topics are really simple to grasp, this one becomes, well… confusing! Simply put [from Wikipedia]: “In optics, a circle of confusion is an optical spot caused by a cone of light rays from a lens not coming to a perfect focus when imaging a point source. It is also known as disk of confusion, circle of indistinctness, blur circle, or blur spot.” https://en.wikipedia.org/wiki/Circle_of_confusion In layman’s terms, and for our purposes as related to printing large photos that look sharp, it simply means the smallest blur spot that will be seen as a focused dot by the human eye at a particular distance and print size.
Most DoF calculators like PhotoPills assume a Circle of Confusion (CoC) of 0.025mm or 0.030mm (if rounding up). This is based on an old formula, wrongfully attributed to Zeiss quite often, of an 8in x 10in photo viewed from 10in away. There is no evidence that the Carl Zeiss Company ever invented this formula though. https://en.wikipedia.org/wiki/Zeiss_formula This results in a blur spot or CoC of 0.030mm being seen as a focused spot by the human eye at that distance and print size. You can see what PhotoPills is using as a default CoC by choosing your camera in the drop down list in the DoF module. Most full frame cameras such as my Nikon D850 will show you a sensor size of about 36mm x 24mm and a CoC of 0.030mm. A crop sensor camera like the Nikon D500 will show a sensor size of ~24mm x 16mm and a CoC of 0.020mm. A four thirds camera will have an even smaller default CoC.
After choosing your camera in the top left of the DoF module in PhotoPills, tap the Advanced button on the bottom of the screen. The top left will now show a custom CoC instead of a camera model. Tap that custom CoC number in yellow to bring up another screen (screenshot above). Enable Autocalculate if it isn’t already, and set the max print dimension to 10in x 8in with a viewing distance of 10in. For a full frame camera you’ll see the custom CoC will set itself to the default standard of 0.030mm (and for a crop sensor camera, 0.020mm).
But what if you wanted to print this photo larger, like 36in x 24in, and view it from 10in away? Well, if we change that in this calculator, we’ll get a custom CoC of 0.009mm. That’s about 1/3 of the default CoC, or about 3x more exacting for sharpness, because our print size is three times larger when viewed from the same distance. We’ve blown those pixels up three times larger, so we need to be three times more critical with our DoF calculator for acceptable sharpness. If you hit Done on the top right, we’ll see that the hyperfocal distance has changed radically from before, it’s 3x further away now! Before, with a default CoC of 0.03mm, a 24mm lens @ f/13 showed a hyperfocal distance of 5ft, where everything half that from 2ft, 6in to infinity would sharp—but that was assuming a 10in x 8in print viewed from 10in away. Now that we are using a custom CoC of 0.009mm to view a print that is three times larger at 36in x 24in from the same distance, the hyperfocal distance has tripled to 16ft, 7in, with everything half that at 8ft, 4in to infinity being acceptably sharp.
The important thing to note here is that if we had focused at 5ft and printed at 36in x 24in, then the background would not be sharp enough when viewed from 10in away; it would look soft and slightly blurry, no matter how much post-production you did for sharpening. So, it is essential that you keep print size, viewing distance, and a custom Circle of Confusion in mind when using a hyperfocal distance calculator, or you might not get the Depth of Field as sharp or as large as you’d like. None of this will matter for small prints or social media posts, but it’s a fairly dramatic difference for large wall prints viewed up close, and it’s absolutely critical for 360 / VR or gigapans with a deep zoom feature where you want to zoom in to 100% for more detail such as the one below (click on the photo to zoom in and pan around).
Today’s high pixel density sensors far out-resolve a 0.03mm CoC from the days of 35mm film grain when the “Zeiss Formula” was invented. This means that most hyperfocal distance calculators fall short without using a custom CoC if you want to print large. To figure out what your camera sensor can actually resolve, divide the sensor width by the pixel width and then multiply by 2.
Native CoC of a camera sensor = sensor width ÷ pixel width x 2
For example, my 46MP Nikon D850 has a sensor that is 35.9mm wide and measures 8256px across, so 35.9 ÷ 8256 x 2 = 0.009mm CoC (rounding up). You can usually find your sensor measurements on Wikipedia for your camera model. 0.009mm CoC is precisely the same figure we were using in the previous example, and why I chose a 36in x 24in print viewed from 10in away. I could print larger than that of course and view it from the same distance, but the print is going to get softer and softer the larger I print (unless I step back further) because the sensor is just not capable of resolving any further detail, no matter how crazy a custom CoC I use in my calculator.
Let’s use another camera model as an example: a 24MP Nikon D750 has a less dense sensor because it has the same 35.9mm width but fewer pixels across at 6016px. 35.9 ÷ 6016 x 2 = 0.012mm CoC, so it resolves a bit less detail than a 46MP sensor at the same focal length and aperture. This equates to the same 36in x 24in print being viewed from 13in away instead of 10in away, so not really a big difference. You really need to triple the number of megapixels to truly see a huge difference in resolving power. However, it also means that the hyperfocal distance changes from 16ft, 7in on the D850 to 12ft, 6in on the D750. There isn’t much sense in being more critical with your hyperfocal distance because the 24MP camera isn’t going to resolve that extra detail anyway. Conversely, this is often why people are disappointed that their really high megapixel cameras aren’t as sharp as they’d like, especially when you get higher than 36MP. They aren't realizing how much less depth of field they have when zooming in to 100% as you add more megapixels to the same sensor size.
For a more dramatic difference, let’s compare a 12MP Nikon D700 with a 36mm wide sensor and 4256px across: 36 ÷ 4256 x 2 = 0.017mm CoC. This equates to a much smaller 24in x 16in print viewed from 13in away, anything bigger will progressively get softer and softer for detail. A 36in x 24in print would have to be viewed from 1ft, 7in away to look as sharp as a D850 print at the same size from 10in away. Of course, a lot of large prints are not viewed critically from as close a distance as 10in; so long as the viewing distance is acceptable you can still print a large print from a 12MP camera that looks exceptional, especially with good post-processing and sharpening techniques. To summarize this complicated topic, I use a custom CoC in PhotoPills based on the pixel density of my camera sensor to get an accurate hyperfocal distance for sharp landscape photos. That sounds more difficult than it really is. You can simply use the auto-calculate feature in PhotoPills shown above for any print size and viewing distance if you have a typical maximum print size that you offer, or you can use the formula I posted above to figure out the smallest CoC your camera sensor is capable of resolving (my personal preference). The latter may be overkill if you never print very large though.
You may be wondering, why not use a really small aperture like f/18 through f/22 for even more Depth of Field? The short answer is that smaller apertures will result in an overall loss of sharpness even though you may have gained more DoF, and after a point you are losing more sharpness to diffraction than you are gaining in DoF, resulting in a net loss. The long answer is that light behaves both like a particle (photons capture by analog film and digital sensors) and a wave (frequency and color wavelength). As a wave (water or light) flows through a small channel like an aperture, it causes bends to the wave. You can observe this when water flows through a small slit from one body of water to another, like filling a pool or puddle with a small stream. With light through an aperture onto a flat film plane or camera sensor, it causes larger and larger concentric circles, like dropping a pebble into a still pond. This is called the Airy disk (or disc), discovered by Sir George Biddell Airy. Small apertures (large number, like f/18 or f/20) will cause these waves to spread out wider, causing interference with neighboring pixels on a digital sensor or film grain on analog film and thus reducing overall sharpness, where larger apertures (small number, like f/4 or f/5.6) have a more concentrated spread of waves and thus less interference with neighboring ones. The balance then is to find a small enough aperture to get maximum Depth of Field before introducing so much diffraction that you are losing sharpness. This will happen quicker with higher pixel densities, especially 24MP or higher, where the photosites are packed closer together on the sensor. Fortunately, there is a formula for this!
Diffraction = native CoC of the sensor x 1000 ÷ (2nd airy disc x color wavelength [550nm] x 1,000,000)
In the case of my D850, we already determined the native CoC is 0.009mm in the previous section. The constant for the 2nd airy disc is 2.43932 (diameter, so double the radius). 550 nanometers is the middle of the color spectrum of light that the human eye can see, so we’ll use 0.00000055 for the color wavelength (infrared or ultraviolet would have a different number). So if we simplify the above formula it looks like this for my D850:
0.009mm x 1000 ÷ (2.43932 x 0.00000055 x 1000000) = f/6.5.
While diffraction does start setting in at f/6.5, in practical use this can usually be doubled without compromising image quality too much, so f/13 is what I typically use on the D850 as the smallest aperture with large prints—if I can go wider like f/8 then I will of course. If I know I’m not going to be printing very large (like publishing to social media or websites), I’ll push it to f/16. But generally, I want the highest quality I can get from the camera, which limits how small an aperture I can use. If we use the 0.012mm CoC from the 24MP D750 we get f/9, which can usually be safely doubled to f/18 for the smallest aperture, but wider would be safer. This again means that high pixel density sensors over 36MP can very quickly lead to lower image quality if you aren’t careful about your aperture—another reason that people are sometimes disappointed that their new high megapixel camera isn’t delivering the results they expect compared to their older camera when they zoom in to 100%, because those extra pixels are that much more demanding with diffraction and the circle of confusion.
I should also mention that just because you can stop down to f/13 or f/16 according to the above formula, it doesn’t mean that is the sharpest aperture for your lens, nor does it take into account lens diffraction. This is solely about the resolving power of your sensor based on its pixel density. For example, I have one lens that I know starts getting softer over f/11, and so I never go smaller than that aperture unless it’s for creative use like a sunburst. I’d prefer f/5.6 to f/8 most of the time if I could on my D850, but that’s a LOT of focus stacking for a gigapan with longer telephotos lenses, which leads to the next topic.
With such limitations to aperture and depth of field on a high megapixel count camera like the 46MP D850 due to diffraction and the circle of confusion, quite often focus stacking is required to capture an entire scene—especially with a long telephoto lens for a gigapixel panorama. This has its own set of challenges, especially with changing light, wind and moving objects, time required to shoot, more work in post-production, etc. The Nikon D850 and some Fuji cameras have focus stacking built into the menu, which is very convenient and fast. On my older cameras I used to use a Promote Control external remote (no longer manufactured). qDslrDashboard is a very handy app to control a camera from your smartphone, tablet, or laptop either wired or wirelessly and it also supports focus stacking. For post-production you have to stack the images with Photoshop, Helicon Focus, Zerene Stacker, etc. This topic isn’t the focus of this article [bad pun!], so I’ve only included it as a method of dealing with the challenges of high megapixel cameras and critical sharpness for large prints. For example, Sunset over Mt. Katahdin from River Pond (included again below) was shot at 200mm f/13 and focus stacked from the brush 55 feet in front of the camera to the mountain 7 miles away. Each row of the panorama required a different number of images for each focus stack because the depth of field gets shallower at closer distances and thus required more images per focus stack. The top row of the mountain and sky only required one focus distance at infinity because they were the furthest subjects.
One last concept to cover regarding large prints and sharpness is PPI and how well an image holds up for a particular viewing distance. I have one more formula for you to determine that:
PPI = 1÷ ((distance in inches x 1 arc minute in radians) ÷ 2)
Assuming that your image is acceptably sharp to begin with, this will help you determine the necessary Pixels Per Inch (PPI) for a print to look flawless to the naked eye. Good human vision with 20/20 acuity is capable of resolving 1 arc minute. Measured in radians and written in decimal format that equates to a constant of 0.000290888 for the above formula. Thus, assuming you have a print you want to view from 12in away, you would want to have a PPI of at least 573 to not discern any pixels and look flawlessly sharp:
1 ÷ ((12in x 0.000290888) ÷ 2) = 572.96 PPI
This is why Apple uses a very high PPI for their Retina displays, 458 PPI for the iPhone XS Max for example. Viewed from 2.5ft away or 30in you would only need 229 PPI. Now that we know that, we can determine that a 36in x 24in print viewed from 2.5ft or 30in away with a PPI of 229 would require 8251px x 5500px for resolution, or ~45MP, pretty much the same resolution as the Nikon D850 camera. You could print larger or view it closer, but you’d be starting to lose that jaw-dropping sharpness as the image would start appearing softer and softer.
36in x 229 PPI = 8251px
24in x 229 PPI = 5500px
8251 x 5500 = 45.38MP
This formula is a very high standard, but one we strive for at VAST to produce impeccably sharp prints at very large sizes, and why we stitch such large images for more megapixels. Some print materials like canvas, aluminum, and some matte surfaces will not hold up to this level of detail and appear softer anyway. You can always print larger than this formula at a lower PPI, such as a 20in x 30in print viewed up close from a 12MP camera, but just be aware that critical sharpness will no longer be achieved compared to the original digital file and it will get progressively softer the further you drift from this formula.
Flipping this around, let’s take the gigapixel panorama of Sunset over Mt. Katahdin from River Pond that I included earlier. The resolution of this stitched image is 62,871 x 20,832 for a total of 1,310 megapixels. Assuming a viewing distance of 2.5ft and thus a 229 PPI, this image could be printed to a whopping 22.9ft x 7.6ft and look flawless to the naked eye! Since it was focus stacked, everything is sharp throughout the entire scene. If you wanted to print it on the outside of a large building and view it from a distance of 10ft as you drove by, you would only need 57 PPI and thus could print it 91ft x 30ft and it would still look flawless—from 10ft away. The closer you walked up to it, the softer and less sharp it would appear.
One final note, so far I have used PPI and not DPI, one being pixels per inch and the other being dots per inch. Quite often these terms are used interchangeably when they shouldn’t be, so I have been very careful to use PPI in this article to refer to how large a digital image can be printed and viewed from a specific distance and still look sharp, which is PIXELS per inch for image resolution. DOTS per inch is how many drops of ink a print nozzle puts down on paper, and is not necessarily related. Think of PPI as input and DPI as output. You might determine that you only need 229 pixels per inch to look good from 2.5ft away and thus your 45MP image will be acceptable up to 36in x 24in in size, and yet your printer still might print that same 45MP 36in x 24in print anywhere from 1440 PDI to 9600 DPI. As long as your printer’s DPI is higher than your image’s PPI you will get high quality prints. If you determine you need 600 PPI to view an image from less than a foot away, and your printer is only capable of 300 DPI, then you will see some quality issues and be able to discern the dot pattern of your printer, like looking at a cereal box or color newspaper up close. Generally speaking, this shouldn’t be an issue for most people with any modern DSLR and photo printer.
I’ve put together an Excel spreadsheet with these formulas to make it easy to calculate if you’d like to download it. Just click the screenshot above. There are instructions inside.
Here are some excellent articles on some of these topics:
Thanks for reading and feel free to share this page with others! Happy shooting!!!
- No Comments