Focus Stack Calculator
This calculator computes the number of frames needed to make a focus stack with a focus shift specified in the focus step field that covers from the starting distance to the ending distance.
Please note, this calculator is still in beta and may not provide accurate results in all conditions.
Usage
Distance | Units |
---|---|
500 | millimeters |
500 mm | millimeters |
5m | meters |
30.6” | inches |
3’ | feet |
3.6’ | feet |
3’4” | feet and inches |
To use the calculator enter your lens’s focal length, the aperture you will be shooting at, whether or not you have the camera set to APS-C crop mode, the focus step size you’ve set, and the starting and ending distances for the stack you want to shoot.
Distances are a free form number that’s parsed by the script and can be specified in either feet, inches, feet and inches, meters, or millimeters. See the following table for examples
Assumptions and Theory
I’ve made two major assumptions in the development of this too. First relates to the size of the focus shift between images. Canon calls this “focus increment” on cameras such as the EOS R5. Nikon calls this “Focus step width” on cameras such as the Z6 II and Z7 II. My assumption at the present time is that the focus steps are equal to 1/8 of a depth of field.
I made this assumption for two reasons. First, 1/8 of a depth of field has historically been the size of the smallest AF increment available on Canon cameras. It’s what an AF micro adjustment step was, as well as the smallest shift you could make when remotely controlling the focus via Canon’s EOS Utility.
I’m fairly confident in the accuracy of this assumption, as in my testing a focus increment of 8 on my EOS R5 corresponds to a focus shift that’s approximately 1 depth of field deep.
The second assumption deal with the acceptable threshold for the depth of field. Namely I’m using the same standard that most camera manufacturer’s use when they calculate depth of field. This formula can be traced back to film photography and in some respects may be insufficient for modern high resolution digital cameras — at least in some applications.
With those assumptions in hand, I calculate the depth of field for the specified lens, aperture, crop size, and initial (close) focus distance. Then shift the focus position towards infinity by “focus step” × 1/8 of that depth of field. This process is repeated until either infinity is reached, 999 steps have been taken, or the specified far depth of field limit has been reached.
Comments
Hi,
I tried your webapp. It is not working.
I can’t choose an aperture. Dropbox doesn’t open, no value is selectable.
If needed, I can, will help you in coding this (if it is php)
Otherwise, nice thing to have, use.
Sorry about that, boneheaded move on my part, I didn’t properly link a required JavaScript file for production.
It should work now.
Sorry, but it is not working.
When I check the JS, no values are available in the combobox ‘Aperture’. Maybe there is a mistake in the name ? Using or not using a captial ?
On the HTML-page, normally, in a dropdown (select) possible options are added. They are missing here.
f/
select id=”aperture” class=”updtrig” name=”aperture” data-mini=”true” style=”width:5em”
/select
Should be:
select
option 1
option 2
…..
/select
1) What browser are you using? (Try a different one if you have another installed.)
2) Are you running a content/ad blocker? (I don’t actually care if you do, but make sure that it’s not blocking scripts from http://www.pointsinfocus.com, static1.pointsinfocus.com, or jquery from cdnjs.cloudflare.com)
3) Have you flushed your browser’s cache and reloaded the page? (The HTML is the only thing that changed, and that shouldn’t be cached. Loading the page with the developer console open should also force the browser’s cache to be ignored.)
The contents of the Aperture select box are generated by the JS doing the calculations. If it’s not generating then the odds are that there’s a JS error that’s causing the execution of the scripts to halt/fail to execute. Check your JS console, and see what warnings are showing up. Unfortunately, I can’t seem to reproduce the problem on my end, and I’ve tested the page in Chrome (win & macos), Edge, Firefox, and Safari (macos & ios).
I’d like to get to the bottom of this if I can, as I do consider this to be in beta; so it’s possible that there’s a bug I’m simply not seeing and I’d like to fix that.
Thanks for the technical explanations and the tool, it appears to be working for me. One question I have is, Can the camera be used to drive a flash for each of the images? I think this would slow down the capture sequence.
That would depend on the brand and specific camera, but you’re right firing the flash will significantly slow down the bracket shooting.
Most Nikon cameras have the ability to fire the flash but require you to set a custom timeout (I believe the minimum is 1 second) between exposures. Canon’s mirrorless cameras simply don’t support using the flash and focus bracketing. I have no idea off hand what the situation is with Fuji, Panasonic or Sony.
That said, you’d have to check your camera’s manual to be sure.
Ya, I have an R5. I think it is a neat new feature (for me), and I have been doing a lot of testing with it, planning for a shot. I might next look into some constant lighting. Thanks.
You have black text set on a dark grey background. Very, very hard to read.
Sorry about that. It was due to the way that the dark theme for the main site interacted with the iframe for the calculator. I’ve put in place a workaround for the time being that will always keep the calculator as black text on white.
Thanks for your work on this and other subjects. I’m trying to get wise about Fuji’s focus bracketing algoritm and your article helps a lot. However, in your “beta calculator” there is a box “add to above” which I don’t get. Ticking it increases ther numbere of exposures significantly, but I find no explanation of its why and how. Could you comment on this?
The “add to above” box causes the second distance to be added to the first for the calculation instead of being used as is. When it’s ticked, you can think of it kind of it like specifying the depth of field you want captured in the second distance box.
So if you need for example a focus stack from 1m to 6m, you can specify it 2 ways. First, you can set 1m and 6m as the two distances. Alternatively, you can set 1m as the first distance, and 5m with the add to above box checked as the second.
Clear. Thanks & regards, Bote
Great to find a calculator like this, just what I am looking for. There is a Nikon article with some specific tables, but I cannot match the numbers in those tables with the results of your calculator. Can you help me understand the issue? Thanks!
google: useful d850 focus stacking tips
https://nps.nikonimaging.com/technical_solutions/d850_tips/useful/focus_stacking/
That could be the result of a couple of things.
One is that Nikon may use different “steps” than my calculator assumes. I assumed that steps are fractions of depth of fields, since that seems to be what Canon cameras use (as the focus distance changes change with different aperture settings and subject distances). If Nikon’s steps are just AF motor increments, that would result more images being needed to cover the same area. There is the comment in the article about problems with the step width when it’s greater than the depth of field, indicating that the step width may just be AF motor steps.
Additionally, I used standard DoF calculations, which don’t always hold up well at macro magnifications. It’s entirely possible that Nikon’s using more accurate lens specific calculations that take into account the effective focal length changes due to both close focusing and focal length changes from internal/rear focusing designs to get more accurate numbers for those tables.
That said, I’m not 100% sure any of this is 100% correct — none of the camera makers actually disclose exactly how their focus bracketing works and what the focus step setting is doing so everything has to be reverse engineered which is not error free. Additionally, I only have a limited amount of gear that I can test with, and what I came up with seemed to work for my Canon gear, but that’s not guaranteed to be universally true.
Please add the ability to set the circle of confusion or pixel pitch size or even camera details to make your great tool more useable.
I find this fascinating. Thanks for the work and making it available.
From your comments am I right in assuming that for a normal circle of confusion a focus step of 8 should be sufficient as the far focus limit of one image would just meet the near focus limit of the next image. Using a lower focus increment would merely provide a tighter circle of confusion. If the normal circle of confusion is sufficient then why would you take more image? Does the software used to combine the images do a better job with more images?
Minimising the number of images has significant implications for hand holding with focus stacking. As you get older you avoid tripods like the plague.
There are definitely cases where more images at smaller increments is necessary (e.g. macro, product photography, archival/research imagery).
Remember, the circle of confusion is ultimately a projection of our visual acuity to a standard enlargement factor. When you deviate from those assumption (say by cropping, or when you need to analyze the image at high magnification) then you need to use a smaller CoC to meet the visual acuity requirements and as a result will want to use smaller steps in a focus stack. Likewise, if you’re making reference/research images that will be studied at high magnifications, then the subtle changes in focus from a larger step size can become problematic.
Do you measure from the front of the Lens glass element? or from the sensor?
The calculations are done from the sensor. However, there is some error in that since a real lens is not an ideal lens and therefore takes up actual space. For the most part you should be fine measuring from the sensor, but you may run into problems at very small subject distances (e.g. macro magnifications) where the distances is less than maybe 5-10 times the focal length or so or in very high macro (e.g. with a microscope lens) situations.
Thanks for this calculator! I’m going to be transitioning from a Canon SLR with Magic Lantern, which lets you preview focusing through your subject and easily determine the number of steps needed for your desired distance , to focus bracketing with a Canon R7. Hoping this will be helpful in adapting to not having a preview, but also wondering if the 1.4X magnification factor of the Canon RF 100mm macro would necessitate any adjustment (e.g. using 140mm instead of 100mm)?
Yes, if you’re using a teleconverter then you have to specify the final/converted focal length (e.g. 100mm lens + 1.4X TC = 140mm).
Thanks for the prompt reply. Just to be clear, I’m not talking about a using a teleconverter, as the Canon RF macro does 1.4X natively. So am I to understand that it should be treated as a 100mm with teleconverter for this calculator?
Sorry I misread what you said. Magnification doesn’t affect the focal length (at least in so far as can be reliably handled by my calculator) so no, you’d just use the lens’s focal length.
Technically, at least for most lenses (likely including the 100mm macro) the angle of view and therefore the focal length will change with changes in focusing distance, but the exact behavior of that is specific to each lens design so without profiling each lens there’s no way for me to deal with that in the calculations. That said, for high magnification macro work, you might need to use a smaller focus step size than is expected do to that effect.