Sunday, November 20, 2022

Deep Focus Bracketing Hack

As readers of my blog know, I like 'playing around' with the technical side of photography and am drawn to landscape, wide angle, deep focus image capture.

As a user of Magic Lantern and CHDK I can exploit Lua scripting to help with landscape focus stacking, for example my QDFS script that gives my M3 and EF-M lenses a depth of field scale and user feedback on where to focus stack.

But what if you are using a manual lens or a lens that doesn’t work with Magic Lantern or CHDK?

In this post I discuss a cheap and cheerful hack so you can ensure any lens can be used to capture perfect focus stacks.

Of course, some lenses are already fit for manual focus stacking: for example my Irix 11mm prime lens on my EOS-R, via an adapter, provides a very readable and useable depth of field scale:

On the other hand my Sigma 12-24 f/4.5-5.6 DG HSM II lens is virtually useless for focus stacking.

The issue with the Sigma lens is, of course, it’s a zoom and the depth of field scale is fixed.

Yes, you can work out the focal length that the depth of field scale is set at, but you will likely find it is not at the focal length you wish to use. In fact if we use a circle of confusion of 0.03, the Sigma 12-24mm lens appears to have a depth of field scale set for a focal length of about 17mm: the middle of the zoom range.

A true depth of field scale on a zoom needs to adjust to each focal length, as one sees on some older lenses:

In order to construct your own depth of field scale, at your focal length of choice, we need to first lay out a model of the lens as we don’t want to model a real lens. As always, we will make use of a thick lens model. That is a split thin lens with an hiatus, splitting the single thin lens principal, between front and rear principals.

Thanks (once again) to PhotonsToPhotos we can look at the Sigma 12-24 and use the Optical Bench Hub to explore the lens:

In the above we see the front principal (H) and the entrance pupil (P), relative to the image plane (I). The distances, relative to the front of the lens, at infinity, being H, P, I = 34.2mm, 23.84mm, 137.86, at the wide end.

As we are interested in measuring focus from the front principal, the above tells us that, if we know the minimum focus distance (MFD) from the image plane, ie through accepting the manufacturer’s data or measuring it, we can estimate the minimum focus distance from the front principal, ie MFD - (137.86-34.2 = about 104mm). Note we will be ignoring lens extension in our model.

To simplify things further, we will recognise the hyperfocal distance (h) as (F*F)/(N*C), where F is the focal length, N the aperture number and C the circle of confusion that we wish to use for focus stacking. We thus can state the near (R) and far (S) depths of field estimates as:

R = (h*u)/(h+u)

S = (h*u)/(h-u)

Where u is the focus distance from the front principal.

We can then rearrange the above to derive the depth of field scales, ie:

1/S = 1/u -1/h

1/R = 1/u + 1/h

Finally, by using a scale factor (J) we can create the following model:

Where J is simply (MFD-X)*T, and T is the lens throw.

Now we have a model, let’s put it into practice.

The first thing we need to do is to measure the lens throw or rotation, between the MFD and infinity. The simplest hack to do this is to put some tape, or something similar, that will not stretch or move, on the focus ring of the lens. Having done this, rotate the lens until the left of the tape comes into alignment with the MFD. Then slowly rotate the lens until the infinity location and mark the tape. This gives us the ‘rotation length’ (L) in mm.

Remove the tape from the lens and mark the tape every 10mm, to create a scale, and replace the tape.

The depth of field length can now be estimated from: ((MFD-X)*L*N*C)/(F*F).

In the case of the Sigma lens at F = 12mm, L was 73mm, X = 104mm, (measured) MFD = 250mm, N=8, and I choose an overlap C of 0.02mm.

Giving the near and far depth of field scale length as 12mm, thus all we need to do is cut a length of tape at 24mm and place a mark at the centre. The resulting hack looks like this, which, although not shown below, in this example, is only usable at a focal length of 12mm:

To use the depth of field hack all one needs to do is first ‘calibrate’ the lens by rotating the focus ring until the MFD comes into alignment with the left hand end of the tape. Set focus on the nearest object of interest and capture an image, and use the depth of field hack to rotate the lens until you have captured your perfect focus stack.

As usual I welcome any comments on this post or any of my posts.

No comments:

Post a Comment