Point a modern phone at a friend, tap Portrait mode, and the background melts into circles of light while the eyelashes stay sharp. On many phones, most of that separation did not happen inside the lens. The camera recorded a comparatively deep-focus image, estimated which parts of the scene were near and far, and rendered extra blur after the light had reached the sensor.

The result is not one universal trick. One phone may compare two rear cameras, another may compare the two halves of pixels under a single lens, and another may lean on segmentation, machine-learned depth, or an infrared depth sensor. The shared idea is computational: infer the scene’s geometry, then simulate the defocus a larger camera would have produced.

Why a thin phone struggles to make the same blur with glass

In an optical camera, depth of field depends on aperture, focal length, focus distance, sensor format, and the viewer’s definition of acceptable sharpness. A wider aperture can make the zone of apparent focus shallower, which is why portrait photographers open a fast lens to separate a face from the room behind it. Nikon’s aperture guide shows the same relationship: lower f-numbers mean larger openings and, under comparable conditions, less depth of field.

The f-number alone does not tell you how large the opening is. A 50 mm lens at f/1.8 has an entrance pupil about 28 mm across, while a phone camera with an actual focal length of only a few millimetres has an entrance pupil only a few millimetres across at the same f-number. The short focal length and small sensor are what leave so much of an ordinary phone portrait acceptably sharp.

Phones can still produce genuine optical blur at very close focusing distances, and larger sensors or telephoto modules can create more of it than small wide cameras. Portrait mode usually adds far more blur than the optics produced, especially around a person photographed from typical portrait distance. Matching the framing and shallow depth of field of a full-frame portrait setup would require a much larger entrance pupil and optical path than a slim camera bump can house.

That is why the untouched capture and the finished portrait can encode two different things. The sensor measures light. The portrait pipeline interprets distance and decides how that light should look if the lens system were larger.

The depth map can come from two cameras, one lens, or a learned estimate

To vary blur with distance, the phone first needs some representation of scene depth. Stereo vision is the classical route. Two viewpoints see nearby objects shift more than distant ones, and matching the displacement, or parallax, lets software estimate relative distance across the frame.

Apple’s original Portrait mode arrived on the iPhone 7 Plus with iOS 10.1 in October 2016. Apple said the feature used both 12-megapixel cameras and machine learning to keep the foreground sharp while applying a depth-of-field effect to the background. By 2021, Apple was documenting more elaborate segmentation, and its machine-learning team described person masks and depth estimation as inputs to the simulated effect.

Google’s Pixel 2 reached a related result in 2017 with only one rear lens. Its phase-detection autofocus pixels were split into left and right halves that viewed the scene through opposite sides of that lens, creating viewpoints less than 1 mm apart. The Google Research account of the Pixel 2 pipeline says those dual-pixel views fed a stereo algorithm, while a separate neural network identified people and their accessories.

The distinction matters. On the Pixel 2, the network trained on nearly a million pictures was a foreground-background segmentation model; it was not the source of the depth map. Google’s 2018 SIGGRAPH system description explains how the person mask and, when available, dual-pixel depth were combined to render synthetic defocus.

With the Pixel 3 in 2018, machine learning moved into depth estimation itself. Google trained a model with high-quality depth maps collected using a synchronized five-phone rig, then used that model to combine tiny dual-pixel parallax with cues such as defocus and familiar object size. Google’s Pixel 3 technical account says the phone predicted relative rather than absolute depth, which was enough to control portrait blur.

Other devices add active depth sensing. Apple’s iPhone 12 Pro, for example, introduced a LiDAR scanner that measured light distance and supplied pixel-level scene depth; Apple linked that hardware to Night mode portraits. Depending on the device and camera, the depth signal may therefore come from separated cameras, split pixels, active infrared sensing, learned monocular cues, or a mixture of them.

The output is often visualized as a greyscale map, with tone standing in for relative distance. It is useful, not perfect. Hair, glass, mesh, blank walls, repeating textures, and thin lines can give stereo matching or segmentation very little reliable evidence.

The synthetic aperture is not simply Gaussian blur

Once the phone has a subject mask or depth map, it assigns a blur amount according to distance from the chosen focal plane. Pixels near the subject’s depth stay sharp. Pixels farther in front or behind receive progressively stronger defocus, though the exact renderer is proprietary and differs across devices.

A Gaussian blur is the simplest mental model. It replaces each pixel with a weighted average of its neighbours, with weights that fall away in a bell-shaped curve. It is fast and useful, but it is not a faithful model of the way an aperture turns an out-of-focus point into a circle of confusion.

Real point highlights take on the character of the entrance pupil. A rounded aperture can turn fairy lights into bright discs, while aperture blades may give those discs a polygonal outline. A plain Gaussian filter spreads and dims the highlight instead of preserving that defined bokeh shape.

Better portrait renderers therefore use depth-aware disc splatting or other lens-inspired kernels rather than applying one uniform Gaussian blur to the background. Google’s Pixel 2 pipeline replaced each source pixel with a translucent disc whose size varied with depth, then composited the discs in depth order. That is why distant lights can swell into recognisable bokeh circles instead of becoming a featureless haze.

The stored depth information also makes the effect editable. Apple’s Portrait mode instructions let a user change the background-blur level after capture or remove the Portrait effect. A physical aperture cannot be reopened after the shutter has closed; a rendered aperture can.

Hair, glass, and thin edges reveal the reconstruction

The illusion is most vulnerable where foreground and background touch. Optical defocus changes continuously with distance, but a segmentation mask must decide which pixels belong to the subject, and an estimated depth map may be noisy or wrong. A loose hair can remain unnaturally sharp against a blurred wall, or the blur can eat into an ear.

Transparent and reflective objects are harder still. A wine glass should show a distorted view of the already blurred wall behind it, while its rim stays at the glass’s own depth. Treating the glass as one opaque layer cannot reproduce both facts, so it may look cut out or pasted over the scene.

Occlusion creates another trap. A background pixel hidden behind a sharp foreground edge was never recorded, yet a large synthetic blur kernel may need color from that hidden area. If the renderer simply pulls color across the boundary, a bright halo or dark fringe appears around the subject.

Textureless walls, repeating patterns, and lines parallel to a stereo baseline can also defeat correspondence matching. Google documented those failure cases for Pixel depth estimation, while modern segmentation models reduce some of the damage by recognising the semantic shape of people, hair, skin, and glasses. Recognition helps, but it cannot recover scene information that the camera never captured.

For readers who want to try the effect rather than inspect the mathematics, Make Tech Easier has a practical guide to shooting bokeh portraits on Android. The easiest stress test is a subject with flyaway hair, a bright point light in the background, and something transparent near the edge of the face.

Why phones build the image instead of merely recording it

Portrait mode belongs to a larger shift toward computational photography, but the optics have not stopped mattering. Lens quality, sensor area, focus, exposure, and motion determine the raw evidence available to the pipeline. Software then aligns frames, reduces noise, merges exposures, segments subjects, estimates depth, and renders a finished photograph from that evidence.

Android even exposes vendor camera extensions for effects including bokeh, HDR, and night capture; Google’s developer documentation defines the bokeh extension as sharpening the foreground subject while blurring the background. The label is uniform. The hardware and algorithms behind it are not.

That variety is easy to miss when comparing phones by a single f-number or megapixel count. Make Tech Easier’s guide to reading smartphone camera specifications makes the same broader point: aperture, sensor, lens quality, and software optimization all shape the result.

So the portrait on the screen is neither a raw optical measurement nor an arbitrary painting. It is a reconstruction constrained by the photons the phone captured and the scene geometry it could infer. Look at the soft circles behind a face and the effect can resemble a lens many times larger; look at one loose thread against the background and the hidden depth map may still show its seam.