Z8 - Focus-shift + Pixel-shift tests

PLShutterbug

Veteran Member
Messages
6,664
Solutions
11
Reaction score
10,667
Location
US
Sorry guys - this is a really, really long setup and quite a few images ... of a ruler. Sorry - my beautiful model wouldn't sit still as long as this took to do.

After Gordon Ripley posted his thread about focus-shift shooting, I finally decided to get methodical about figuring out focus-shift. Then I went a bit crazy and duplicated the most successful focus-shift set with 4, 8, 16, and 32 pixel-shift images per shot, too, using the new PS-within-FS feature from firmware version 3.0.

I ended up with 4,024 JPG, NEF, and NEFX files comprised of the images I shot, plus the NX Studio-created pixel-shift NEXF files, and the focus-stacked final images. 127GB of images.

To save a bit of time post-processing, for the focus-shift shooting only sets I shot DX-format JPGs. Sharpness isn't much affected whether it's RAW or JPG.

For the pixel-shift tests, of course I ended up with .NEF source files (again DX), .NEFX pixel-shifted images assembled from the .NEF sets, and final images I saved as .JPGs.

I used Affinity Photo v2.63 on a Windows machine (13th-gen i7, NVidia RGX 3060 with 12B RAM, 64GB computer RAM, and 512GB SSD as my OS and primary work drive). I ran out of room twice on the SSD so had to keep moving things off to my SAN.

Here's what I did. I took a 17" (43cm) steel ruler marked in 1/32" and millimeters, set it on a box about 5" (12cm) in front of the camera, mounted my Z 50mm f/1.8S lens, and shot everything with manual exposure: ISO 500, 1/50s, f/5.6 under LED lighting. A plain white wall was about 18" (45cm) behind the scene.

I focused the lens at its minimum focus distance (MFD), and shot different focus-shift sets using the "Reset to starting focus distance" toggle turned ON.

I shot different focus-shift sets at focus-step intervals of 1, 3, 5, 7, 9, and 10 to determine the number of exposures it took to step from MFD to the end of the ruler, and still keep every indicator on the ruler in focus in the final focus-stacked image.

After doing that I thought I was seeing some moiré, so ... what the heck. I'll do this over again at the setting that ended up with everything sharp in the final focus-shift, but introducing 4, 8, 16, and 32 pixel-shift sets per focus distance. Turns out that, for this test, that is a focus step interval of 2, and 55 images.

In the first tests I shot 15 images at step intervals of 1, 3, 5, 7, 9, and 10 to determine how far out the lens focuses starting at MFD and then stepping those intervals. Here are the results after focus stacking in Affinity.

From MFD, 15 frames at step width 1.
From MFD, 15 frames at step width 1.

From MFD, 15 frames at step width 3.
From MFD, 15 frames at step width 3.

From MFD, 15 frames at step width 5.
From MFD, 15 frames at step width 5.

From MFD, 15 frames at step width 7.
From MFD, 15 frames at step width 7.

From MFD, 15 frames at step width 9.
From MFD, 15 frames at step width 9.

From MFD, 15 frames at step width 10.
From MFD, 15 frames at step width 10.

Then I tried staying at a step width of 10 and simply shooting more frames. I kept the step width at 10 but set the shot count to 25. What happens? Turns out, the camera stops taking images when it cannot focus anymore. I ended up with 19 frames.

From MFD, attempt at 25 frames at step width 10; 19 frames resulted.
From MFD, attempt at 25 frames at step width 10; 19 frames resulted.

What I discovered from this series is that yes, I can cover the entire ruler with just 15 shots - but focus would go slightly in and out because I had to make the step width too wide. So, my next set of tests determined the maximum step width I could use - to minimize the number of shots required - while still ending up with a focus stack where every point on the ruler is sharp. Turns out that for this subject, it's a step width of 2 and 55 frames. Don't take away from this that "If I want everything sharp when I and doing focus-shift shooting I need to do 55 frames at a step width of 2"!!!!! No. That's incorrect. For this subject, using this lens, at this starting distance, using this aperture, it required that many frames at that step width. Don't reply to this thread asking me, "how many frames do I need, and what step width, for my kitten?" Two answers to that: 1) kittens move too fast. You can't do a focus stack of a live kitten. Unless it's asleep. Then you might get lucky. And 2) No one knows and no one can tell you. You have to experiment, and you have to arrive for each focus-stacked image at a FSS setting that you think works. Here is the final image focus-stacked from 55 images at a step width of 2:

From MFD, 55 frames at step width 2. Everything to the end of the ruler is sharp, but if you look at the ruler ticks you can see some moiré.
From MFD, 55 frames at step width 2. Everything to the end of the ruler is sharp, but if you look at the ruler ticks you can see some moiré.

But again, I noticed what looked like moiré in the ruler, so I started messing with pixel-shift. I took that width 2/55 shots and shot sets with 4, then 8, then 16, then 32 pixel-shifted images at each focus distance. (It's pretty cool listening to the Z8 shutter sound banging away for 1,760 images).

This ended up with 55 sets of 4 images = 220 NEF files. Then I used NX Studio to pixel-merge each set into its own NEFX file. Then I exported each NEFX file to JPG at quality 85, at the original DX resolution. Finally, I did a focus merge in Affinity Photo to arrive at the final image.

Here you go:

From MFD, 55 frames at step width 2, with each focus distance pixel-shifted for 4 total exposures. 220 total exposures.
From MFD, 55 frames at step width 2, with each focus distance pixel-shifted for 4 total exposures. 220 total exposures.

Fom MFD, 55 frames at step width 2, with each focus distance pixel-shifted for 8 total exposures. 440 total exposures.
Fom MFD, 55 frames at step width 2, with each focus distance pixel-shifted for 8 total exposures. 440 total exposures.

View attachment 72c62013e300484d8c4bd5b521f73f92.jpg
From MFD, 55 frames at step width 2, with each focus distance pixel-shifted for 16 total exposures. 880 total exposures. Note the 4x resolution increase.

View attachment 2dc407efa6814ab9af51e4fb7967cf11.jpg
From MFD, 55 frames at step width 2, with each focus distance pixel-shifted for 32 total exposures. 1,760 total exposures. Note the 4x resolution increase.

Other learning: NX Studio doesn't like lots and lots of images in one folder. I ended up manually editing the .NikonImageInfo.NXF file that tracks the images so I could split those 1,760 files into four sets so it was manageable in NX.

I hope this is useful to someone. And don't ask me to do it again!
 
Wow. That is one way to spend a rainy day. I don't think I'd have the energy for all that.
 
Wow. That is one way to spend a rainy day. I don't think I'd have the energy for all that.
Most of the work was setting it up and figuring out the methodology. One I got that, it was a matter of letting the computer grind away.
 
Very much appreciate this entry. I will go over it in detail. A lot of work on your part and I am sure that I am not the only one who is thankful.

Gordon Ripley
 
Thank you for a very painstaking test This might be a dumb question but why is the near end of the ruler never in focus? Isn’t the point of a focus stack to have the entire object in focus from near to far?
 
Thank you for a very painstaking test This might be a dumb question but why is the near end of the ruler never in focus? Isn’t the point of a focus stack to have the entire object in focus from near to far?
Good question.

This wasn’t to create an image of the entire ruler in focus but to illustrate the effect of using different focus step widths. I was fine with the front of the ruler being out of focus. Part of this was to test the accuracy of returning to the initial focus position between sequences. I couldn’t do that if I tried to get the entire ruler in focus.
 
Thank you for a very painstaking test This might be a dumb question but why is the near end of the ruler never in focus? Isn’t the point of a focus stack to have the entire object in focus from near to far?
Good question.

This wasn’t to create an image of the entire ruler in focus but to illustrate the effect of using different focus step widths. I was fine with the front of the ruler being out of focus. Part of this was to test the accuracy of returning to the initial focus position between sequences. I couldn’t do that if I tried to get the entire ruler in focus.
Makes sense. Thanks.
 
Thanks for the tests and account of the results. I have enjoyed working with the FS/PS process. I take the NEFX files to Photoshop for stacking. I found your comments and examples on the width settings very helpful.
 

Keyboard shortcuts

Back
Top