Nikon Learn & Explore
Advanced

Focus Shift, the Basics: Stacking Focus

Focus Shift: what it does and how to use it

The D850’s handy “focus shift” feature is used chiefly to create the images for focus stacking, which are then combined in optional third-party software to create a final image with extreme depth of field.

The technique of focus stacking allows you to enhance the depth of field in an image by taking a series of shots and generating a composite image consisting only of the areas that are in focus. Although dedicated focus-stacking software has been around for a while, the hard part was getting suitable high-quality image files.

Specifically, what was difficult was taking a series of photos while changing focus a small, fixed amount with each shot. It used to be hard to change focus by the same amount with each shot, and unless you finished shooting quickly, there was a chance that the light would change or some other difficulty might arise, resulting in photos that were not suitable for focus stacking. This is precisely the sort of difficulty the D850’s “focus shift” feature, which automatically varies focus by a set amount over a set number of shots, was designed to solve.

When it comes to focus stacking, it might seem natural to ask, ‘Why go to all that trouble when you can just stop the aperture all the way down?’ but it’s not that simple. Given the same aperture and a lens focal length chosen to produce the same picture angle, the large image sensors in FX format cameras and the like will show a shallower depth of field than smaller sensors, so you really have to stop the aperture down to get a deep depth of field. And stopping aperture down increases diffraction, resulting in pictures that lack definition.

In these circumstances, the way to get good depth of field without stopping the aperture down so far that pictures lose definition is by focus stacking.

photo of a flower taken using focus stacking in the D850 DSLR

Focus step width: 1; number of shots: 36 (taken with the D850)

photo of a landscape taken using focus stacking with the D850 DSLR

Focus step width: 2; number of shots: 11 (taken with the D850)

Adjusting Settings

To adjust focus shift settings, go to the photo shooting menu and select Focus shift shooting. The options available include No. [number] of shots, Focus step width, Interval until next shot, Exposure smoothing, Silent photography, and Starting storage folder (with sub-options of New folder and Reset file numbering), but the ones with the greatest influence on how focus stacking turns out are Focus step width and No. of shots. And although they aren’t in the menu, other important factors are aperture and the starting focus position.

The Focus shift shooting menu screen on the D850

The Focus shift shooting menu on the D850

The Focus shift shooting menu screen on the D850 showing the various settings that can be adjusted.

The Focus shift shooting menu on the D850 showing the various settings that can be adjusted.

Aperture

Because we don’t need to worry about getting a deep depth of field with a single photo, we can instead consider how aperture can be adjusted to produce a high-resolution, high-definition image with each shot. Specifically, we need to think about the aperture at which the lens performs best. If diffraction were our focus, it could be minimized by shooting at maximum aperture, but, given the characteristics of the lens, a setting two to three stops lower, say f/2.8 to f/8, is in fact generally best if we also want to keep the definition image high right up to the edges.

Starting focus position

Using focus shift, the camera takes a series of shots starting from a selected focus position and continuing toward infinity. Choose a starting focus position either at or slightly in front of the closest point of the section of the subject that is in the desired depth of field.

Focus step width

You have a choice of ten focus step widths, ranging in value from 1 to 10. The amount the focus distance changes with each shot is not determined solely by the focus step width but is calculated by the camera based on a variety of lens data, including focal length and aperture, so it’s probably best to experiment until you get the hang of it.

The mistake people make in choosing the focus step width is to pick one so large that some areas in the focus-stacked image are out of focus. To prevent this, a focus step width of 5 or less seems safe.

Focus shift photography itself is very easy and there is no need to worry about taking too many shots, so you can even choose a focus step width of 2 or 3 for images you want to print at a large size.

Number of shots

The number of shots can be set to values between 1 and 300. You’ll generally need over a hundred shots to cover the desired field depth when photographing an insect or other small object using macro photography at the settings described above, namely an aperture of f/5.6 and a focus step width of 2 or 3. On the other hand, to cover a landscape starting close to the camera and extending into the distance, you need only take a few shots, particularly if you're using a wide-angle lens, as the depth of field of each of the individual photos will already be quite deep.

The D850’s focus shift function includes a feature that automatically ends shooting when the focus distance, which increases with each shot beginning from the starting focus position, reaches infinity, so you needn’t worry that it’ll take a bunch of photos you don’t need after infinity is reached. It can be tricky to choose the minimum number of shots needed based on the lens focal length or focus step width, but you can take some of the pressure off during shooting by taking a large number of photos with the idea that you can choose the ones you want during focus stacking.

Other settings: interval between shots, exposure smoothing, silent photography, and starting storage folder

Starting with the interval between shots, “zero” is basically a good choice. With the interval set to zero, the camera starts shooting the next photo as soon as the previous one is finished, meaning that the focus-shift series can be completed in the minimum amount of time. Longer intervals are only needed to force the camera to wait when, for example, each photo uses the flash and you need enough time between shots for the flash to charge. Zero can be considered the best choice in all other cases.

Exposure smoothing adjusts exposure to smooth out changes in subject brightness that may occur during shooting, but really you want all the photos in a focus stacking sequence to be shot under the same lighting and other conditions in the shortest possible period of time. The default setting of “Off” is recommended in most situations, but you can choose “On” if you have no choice but to shoot under changing light conditions.

When using focus shift, you’ll mostly be photographing stationary subjects with the camera on a tripod, and you can either choose silent photography or shoot with the regular mechanical shutter.

The Starting storage folder menu contains two options: New folder and Reset file numbering. Performing focus stacking after shooting is easier if all the photos in each focus shift series are in the same place, so it’s probably best to select New folder and reset file numbering to 1.

focus shift shooting menu screen, showing where you can adjust the focus step width.

In the focus shift shooting menu, you can adjust the focus step width.

D850 focus shift shooting menu showing new folder checked

In the focus shift shooting menu, you have the option of choosing a new folder and resetting the file numbering to 1.

Other settings for focus shift photography

You’ll want to disable any features that could interfere with the many operations the camera must perform during focus shift photography. If focus shift options are greyed out, or the camera says shooting can’t begin when you go to start focus shift, check the following settings. Focus shift settings will also be greyed out and unavailable when no memory card is inserted, so insert a memory card before adjusting settings.

movie live view: switch to live view photography

HDR: turn HDR off

focus mode: select AF

interval timer shooting: end interval timer shooting

auto bracketing: disable auto bracketing

multiple exposure: end multiple exposure shooting

photo of a group of frames showing pictures of a Nikon lens that was photographed using focus stacking in the D850

Select the photos you’ll use for focus stacking from the many shots you took at different focus positions, starting with the closest and ending with the farthest.

image of lens barrel with very shallow depth of field

You can see that each photo has an extremely shallow depth of field. This frame was shot using the AF‑S Micro NIKKOR 60​mm f/2.8G ED on the D850; set to an aperture of f/4.8.

Once all images are shot, you will need to select the photos to use for focus stacking from the many shots you took at different focus positions, starting with the closest and ending with the farthest.

If you zoom into the individual images, you will see that each photo has an extremely shallow depth of field.

Shot of a Nikon lens barrel, in focus, using focus stacking software this photo of the lens barrel

Using focus stacking software, an image was created in which the entire nameplate is in focus.

photo extremely zoomed in showing in and out of focus areas of the image that was created using focus stacking. Visible only at 400% to 800% zoom.

The strips of in- and out-of-focus areas are visible at four- or eight-hundred percent zoom (f/4.8 with a focus step width of 10).

Using focus stacking software, you can create an image in which the entire subject is in focus.

If the focus step width is too wide, the image will be made up of alternating strips of in-focus and out-of-focus areas. These however will be largely invisible except when the image is zoomed in at an extreme zoom of 400% - 800%.

Focus Stacking

The focus-stacking process begins post-shooting with image selection. Each sequence will no doubt contain extra photos you took just in case but that were not shot at focus distances needed for focus stacking. Use software such as Nikon’s View NX-i to view the photos and select the files you want from each sequence.

Focus stacking is generally performed using Adobe Photoshop or other generic image-processing software or dedicated stacking software such as Helicon Focus from Helicon Soft or Zerene Stacker or Combine ZM from Zerene Systems.

The software will render the final image.

The Helicon Focus software rendering display, software window with a shot of a diorama that was shot using focus stacking

The Helicon Focus software rendering display.

End result image of a diorama after focus stacking software was used to combine images, shot with the D850.

Photo taken with the D850: focus step width: 2; number of shots stacked: 100.