How to calculate step size

Have questions about the equipment used for macro- or micro- photography? Post those questions in this forum.

Moderators: rjlittlefield, ChrisR, Chris S., Pau

rjlittlefield
Site Admin
Posts: 23564
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Re: How to calculate step size

Post by rjlittlefield »

JKT wrote:
Wed Feb 08, 2023 2:25 pm
The formula gives the optimal effective aperture. And in the classic macro lens range (down to 1:1) that value is usually reachable throughout the magnification range. That should mean the required illumination is constant as well, doesn't it?
Yes.
The question is how to know what value to set in the camera in order to get that effective f-number? That seems to be more of a problem with Canon, if Nikon shows that one to begin with. :)
As far as I can tell so far, it is a problem with everything except modern Nikon systems. Periodically I ask people to check what their camera does, by seeing how wide an aperture they can specify when their macro lens is at closest focus. So far, Nikon owners are the only ones who report that the widest aperture changes depending on focus.
A quick test seemed to indicate that the numbers given at Photons to Photons are not reliable - if so, they likely don't follow what the aperture really does when magnification is changed.
I would be interested to hear more about the Photons To Photos issue. I have run only one careful test, for location of principal planes in an EF 100mm f/2.8L Macro IS USM, at infinity and at closest focus (HERE), and for that test it matched experiment.

Is there any other way besides brute force (testing every lens at sufficient number of magnifications with even illumination level and then anchoring that to number at infinity focus)?
I do not know of one, for modern lenses with moving elements.

--Rik

ray_parkhurst
Posts: 3417
Joined: Sat Nov 20, 2010 10:40 am
Location: Santa Clara, CA, USA
Contact:

Re: How to calculate step size

Post by ray_parkhurst »

rjlittlefield wrote:
Wed Feb 08, 2023 3:29 pm
Periodically I ask people to check what their camera does, by seeing how wide an aperture they can specify when their macro lens is at closest focus. So far, Nikon owners are the only ones who report that the widest aperture changes depending on focus.
Rik...can you confirm that the Nikon lenses which report effective aperture are doing so based on the shortened FL at CFD? I would assume so, but perhaps the difficulty of doing is why the other makers don't report effective aperture.

rjlittlefield
Site Admin
Posts: 23564
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Re: How to calculate step size

Post by rjlittlefield »

ray_parkhurst wrote:
Wed Feb 08, 2023 5:12 pm
Rik...can you confirm that the Nikon lenses which report effective aperture are doing so based on the shortened FL at CFD? I would assume so, but perhaps the difficulty of doing is why the other makers don't report effective aperture.
I have no definite information about how the camera and lens collaborate to produce and use the aperture numbers. Even the communications protocol between camera and lens seems to be a well guarded secret for the general public.

I would guess that the numbers come from table lookup, possibly combined with interpolation. That guess is because the shape of the curve depends on several details of the lens design and does not necessarily have a simple functional form.

I'm not sure what you mean by "based on the shortened FL at CFD".

The change in focal length, by itself, cannot be used to predict how the effective aperture behaves. Depending on other details of the design, sometimes a bigger change in FL goes with a smaller change in f#, and sometimes it goes the other way.

I will not swamp this post with a plethora of numbers, but for future reference, examples are provided by a symmetric thin lens, versus the two lenses that https://www.photonstophotos.net//Genera ... lBench.htm calls "Nikon 104 mm f/2.88 IF macro (AF-S VR Micro-Nikkor 105 mm f/2.9G)" and "Nikon 103mm f/2.89 IF macro (Nikon Nikkor Z MC 105mm f/d.8 VR S)" .

--Rik

JKT
Posts: 420
Joined: Fri Oct 28, 2011 9:29 am
Location: Finland
Contact:

Re: How to calculate step size

Post by JKT »

rjlittlefield wrote:
Wed Feb 08, 2023 3:29 pm
A quick test seemed to indicate that the numbers given at Photons to Photons are not reliable - if so, they likely don't follow what the aperture really does when magnification is changed.
I would be interested to hear more about the Photons To Photos issue. I have run only one careful test, for location of principal planes in an EF 100mm f/2.8L Macro IS USM, at infinity and at closest focus (HERE), and for that test it matched experiment.
I meant only the aperture values. Everything else should be fine. As on Canon the aperture value is controlled electronically, it is possible to close it down according to a custom curve. If that were done, would Photons to photons know it? Whether that possibility is actually used is another matter. The first test has too many potential error sources to really say much, but there were some oddities.

Before going into them, I'll have to ask one thing: How does defocus affect the exposure calculations ... or does it as long as the illumination covers the image cone at infinity? Whether it does or not, all the full frame lenses gave me roughly the same result at infinity focus. The variation in DPP was 0.05, where 1 means 1 stop difference. The odd part is that the two APS-C lenses gave exactly same number ... but it wasn't the same as FF lenses. It was 0.3 higher than the lowest FF lens. One could have been flashes acting up, but two? Next time I'll shoot 3 or 4 images at each setting. I think I'll keep the infinity vs. 1:1 results to myself until I know better what the defocus does to the illumination calculation.

At 1:1 the illumination level variation for FF lenses was 0.48 with the Canon 180mm being the brightest and Canon 100mm L the darkest. At this setting MP-E was right there between extremes. Here the two APS-C lenses did quite differently. One was brighter than anything else by 0,73 and the other darker than anything else by 0,08. According to Photons to photons, the two APS-C lenses should have given pretty much the same number. Again, it could be the flashes, so further testing is needed.

ray_parkhurst
Posts: 3417
Joined: Sat Nov 20, 2010 10:40 am
Location: Santa Clara, CA, USA
Contact:

Re: How to calculate step size

Post by ray_parkhurst »

rjlittlefield wrote:
Wed Feb 08, 2023 11:08 pm
I'm not sure what you mean by "based on the shortened FL at CFD".

The change in focal length, by itself, cannot be used to predict how the effective aperture behaves. Depending on other details of the design, sometimes a bigger change in FL goes with a smaller change in f#, and sometimes it goes the other way.
Agreed, but my question was a simplified way of asking if the Nikon EA calculation takes these factors into account.

rjlittlefield
Site Admin
Posts: 23564
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Re: How to calculate step size

Post by rjlittlefield »

JKT wrote:
Thu Feb 09, 2023 12:09 am
I meant only the aperture values. Everything else should be fine. As on Canon the aperture value is controlled electronically, it is possible to close it down according to a custom curve. If that were done, would Photons to photons know it?
Bill Claff, author of PhotonsToPhotos, has now joined the forum and has started a topic where this sort of question can be addressed authoritatively. See "The PhotonsToPhotos Optical Bench". The starting post includes "Group motion is never specified so the Focus and Zoom capability in the Optical Bench is interpolation between known states", so I think the answer to your question is no, the bench would not know.
How does defocus affect the exposure calculations ... or does it as long as the illumination covers the image cone at infinity?
Whether there is a focused subject should have no effect. A perfect target would be featureless and uniform, as seen all across the lens aperture. I think it's impossible to tell whether such a target is focused or not. If I were making careful measurements of light transmission, I would set up a sequence of diffusion panels, well separated, then stick the lens close to the last one so that I was using just the smallest possible central area. I would also use continuous illumination, checking first to be sure that the light source was not flickering with some frequency that would play badly with the exposure times. In my own kit the Jansjö LEDs would fit that bill, but not all LEDs are so well behaved -- see the third panel at viewtopic.php?p=137193#p137193 . I would definitely not use flash, since I know that all the ones I have show significant variation between pulses.

I will be interested to hear more about your measurements. Differences between theory and experiment are always nice to know about and understand.

--Rik

rjlittlefield
Site Admin
Posts: 23564
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Re: How to calculate step size

Post by rjlittlefield »

ray_parkhurst wrote:
Thu Feb 09, 2023 9:17 am
my question was a simplified way of asking if the Nikon EA calculation takes these factors into account.
I assume that the final number for effective aperture is correct, so it must be taking all those factors into account somehow.

Whether that is done with some on-the-fly computation, or precomputed and stored in RAM, or measured experimentally and stored in RAM, I have no way to know.

However, quoting from an email that I recently wrote outside the forum:
Just now I did a quick web search on "Exif MakerNote nikon exit pupil". The first hit for that was https://exiv2.org/tags-nikon.html .

That table does list the exit pupil position in the Lens Data 1 and Lens Data 2 groups, but I don't see any other information about the pupils.

However, I do see EffectiveMaxAperture, FocusPosition, and FocusDistance, which I assume refer to the lens's current focus setting. I also see MaxApertureAtMinFocal and MaxApertureAtMaxFocal, plus the corresponding MinFocalLength and MaxFocalLength.

It looks to me like they're treating effective aperture as a specified value, rather than a derived one.

So, my own best guess would be that effective aperture is included directly in the communications protocol between lens and camera. Something like: the lens says "this is the maximum aperture I can have (at the current focus setting)", and the camera says either "then stop down to this effective aperture" or more-or-less equivalently "then stop down this far from your maximum".
I'm also guessing that details of the communications protocol is information that Nikon would keep close, maybe licensing it to third-party lens manufacturers for a king's ransom and non-disclosure.

If anybody knows where the communications protocol is documented, I would be interested to know. Please send PM or email if the information is sensitive.

--Rik

JKT
Posts: 420
Joined: Fri Oct 28, 2011 9:29 am
Location: Finland
Contact:

Re: How to calculate step size

Post by JKT »

rjlittlefield wrote:
Thu Feb 09, 2023 4:18 pm
JKT wrote:
Thu Feb 09, 2023 12:09 am
How does defocus affect the exposure calculations ... or does it as long as the illumination covers the image cone at infinity?
Whether there is a focused subject should have no effect. A perfect target would be featureless and uniform, as seen all across the lens aperture. I think it's impossible to tell whether such a target is focused or not.
That's good to know. It seemed so, but confirmation is nice. I need that to tie down the inifinity value.
I would definitely not use flash, since I know that all the ones I have show significant variation between pulses.
I know, but that is what I have. Knowing that I've taken 4 shots at each setting and then used something like weighted average for the final value. Battery state is out of the equation as they are mains powered. There are also three flashes, which help some.
I will be interested to hear more about your measurements. Differences between theory and experiment are always nice to know about and understand.
I'll try to describe the system. Let's see if you can pick holes I haven't noticed.

The testing part is based on my butterfly & moth rig, which uses three flashes with 120-degree spacing and a diffusor system I designed and had 3D printed for it. It is intended to create even light over roughly a 10cm circle. The picture is taken through 90mm hole in the center. This limits the minimum magnification I can get ... in-focus. It also complicates setting up low magnifications - especially for longer focal lengths. It is a vertical rig, so that doesn't help either.

The shooting part is simple. I just select ISO and flash power settings that don't quite cause over-exposure at infinity and shoot with the magnification I want to and can do. In order to get the magnifications about right, I printed a paper with corner marks for the magnifications I intend to shoot. And as I mentioned, it is four pictures for each magnification.

The analysis of the results starts with DPP. The values in the exposure slider seem to correspond to f-stops, so I'll just increase contrast and put a dot in the curve at 128,128. Then I change the exposure until the right edge of the histogram meets the set point and record the value. That is repeated for each image and magnification.

The numbers for each magnification are then reduced to single value. Those values give out a curve how the exposure behaves as a function of m, but without infinity value, it could not be anchored. So I also take the value with infinity focus with the target not focused. The exposure value from that is assumed to match the f-number I've set for the test series and the others are scaled based on that. Effectively I simply subtract the infinity value from the full set. That gives me a curve, which begins at zero and shows how the effective aperture develops with changing magnification. For my purpose I can then fit a polynomial to it and use those parameters to represent lens behavior.

MP-E poses an additional problem as the infinity value is somewhat hard to come by. For that I've assumed that f/8 with that equals f/8 with another lens. There is some inaccuracy there, but it should not matter as long as the purpose is just to get the aperture value for each magnification. Remembering that, the ultra low-tech approach should be acceptable.

I'll show some results later if there is interest. The behaviour of EF 100 mm L is interesting. :)

4odonates
Posts: 41
Joined: Sun Oct 30, 2022 12:43 pm
Location: Fairfax County, Virginia

Re: How to calculate step size

Post by 4odonates »

I'll start with a few follow-up questions and ask more as necessary.

1. In your post dated Sun Feb 05, 2023 you said ...
The problem is focal length. At 1:1 it likely is not 100 mm. Either you didn't mention which 100 mm macro lens you had or I missed it. In case of Canon 100mm f/2.8 IS USM Macro L, the focal length at 1:1 is 74mm.
I didn't mention the specifics of my Canon 100mm macro lens but you correctly guessed the one I own. Can you explain why the focal length at 1:1 magnification is 74mm? I'm so lost!

2. What's your opinion of the Macro Depth of Field Calculator by PhotoPills? In contrast with the other three calculators I tried, the PhotoPills calculator seems to use some of the same input as Zerene and produces similar output.

Macro Depth of Field (DoF) Calculator | PhotoPills
https://www.photopills.com/calculators/dof-macro

One thing about that calculator puzzles me.

Focusing distance: [example = 225 mm]
Distance from the subject to the camera sensor. It must be at least 4 times greater than the focal length. <— Why? Why doesn't the calculator work when the minimum focusing distance is used?

3. Clearly the step size calculator in Zerene Stacker is better than any of the ones I have discovered (although the one from PhotoPills looks promising). Would you consider making your calculator available online (for free)?

Thanks Rik!
Walter

P.S. - All of the examples that we have discussed so far have been relatively simple and straightforward. (Hah!) What happens to the step size calculation when the macro rig is complicated by the addition of extenders, extension tubes, diopters, etc.?

JKT
Posts: 420
Joined: Fri Oct 28, 2011 9:29 am
Location: Finland
Contact:

Re: How to calculate step size

Post by JKT »

4odonates wrote:
Sat Feb 11, 2023 10:14 pm
I didn't mention the specifics of my Canon 100mm macro lens but you correctly guessed the one I own. Can you explain why the focal length at 1:1 magnification is 74mm? I'm so lost!
That's because the lens is designed to lower the focal length as the magnification goes up. It helps to keep the constant physical size while focusing closer. See Scenario three at Photons to Photons
P.S. - All of the examples that we have discussed so far have been relatively simple and straightforward. (Hah!) What happens to the step size calculation when the macro rig is complicated by the addition of extenders, extension tubes, diopters, etc.?
I seem to recall this exact question was answered somewhere ... was it in Zerene help or in the discussion thread about the calculator development?

JKT
Posts: 420
Joined: Fri Oct 28, 2011 9:29 am
Location: Finland
Contact:

Re: How to calculate step size

Post by JKT »

4odonates wrote:
Sat Feb 11, 2023 10:14 pm
3. Clearly the step size calculator in Zerene Stacker is better than any of the ones I have discovered (although the one from PhotoPills looks promising). Would you consider making your calculator available online (for free)?
Here's one. Its not quite the same even though it is based on same principle. You'll need to download it and install SMath, though. Fortunately that program is free for personal use. BTW, using that will make all the formulas much more simple to read. :)

The downside of that one is it works only for specific lenses. I can add support for the macro lenses I have, but that will be it. On the second page there is a test how to handle TC:s. That's the first idea, but I wouldn't be surprised if it were correct. Extension tubes would be a bit more problematic. They likely require two more fitted functions (P & f) and an iterative solution. It would be much easier to answer question what happens if you ADD extension to a known m than to solve the situation if the final m is the input"

rjlittlefield
Site Admin
Posts: 23564
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Re: How to calculate step size

Post by rjlittlefield »

4odonates wrote:
Sat Feb 11, 2023 10:14 pm
What's your opinion of the Macro Depth of Field Calculator by PhotoPills?
It has some aspects that bother me a lot. See below...
One thing about that calculator puzzles me.

Focusing distance: [example = 225 mm]
Distance from the subject to the camera sensor. It must be at least 4 times greater than the focal length. <— Why? Why doesn't the calculator work when the minimum focusing distance is used?
It's because in the thin lens model, 1/f = 1/o + 1/i, so the distance between object and image can never be less than 4 times the focal length. This occurs at 1:1 magnification when o = i = 2f.

Unfortunately, the thin lens model is notoriously inaccurate for modern lenses used at close focus distances, partly because in modern lenses the focal length is not fixed, and partly because there is often significant distance between the two principal points from which focus distances have to be measured.

The fact that the calculator imposes what appears to be a thin lens restriction is puzzling, since it's not difficult to get around simply by allowing magnification as an input.

But indeed, that seems to be what it's doing. I cannot see any way to specify magnification directly. Instead, it seems that the only control is to specify "focusing distance", which the calculator then uses to infer magnification using 1/f=1/o+1/i. In addition to the issues of variable focal length and separation between the principal planes, the calculation seems to allow only magnifications less than or equal to 1. If it did allow for magnifications greater than 1, then there would be an ambiguity because the object-to-image distance is the same for magnifications m and 1/m.

Ah, I see that a deep dive is possible. The calculator can be embedded in other web pages, which means that its inner workings can be observed. I see a script at //photopills.com/widgets/ppdofmacro.min.js, which with some reformatting can be read. And yep, it looks like the calculator computes m based on thin lens assumption, then either uses the specified effective aperture or computes effective aperture using the usual correction for pupil magnification factor, then computes DOF using the usual 2*C*Feff/m^2. That last part is fine; the problem is the thin lens stuff before it.
3. Clearly the step size calculator in Zerene Stacker is better than any of the ones I have discovered (although the one from PhotoPills looks promising). Would you consider making your calculator available online (for free)?
I'll take a look at that. In the meantime, if you can handle an Excel spreadsheet file, see viewtopic.php?p=126606#p126606 (in "A new way of thinking and calculating about DOF"). That provides an explanation and a link to the spreadsheet. If you want to actually use the spreadsheet then you'll have to download it, possibly overriding anti-malware protections, and enable editing. But the posting alone shows the formulas that are used, and the surrounding thread explains why they work. The formulas are not quite up to date, but the differences are insignificant for anything you'll be doing. In the spreadsheet, effective f-number is only computed. If you want to enter effective f-number directly, then you can just replace the formula with a number, but in that case don't save the spreadsheet or you'll wipe out the formula until you do a fresh download.
What happens to the step size calculation when the macro rig is complicated by the addition of extenders, extension tubes, diopters, etc.?
The whole calculation is driven by magnification, effective aperture, and COC if provided. See the "FAQ: How can I calculate effective aperture?" for a plethora of ways to do that, depending on setup.

--Rik

Edit Feb 13, 2023, to fix erroneous statement about pupil factor in thin lens model.

4odonates
Posts: 41
Joined: Sun Oct 30, 2022 12:43 pm
Location: Fairfax County, Virginia

Re: How to calculate step size

Post by 4odonates »

I downloaded your "DOF Two Ways" spreadsheet, Rik, and I'm pleased to report it runs on my ancient iMac (2009 vintage).

I think I have all the input necessary for the yellow fields except "pupil factor." I assume (never a good idea) pupil factor refers to the ratio between the entrance- and exit pupil for a given lens. Where can I find that info? (A quick Google search was fruitless.)

When I asked for help with determining safe step size, I NEVER imagined the process is so complicated. I'm trying hard to understand the detailed technical guidance that has been provided but sometimes I feel like I'm in way over my head. Sincere thanks for your patience with me!

Walter

rjlittlefield
Site Admin
Posts: 23564
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Re: How to calculate step size

Post by rjlittlefield »

4odonates wrote:
Mon Feb 13, 2023 6:16 pm
I downloaded your "DOF Two Ways" spreadsheet, Rik, and I'm pleased to report it runs on my ancient iMac (2009 vintage).
Excellent. Are you running it inside Excel, or some other application that knows how to read .xls files?

I think I have all the input necessary for the yellow fields except "pupil factor." I assume (never a good idea) pupil factor refers to the ratio between the entrance- and exit pupil for a given lens. Where can I find that info? (A quick Google search was fruitless.)
Yes, it is exit pupil diameter divided by entrance pupil diameter.

We have another whole topic for that, "FAQ: What is "pupil ratio" and why would I care?"

When I asked for help with determining safe step size, I NEVER imagined the process is so complicated.

I'm trying hard to understand the detailed technical guidance that has been provided but sometimes I feel like I'm in way over my head. Sincere thanks for your patience with me!
Trust me, I totally sympathize.

I've been trying to understand how to calculate depth of field for almost 50 years. When I started, the best available reference was a 1960 paper that spent most of its effort on modeling properties of film, paper, and enlarging lens aberrations that are no longer relevant. The paper did not deal with numerical aperture or pupil factor or what units the camera uses to set the lens aperture, all of which we now consider important factors because of the large variety of optics that we use. In addition I later learned that the paper's model for how diffraction interacts with other blurs was not physically correct, and there was a mistake in the algebra caused by swapping "m" and "M" at one point. Nonetheless the primary output of the paper, a series of nomographs for choosing optimum aperture, validated as "close enough" by practical experience. I used and extended those curves for many years.

But times change. As the technology has evolved, much of what used to matter no longer does, and new issues have come up to replace them.

All the while, a few fundamental principles have held true:
  • if you stop down too far, your image gets blurred from diffraction;
  • if you don't stop down far enough, your image blurs quickly rom defocus;
  • and in possibly the most important words of the paper, "The circle of confusion is the most aptly named factor in photography."
Please feel free to ask. The more times I have to explain, the better I understand how to do that.

--Rik

4odonates
Posts: 41
Joined: Sun Oct 30, 2022 12:43 pm
Location: Fairfax County, Virginia

Re: How to calculate step size

Post by 4odonates »

I wrote a long reply that seems to have disappeared. I thought I clicked "Submit." I don't want to have to attempt to recreate the message -- PLEASE tell me there's a way to retrieve a draft version of the message!

Walter

Post Reply Previous topicNext topic