Lenses: focal length, field of view and depth of field
What a lens's focal length really changes, why the background grows when you step back, and how to compute the band of sharpness before the talent leans forward
You frame a head and shoulders to the same size twice: once on a 24 mm lens from 1.14 m, once on a 135 mm lens from 6.39 m. Both at f/2.8, full frame. Which picture has more depth of field?
A lens does three jobs you control: it decides how much of the scene lands on the sensor (field of view), how much light gets through (the f-number, from the exposure chapter), and which distances are sharp (depth of field). This chapter takes each in turn with numbers you can check: the formulas a focus puller’s calculator uses, the same formulas inside the sim below, and the lab’s test charts generated from them. By the end you can say before the shot what will be sharp, how soft the background will be, and what it costs to change either.
Focal length and field of view
The focal length of a lens is the distance behind it at which it brings an object at infinity to a sharp image. It is a property of the glass, printed on the barrel in millimetres. It does not change with the camera you mount the lens on.
What changes is how much of the image the sensor catches. A lens of focal length f in front of a sensor w millimetres wide sees a horizontal angle of view
hfov = 2 · atan(w / 2f)
On a full-frame sensor, 36 × 24 mm, that gives 73.7° for 24 mm, 39.6° for 50 mm, 23.9° for 85 mm and 15.2° for 135 mm. Doubling the focal length roughly halves the angle; at long focal lengths exactly so.
The sensor is the other half of the sum. A smaller sensor catches a smaller part of the same image, so the same lens looks longer. The crop factor is the ratio of the full-frame diagonal (43.3 mm) to the sensor’s diagonal: 1.53 for APS-C, 2.0 for Micro Four Thirds, 2.73 for a 1-inch-type sensor, the largest found in phone main cameras. A 50 mm lens on Micro Four Thirds sees what a 100 mm lens sees on full frame. Nothing about the lens became 100 mm; the sensor threw away the outside of the picture.
Crew talk about lenses by their full-frame equivalent because it is the one number that travels between cameras. A phone’s main camera might have a real focal length of 6 to 9 mm and be sold as “24 mm”; that is its equivalent. When you read a phone file with exiftool, FocalLength is the real one and FocalLengthIn35mmFormat is the equivalent, and the lab compares the two.
Perspective belongs to the camera position
The most repeated mistake about lenses is that a long lens “compresses” a scene and a wide lens “distorts” it. Both effects are real on screen. Neither comes from the lens.
How large an object appears is its size divided by its distance from the camera. A face at 1 m and a building at 11 m appear in the ratio of their sizes times 11. Move back to 6 m and the face is at 6 m and the building at 16 m: the ratio of their distances fell from 11 to 2.7, so the building is now large next to the face. The lens only decides how much of that view fills the frame. Put a 24 mm lens at 6 m and crop the middle of the picture, and you have the 135 mm shot with fewer pixels.
The lab’s focal_*mm.png frames make this measurable. Each one frames a head and shoulders to the same 30% of the frame width, on 24, 50, 85 and 135 mm, which puts the camera at 1.14, 2.36, 4.02 and 6.39 m. A building stands 10 m behind the subject in every frame. The subject is 384 pixels wide in all four. The building is 230 pixels wide on the 24 mm and 886 on the 135 mm, nearly four times. That is “compression”: the camera stood further back.
The same reasoning explains the close wide-angle portrait. With the camera 0.5 m from the tip of a nose, the ears are about 0.6 m away, so the nose renders 20% larger relative to them; from 2.5 m the difference is 4%. A wide lens is not what enlarges the nose. Standing close enough to fill the frame with a wide lens is. Choose the camera distance for the relationship you want between the face and the background, and then the focal length that frames it from there.
What “in focus” means: the circle of confusion
A lens focused at distance s brings points at s to a point on the sensor. A point nearer or further comes to a focus behind or in front of the sensor, and the sensor catches a small disc of light instead, the blur disc. Under the thin-lens model its diameter on the sensor is
b = f² · |d − s| / (N · d · (s − f))
for a point at distance d, focal length f and f-number N, every length in millimetres. Only one distance is ever perfectly sharp. “Sharp” in practice means the blur disc is too small to see at the size the picture will be viewed, and the diameter you agree to call too small is the circle of confusion, c.
The usual choice relates c to the sensor’s diagonal: Zeiss’s lens division uses the diagonal divided by 1,500, which is 0.0288 mm on full frame (usually rounded to 0.029) and is what the sim and the lab use. exiftool computes its CircleOfConfusion tag as the diagonal over 1,440, 0.030 mm. Both assume a print or screen viewed at a normal distance. Neither is a property of the lens, and a picture viewed larger than that standard has a smaller real c. A 24-megapixel full-frame sensor has 6 µm pixels, a fifth of c: pixel-peep at 100% on a 27-inch monitor and part of what the calculator called sharp is not. That is how Arinze’s soft eyes passed on the 7-inch monitor.
Near limit, far limit, hyperfocal distance
Set the blur disc equal to c and solve for d, and you get the two edges of the band of acceptable sharpness. It is tidiest through the hyperfocal distance H:
H = f² / (N · c) + f
near = s · (H − f) / (H + s − 2f)
far = s · (H − f) / (H − s) while s < H; infinity once s ≥ H
The depth of field is far minus near. Three rules fall out of these formulas, and Zeiss’s 2010 article derives the same three with geometry and no algebra:
- Distance squared. Well short of H, depth of field grows with the square of the focus distance. 85 mm at f/1.8 on full frame gives 5.5 cm at 2 m and 12.6 cm at 3 m: 1.5 times the distance, 2.3 times the depth.
- Focal length squared. At a fixed distance, depth of field falls with the square of the focal length. That is why the long lens feels shallow: you kept your distance and changed the magnification.
- f-number, linearly. Doubling the f-number (two stops) roughly doubles the depth of field. 85 mm at 2 m: 5.5 cm at f/1.8, 33.9 cm at f/11.
Combine the first two and the Predict above follows: if you change focal length and move to keep the framing, the two squares cancel and depth of field stays put. The background blur does not cancel. For a background far behind the subject, b tends to f² / (N · (s − f)), which is the entrance-pupil diameter f/N times the subject’s magnification. Same magnification, wider pupil, softer background: an 85 mm f/1.8 has a 47 mm pupil, a 24 mm f/1.8 a 13 mm one.
The split of the band is not fixed either. At 85 mm f/1.8 and 2 m it is half in front and half behind (2.7 cm and 2.8 cm). The “a third in front, two thirds behind” rule is exact at one distance, a third of H, and nowhere else. At H it is everything from H/2 to infinity.
Focus at the hyperfocal distance and everything from half of it to infinity is within c. For a 24 mm lens at f/8 on full frame, H = 24² / (8 × 0.02885) + 24 ≈ 2,520 mm. Focus at 2.52 m and the sharp band runs from 1.26 m to the horizon. Documentary and street shooters live there: set it once and stop focusing. Your phone’s main camera lives there too. A 1-inch-type sensor with an 8 mm lens at f/1.8 (about a 22 mm f/4.9 on full frame) focused at 1.5 m is sharp from 1.04 to 2.70 m, and a background a metre behind the subject blurs by under one c. That is why phone video looks deep and why phones fake the blur in software (see the AI section below).
The sim: set the lens, read the limits
The sim uses exactly the formulas above. Set focal length, aperture, distance and sensor and it shows the near and far limits, the hyperfocal distance and the background blur disc, both as a number and through a simulated lens. Three checks run all the time: the subject must sit inside the band, the hyperfocal readout must agree with the far limit, and the background must be soft (blur disc at least c). Leave the circle of confusion on auto: it computes the diagonal over 1,500, as the lab does.
Things to try before the exercises. Set 85 mm, f/1.8, 2 m: depth of field 5.5 cm, near 1.97 m, far 2.03 m. These are the lab’s dof_shallow.png numbers. Set the background to 1 m behind: the blur disc reads 699 µm, which is exactly the blur the lab’s chart applies to its 3 m target. Now set 50 mm, f/2.8, 2 m and switch the sensor from full frame to 1-inch type: the circle of confusion drops to 10.6 µm, and the readout tells you the picture is like a 136 mm f/7.6 on full frame. Shrinking the sensor with the same lens, distance and f-number makes the band narrower (from 25 cm to 9 cm at 50 mm), because the smaller picture is enlarged more for viewing. Shrinking the sensor and changing lens to keep the framing makes it deeper. Which of those two people mean by “small sensors have deep focus” is the source of most arguments about it.
Portrait on full frame: 85 mm, subject at 3 m, background 5 m behind them, automatic circle of confusion. Choose an aperture that keeps at least 20 cm sharp (nose to ears) while the background blur disc is at least 10 × c.
GOAL: 85 mm, 3 m, background 5 m behind, full frame, depth of field ≥ 20 cm and background blur ≥ 10 × c
Focus stays at 2 m. A dinner table runs from 1 m to 4 m in front of the camera, and every place setting has to be sharp. On full frame with the automatic circle of confusion, find a focal length and f-number that keep the whole table inside the depth of field.
GOAL: subject distance 2 m, full frame, auto c, near limit ≤ 1 m and far limit ≥ 4 m
The table exercise ends at f/22 on a 35 mm lens. That is where a second blur takes over. Light through a small hole spreads into an Airy disc about 2.44 · λ · N across: 15 µm at f/11 and 30 µm at f/22 for green light at 550 nm. At f/22 on full frame the diffraction disc is already the size of c, so stopping down further makes the whole picture softer, not deeper. On a 1-inch sensor, whose c is 10.6 µm, the same limit arrives at about f/8. The sim’s thin-lens model has no diffraction, and the lab’s charts have none either; the limit is yours to remember.
Focusing it on set
Numbers do not focus a lens. On a shoot the focus is set by a person, and the depth of field tells that person how much room they have.
Measure, then mark. The 1st AC measures the distance from the sensor plane (the ⊖ mark on the camera body) to the subject’s eyes with a tape or a laser, and marks it on the lens’s focus scale or a follow-focus ring. Cine lenses have large engraved scales and a long focus throw for this reason; most photo lenses have short throws and no usable scale, and focus-by-wire lenses may not return to the same mark twice. At 8.7 cm of depth, the band reaches only about 4.3 cm in front of the mark and 4.4 cm behind it: a 2.5 m mark that is 5 cm off puts the eyes outside it altogether.
Check at magnification, on the eyes. Focus peaking highlights edges with high local contrast. On a deep complexion (Monk Skin Tone 8 to 10) in a dim shop, skin gives few high-contrast edges, and the peaking lights the shelf labels and the white coat before the face. The same happens on pale skin in soft light. Do not read focus from peaking on skin. Punch in on the eye: lashes, the catchlight, the line of the lower lid.
Leave room for the take. Talent moves. A seated speaker drifts 3 to 5 cm; a pharmacist reaching for a shelf moves 30. Choose the aperture for the movement, not for the still frame on the monitor. If the director wants f/1.8 for the look and the talent cannot stay still, the honest options are a hit mark on the floor, a 1st AC pulling focus live, or a smaller aperture.
Know the lens you have. Many lenses shift their framing as they focus (focus breathing), and a zoom may shift its focus as it zooms. Prime lenses are faster and lighter; zooms save lens changes in a narrow shop. Cine lenses are marked in T-stops, the measured transmission, rather than f-stops; depth of field depends on the geometric f-number, which is close to the T-stop on a good lens. Set exposure by the T-stop and compute depth of field from the f-number; the next module covers rented lens sets.
What goes wrong
| Symptom | Cause | Fix |
|---|---|---|
| Eyes soft, ear sharp | Depth of field under the talent’s movement; focus mark taken to the nose or the ear | Measure to the eye; stop down until the band covers the movement; punch in and check every take |
| Background busier than planned in a small room | Not enough distance behind the subject; a wide lens close in shows more background, and it is less blurred | Move the subject away from the wall before changing the lens; then a longer lens from further back |
| A “wide” phone shot with a large nose | Camera 40 to 60 cm from the face to fill the frame | Step back and use the tele camera; distance sets perspective |
| Everything sharp, nothing reads as the subject | Small sensor or short lens at the hyperfocal distance | More distance behind the subject, a longer lens, a wider aperture, or a larger sensor |
| Whole frame slightly soft at f/16 to f/22 | Diffraction, larger than c | Open up; use the hyperfocal distance instead of the smallest aperture |
| Sharp on set, soft in the edit | c chosen for the monitor, not the delivery | Judge focus magnified; for a big screen use a smaller c (set it by hand in the sim) |
You will measure the bar contrast of eight targets in three lens settings, find the near and far limits from the pictures, and set the sim to the same values to read the same limits. Then you measure perspective in the focal-length frames and on your own phone. Every chart is generated by labs/media/camera_lab.py from the thin-lens model: it is the lab’s model of a lens, not a photograph from a real one, and it has no diffraction or aberrations.
1. Generate the lab files. From the root of the atlas-labs repository:
cd labs/media
python3 generate.py
python3 check.py | grep -E "camera/(dof|focal)"generate.py prints a line like 51 files in out/ (1280x720, 3 s clips, 6 s audio), 25.7 MB after 15 to 20 seconds at the default scale 0.1. The check prints seven ok lines, among them camera/dof_shallow.png 1 of 8 targets within c; near 1.973 m, far 2.028 m and camera/focal_135mm.png subject 384 px, building 886 px. Do not open out/answers.json yet.2. Measure the bar contrast in each depth-of-field chart. Each chart is eight strips of fine bars, one bar target per distance, left to right at 0.75, 1, 1.5, 2, 3, 5, 10 and 20 m. Each target is printed so its bars are the same size in the frame; only the lens blur differs. Save this as bars.py in labs/media:
import subprocess, sys
DIST = [0.75, 1, 1.5, 2, 3, 5, 10, 20] # metres, left to right
for path in sys.argv[1:]:
size = subprocess.run(["ffprobe", "-v", "error", "-select_streams", "v:0",
"-show_entries", "stream=width,height", "-of", "csv=p=0", path],
capture_output=True, text=True, check=True).stdout
w, h = map(int, size.strip().split(","))
line = subprocess.run(["ffmpeg", "-v", "error", "-i", path, "-vf", f"crop={w}:1:0:{h // 2}",
"-f", "rawvideo", "-pix_fmt", "gray", "-"],
capture_output=True, check=True).stdout
mx, sw = w // 32, (w - 2 * (w // 32)) // 8
spans = []
for i in range(8):
mid = line[mx + i * sw + sw // 4: mx + i * sw + 3 * sw // 4]
spans.append(max(mid) - min(mid))
top = max(spans)
print(path.split("/")[-1])
for d, s in zip(DIST, spans):
print(f" {d:>5g} m contrast {s / top:.2f} {'#' * round(20 * s / top)}")python3 bars.py out/camera/dof_shallow.png out/camera/dof_stopped_down.png out/camera/dof_hyperfocal.pngdof_shallow.png (85 mm, f/1.8): contrast 1.00 at 2 m and 0.00 or 0.01 everywhere else. One strip is sharp, so that is the focus distance. dof_stopped_down.png (85 mm, f/11, same focus): 1.00 at 2 m, 0.14 at 1.5 m and 3 m, 0.10 at 5 m, 0.03 to 0.06 beyond. dof_hyperfocal.png (24 mm, f/8): 1.00 from 1.5 m to 20 m, 0.76 at 1 m and 0.49 at 0.75 m. The contrast does not fall in a straight line with blur (5 m keeps less than 1.5 m, 20 m more than 10 m): a disc blur’s response to fine bars has dips and rebounds, so read the charts as sharp or not sharp, not as a ranking.3. Find the limits, then set the sim to match. From step 2, the f/1.8 band lies between 1.5 m and 3 m and is narrower than the gap between the targets; the f/11 band is wider but still short of 1.5 m and 3 m; the 24 mm band starts between 1 m and 1.5 m and runs to the far end. Now set the sim above to each lens, full frame, circle of confusion on auto, and read the limits. For the third chart the sim’s distance steps go 2.5 m then 3 m, either side of the chart’s 2.52 m; try both. Then open the answers:
python3 -c "
import json
for e in json.load(open('out/answers.json'))['files']:
if 'dof_' in e['path']:
x = e['expected']
print(e['path'], x['focal_mm'], 'mm f/', x['f_number'], 'focus', x['focus_m'], 'm H', x['hyperfocal_m'], 'm near', x['near_m'], 'far', x['far_m'], ' c', x['coc_mm'], 'mm')
"near 1.973 far 2.028, near 1.845 far 2.184 and focus 2.52 ... near 1.26 far None with c 0.0288 mm: the same numbers, because the sim and the generator use the same formulas. The 1.5 m and 3 m targets at f/11 sit outside the band with a blur disc of 0.114 mm, four times c, which is why they kept only 0.14 of their contrast. The 1 m target in the hyperfocal chart is outside the band too (1.26 m) yet kept 0.76: c is a threshold someone chose, not a cliff.4. Measure perspective in the focal-length frames. Save this as widths.py and run it on the four frames in order of focal length:
import subprocess, sys
BUILDING, SUBJECT = bytes.fromhex("5a463c"), bytes.fromhex("aa785a")
def row(path, y, w):
return subprocess.run(["ffmpeg", "-v", "error", "-i", path, "-vf", f"crop={w}:1:0:{y}",
"-f", "rawvideo", "-pix_fmt", "rgb24", "-"], capture_output=True, check=True).stdout
def count(line, colour):
return sum(line[i:i + 3] == colour for i in range(0, len(line), 3))
for path in sys.argv[1:]:
size = subprocess.run(["ffprobe", "-v", "error", "-select_streams", "v:0", "-show_entries",
"stream=width,height", "-of", "csv=p=0", path], capture_output=True, text=True, check=True).stdout
w, h = map(int, size.strip().split(","))
subject = count(row(path, int(0.92 * h) - 4, w), SUBJECT)
building = count(row(path, 2, w), BUILDING)
print(f"{path.split('/')[-1]:<16} subject {subject:>4} px building {building:>4} px building/subject {building / subject:.2f}")python3 widths.py out/camera/focal_24mm.png out/camera/focal_50mm.png out/camera/focal_85mm.png out/camera/focal_135mm.pngwhat line of each entry in answers.json). Divide the building’s distance by the subject’s in each case and you get 9.8, 5.2, 3.5 and 2.6: the building’s growth is set entirely by those distance ratios.5. Do it with your phone. Stand a friend 1 m in front of a wall or a shelf with something 3 to 5 m behind them. Frame their head and shoulders with the 1× camera from about 0.6 m. Then switch to the tele camera and step back until the head and shoulders fill the same width. Take one photo each (not portrait mode), copy them to your computer and read them:
exiftool -FocalLength -FocalLengthIn35mmFormat -FNumber -ScaleFactor35efl -FOV -CircleOfConfusion -HyperfocalDistance -DigitalZoomRatio IMG_*.*FocalLength as 1× and a DigitalZoomRatio above 1, your phone cropped the main sensor rather than switching camera, and its perspective is still set by where you stood. Not every phone writes every tag; a missing line is not an error.python3 generate.py --seed 4 and run bars.py again. The sharp strip moves to 3 m, the 2 m target goes soft, and the sim at 85 mm f/1.8 and 3 m reads near 2.94 m, far 3.06 m: 12.6 cm of depth against 5.5 cm at 2 m, the distance-squared rule (1.5² = 2.25). Then, in the sim, set the circle of confusion by hand to 6 µm, the pixel pitch of a 24-megapixel full-frame sensor: at 85 mm f/1.8 and 2 m the band collapses to about a centimetre. That is the depth of field of someone checking focus at 100%, and the reason “it looked sharp on the monitor” is not a focus check. Run python3 generate.py again before the next chapter to restore seed 1.Back to Tallowmere's dispensing shop in Ibadan. Arinze stands behind the counter, the medicine shelves 1 m behind him; with your back to the door the camera can be at most 2.5 m from him. Fumiko wants a mid shot (about 1 m of frame width), Arinze sharp from nose to ears while he talks and reaches (allow 15 cm), and no pack on the shelves readable. Full frame, 1920 pixels wide. Which setting do you take to her?
- PAPER Depth of Field and Bokeh H. H. Nasse, Carl Zeiss Camera Lens Division, 2010
A lens maker's own derivation of the three depth-of-field rules with geometry instead of algebra, and the source of the diagonal ÷ 1,500 convention the sim and the lab use. The bokeh half explains why two lenses with the same blur disc look different, which the thin-lens model cannot. Read: pages 1 to 15 for depth of field, the D/1500 circle of confusion and the hyperfocal distance; from page 25 for bokeh.
- POST Portrait mode on the Pixel 2 and Pixel 2 XL smartphones Marc Levoy and Yael Pritch, Google Research, 2017
The clearest public account of how a phone fakes a shallow depth of field: segmentation, dual-pixel depth and the blur. Read the sections on what goes wrong; they are the failure list for the WithAI test.
- DOC Cameras (Blender manual)
A free tool where you can set focal length, sensor size and fit, focus distance and f-stop and render the result. Useful for previewing a lens choice for a set you have measured; skip the sections on panoramic cameras.
- DOC ExifTool Composite tags Phil Harvey
Defines the CircleOfConfusion (diagonal ÷ 1,440), HyperfocalDistance, FOV and ScaleFactor35efl tags you read in the lab, so you know which numbers come from the file and which are computed. Search the page for each tag name.
- VIDEO Focusing on Depth of Field and Lens Equivalents Filmmaker IQ, 2016
The full 18-minute video behind the embedded segment, with the lens-equivalence demonstration and the creator's errata in the description. Watch the last two chapters after the lab.
All companies and people in these examples are fictional. Any resemblance to a real business or person is unintended.