- Ed Dozier
How to Test Your Lens for Focus Shift
Have you ever had a lens that you’d swear you had perfectly focus-calibrated, only to experience lots of missed-focus shots? It might not be your fault. Many zoom lenses change focus at different focal lengths, yet you can only perform a focus fine-tune calibration at a single focal length. Lenses with really fast apertures (like f/1.4 and f/1.2) typically have significant spherical aberration, which causes the focus to shift as you stop down the aperture.
The MTFMapper program lets you measure how much your lens shifts its focus, if you use the proper chart. You can even do this evaluation at different color wavelengths, if you desire. I’m using MTFMapper version 0.7.11 in this article. This program is available here . The program author is Frans van den Bergh, and he has a very firm grasp on this problem.
Focus shift caused by spherical aberration
The picture above shows what you’re fighting with most high-speed lenses. As you change the aperture, the focus shifts. The best you can do is to focus-calibrate your “phase detect” autofocus system to correct for focus errors at a single selected f-stop (typically wide open). If your camera could focus at the stopped-down aperture, then you wouldn’t notice any focus shifting. Most cameras keep the aperture wide-open while focusing, however, and only stop down the instant you take the picture. If you use “live view” at the working aperture, then focus shifting isn’t a problem; it’s just a “phase detect focus” problem. If you use a mirrorless camera that is only focusing with the aperture wide-open, then this problem can still plague you. Some mirrorless cameras actually focus at the stopped-down aperture, and thus avoid this problem.
To perform the focus-shift test, you’ll need to start by printing out a “focus” chart. Mount the printed chart on flat stock, or else tape it to a wall. Your lens should be pointed at the exact center of the chart, while the chart is rotated at 45 degrees relative to your camera sensor. This way, some of the chart both in front and behind its centerline will be out of focus.
The “focus” chart in its vertical orientation
The chart side with the taller slanted bars should be oriented farther away from the camera. If you print the chart at the right size (e.g. A3) and mount it at the correct distance, then perspective distortion will make the bars appear to be the same size. You can choose either horizontal or vertical format. The chart shown above (focus_a3.pdf) comes from the downloaded zip file called “mtfmapper_sample_test_charts_0.5_v4.zip”. The exact center of the chart lies along the dashed lines with the pair of black circular fiducials (with the tiny white centers).
Typical focus chart result
The Measurement Recipe Steps
Place your camera on a tripod, pointed directly at the center of the rotated chart.
Set your camera to “manual focus”, and RAW capture.
Start with the widest aperture (camera in aperture priority or manual), like f/1.4.
Set your exposure to get about +0.7 stops compensation (whiter chart whites).
Enable “live view” at maximum magnification.
Manually focus the lens on the exact center of the chart.
Disable “live view”.
Take the picture.
Close down the aperture by a stop, like f/2.0. Don’t touch the focus!
Take the picture.
Repeat taking shots at smaller apertures, like 2.8, 4.0, 5.6, if desired.
Analyze the results
Run mtf_mapper_gui.exe.
Click on “Settings | Preferences”
The Preferences Dialog
Set the correct preferences for your camera. Note that the “Output types” selections will be ignored by this program for these focus tests.
You can select “none” (luminosity) or “red”, “green”, or “blue” for the focus measurements; I’d recommend the “none” option here.
Click the “Accept” button to leave the Preferences dialog.
Click on “File | Open Focus Position image(s)…”
Browse to the folder with your (RAW) shots of the “focus” chart.
Select the desired picture(s) to analyze.
Measurement results up close f/1.4 with focus at +9.7 mm
The screen capture above shows a typical measurement result. The highest resolution was located at +9.7 mm from the chart centerline, with an MTF50 reading of 0.145 cycles per pixel. The left side of the chart was nearer to the camera, so the shot was taken with the sharpest focus nearer to the camera by +9.7 mm. It’s actually pretty tough to manually focus better than within about 10 mm at this distance (1.19 meters).
By comparing the “+9.7 mm” result with another shot at a different aperture, the focus shift can be directly measured.
I was a little curious if the millimeter measurements from the MTFMapper were accurate. The focus test chart here is printed at 11.7” X 16.5” (A3), and vertical blue “sharpest focus” line is located about 7 hash marks from the chart centerline. Those 7 hash marks were measured to be 14 mm along the surface of the chart. Since the chart was rotated to 45 degrees, where cos(45) = 0.7071, then the image measurement should be about 14 * cos(45) or 9.9 mm. Pretty close to the reported 9.7 mm!
Same setup, but f/2.0 causes focus to move to +5.1 mm
With the exact same setup as the f/1.4 shot, the f/2.0 shot has shifted focus away from the camera by +4.7 mm, landing on +5.1 mm from the chart centerline. The camera was in manual focus, and I didn’t touch the focus ring as I stopped the lens down. The focus shift is purely a result of spherical aberration.
f/2.8 shot, now focus is now at -1.7 mm
Stopping down to f/2.8, the focus shifted again, now landing on -1.7 mm. It has shifted a total of +11.4 mm from the f/1.4 focus. When continuing on to f/4.0, the focus position went to -5.0 mm and then at f/5.6 it went to -8.1 mm. It didn’t shift appreciably when stopping down further. The total focus shift was about 17.8 mm from f/1.4 to f/5.6! This is more than enough to throw an eye out of focus and ruin the portrait shot at this distance.
I always set my focus fine-tune calibration setting at the widest aperture, except when I don’t. Let me explain… I determine what focus fine-tune setting is required at each (full) aperture from f/1.4 through f/5.6 for my fast lens, and then I’ll set the fine-tune setting for which aperture I expect to typically shoot at. I keep a little cheat sheet with calibration settings taped inside my lens cap, since I tend to forget them. These settings are “per-camera-body”.
Once a fast lens that has spherical aberration gets stopped down to about f/5.6, the focus doesn’t seem to measurably shift anymore.
Believe it or not, many lenses focus different colors of light quite differently. This is what’s known as longitudinal chromatic aberration, when it lies along the axis of the lens. The MTFMapper program lets you conduct the tests shown with just the red or green or blue pixels on your camera’s Bayer sensor. With this analysis, you can see how longitudinal (axial) chromatic aberration works. In the “Preferences” dialog, just select the desired Bayer channel color to use with the focus chart photos you already have.
For zoom lenses that have a focus shift at different focal lengths, I use a similar scheme to compensate for focal length instead of aperture setting. This problem is solved by Sigma and Tamron on their lenses that allow focus calibration adjustments at multiple distances and focal lengths via a dock. No such luck with other manufacturers so far. Even Sigma and Tamron don’t help you with compensating for aperture focus-shift, however (at least not yet).
Conclusion
This analysis might sound like nothing more than nit picking. If you’ve tried close-up portraiture, however, you know how crucial a few millimeters of missed focus can be. A fuzzy eye shot is a ruined shot. It’s better to know how your lens performs than not.