Instead of using geometric optics based directly on the circle of confusion, I'm going to compute DOF using wave optics, based on the effective f-number and looking at wavefront error. Then I'll get at circle of confusion indirectly, by using that to determine what f-number we should be using in the first place in order for diffraction to play nicely with that circle of confusion.

I warn you that this is probably going to look a little crazy, but I think it has some advantages in being simpler to think about once you get the hang of it.

Notation:

f_eff is the effective f-number, as seen by the camera sensor

TDF is the total depth of field, front to back limit, as determined by the criterion of 1/4-lambda wavefront error

NA is the subject-side numerical aperture

m is the magnification, from subject to sensor.

C is the diameter of the circle of confusion. We're going to take C as being proportional to the Airy disk diameter implied by the effective f-number, and pick one to match the other.

Basic formulas...

Let's take it as always true that:

TDF = lambda/NA^2 [1/4-lambda wavefront error, lambda = 0.00055 mm for green light]

NA = m/(2*f_eff)

and correspondingly

f_eff = m/(2*NA)

Doing the algebra, we have immediately that

**TDF = lambda*4*f_eff^2/m^2**

Now, for the sake of illustration let's choose to associate f_eff = 11 with C = 0.012. This corresponds to a rule of thumb that f/11 is the smallest aperture you can use on an APS sensor without losing resolution even at actual pixels (C ~= 1/2300 of sensor diagonal). It turns out this also makes C just a little smaller than the diameter of the Airy disk.

Then in general for other values of C we can say that a good choice is:

f_eff = 917*C [917=11/0.012, so scaling the aperture to match our choice of C]

Now we're set to look at some calculations.

Suppose we're using a 10X NA 0.25 microscope objective. Then we have that

f_eff = 10/(2*0.25) = 20

TDF = 0.00055*4*20^2/10^2 = 0.0088

You'll notice that this is just equal to the first term of microscopyu's formula.

On the other hand, at 1:1 and effective f/11, we have

TDF = lambda*4*f_eff^2/m^2 = 0.00055*4*11^2/1^2 = 0.2662

The traditional formula would come at this case from a different direction, using a nominal lens aperture of f/5.5 (effective f/11 at 1:1) and calculating as

TDF = 2*C*N*(m+1)/m^2 = 2*0.012*5.5*(1+1)/1^2 = 0.264

The results are a little different, about 1%. If we wanted them to come out exact, we could tweak the relationship between f_eff and C to make that happen. But forging ahead...

As another example, at 0.5X and effective f/11, we have

TDF = lambda*4*f_eff^2/m^2 = 0.00055*4*11^2/0.5^2 = 1.065

The traditional formula would use a nominal aperture of f/7.33 (=11/(0.5+1), producing effective f/11), so

TDF = 2*C*N*(m+1)/m^2 = 2*0.012*7.33*(0.5+1)/0.5^2 = 1.056

Again the numbers are slightly different, and by no coincidence it's by 1%, the same amount as before.

We can change sensor size by altering C and f_eff. If we're just scaling up the sensor to full-frame, without changing our criterion for final sharpness, then we'll need C = 0.012*1.6 = 0.0192 and f/17.6. Of course the magnification also has to increase by 1.6 in order to image the same subject size.

In that case the calculated TDF for what was the f/11 m=0.5 case is now f/17.6 m=0.8, and the calculations go like this:

TDF = lambda*4*f_eff^2/m^2 = 0.00055*4*17.6^2/0.8^2 = 1.065

TDF = 2*C*N*(m+1)/m^2 = 2*0.0192*9.78*(0.8+1)/0.8^2 = 1.056

It's important to notice that these are exactly the same TDF values that we got with the smaller sensor. When you change the sensor size, and you adjust the magnification to shoot the same size subject, and you adjust the aperture to get the same amount of diffraction blur, then you also get the same DOF, and vice versa. The only difference is that with the bigger sensor you get to use a smaller aperture setting on the lens (f/9.78 instead of f/7.3 in this case).

Let's try another one. How about m=3 with C=0.025 -- maybe we're shooting a small subject on an APS sensor but we don't care about pixel-peeping.

So, compute as:

f_eff = 917*C = 917*0.025 = f/23. (Makes sense -- we can tolerate more diffraction blur with the larger circle of confusion.)

TDF = lambda*4*f_eff^2/m^2 = 0.00055*4*23^2/3^2 = 0.129

Now, if we're shooting with an ordinary lens on extension, to get f/23 at m=3 means that we need an aperture setting of 23/(3+1) = f/5.75.

The classic calculation would be

TDF = 2*C*N*(m+1)/m^2 = 2*0.025*5.75*(3+1)/3^2 = 0.128 (There's that 1% difference again -- attributable to the scaling between C and f_eff.)

Your eyes may be glazed over by the numbers at this point. Mine too. Let's take a break from the numbers and think about why this formulation is useful.

It's useful because

a) it matches the physics (including diffraction),

b) it tells you how to optimize your aperture corresponding to the sharpness you need, and

c) effective aperture may be surprisingly easy to access, even with info you can get from a newbie user.

Here are some typical cases:

1. Modern Nikon body and lens: f_eff = camera setting

2. Canon body with macro lens: f_eff ~= camera setting*(m+1)

3. Lens on bellows or tubes at low magnification: f_eff ~= lens setting*(m+1)

4. Lens reversed on bellows or tubes at high magnification: f_eff ~= lens setting*(m+1)

5. Closeup lens on regular lens: f_eff = same as regular lens alone

6. Reversed combo, stopped in the rear: effective aperture = rear lens setting

7. Reversed combo, stopped in the front: f_eff ~= lens setting * m

8. Teleconverter with auto lens: f_eff adjustment is handled by camera

9. Microscope objective: f_eff = m/(2*NA)

I have the feeling that there's a great simplification here. Instead of having a large handful of complicated formulas, we have just one basic formula that's not very complicated, combined with a large handful of simple formulas to compute the parameter needed by the basic one. Throw in some decent way to determine magnification, let the user pick C, and you get a recommended aperture setting and DOF value at the same time.

It's late now, so I'm going to just post this out and come back tomorrow to read folks' reactions and try to answer whatever questions have come up.

One question is sure to come up so I'll address that now: haven't I ignored pupil ratio? Yes, I surely have. The rationale is that at low magnification P doesn't matter much, at high magnification P doesn't matter much either because typically you'll be reversing the lens, and at magnifications around 1:1 it would be strange to be using an asymmetric manual lens anyway. This reasoning fails on a few lenses like the 38 mm and 20 mm Olympus bellows macro lenses, because those have aperture values that are specified at infinity focus even though they're always used front-forward at high magnification. But the resulting error is not huge even for those -- the 20 just acts more like f/2.7 instead of f/2.0.

--Rik