TL;DR Piecewise linear ray-tracing for artist controllable defocus blur in production ray tracers

The demo

Thin lens vs focus range

The same construction in a progressive path tracer, converging in your GPU right now. Left of the divider: a thin lens. Right: the focus range. The presets restage the paper’s figure comparisons.

↔
A · thin lens
B · focus range
0 spp

A · thin lens

B · focus range

Shading · guides

The model

The optical bench

Figure 2 of the paper, live: one pixel’s lens bundle. Drag the pixel on the film, the focus planes, and the objects. Where the fan pinches to a line, that depth is sharp. The strip on the left is the actual flatland render; the chart below shares the same depth axis.

drag the pixel · the F planes · the objects

One shear per boundary (eq. 1): S0 = 1 collapses the bundle onto its chief ray at F1; S1 ≤ 0 fans it back out at F2. Setting F2 = F1, S1 = −1 is exactly the thin lens.

wi+1 = T(wi, t) = normalize ( wiwi,z + t l SiF1 ) (1)
dc = {
dl f (F1 − z)z (f + F1)z < F1
0F1 ≤ z < F2
S1 dl f (F2 − z)z (f + F2)z ≥ F2
(2)

The Generalized-DoF tab is the closest prior model [Kosloff & Barsky 2009]: two focus planes with a controllable bulge B between them.

Production details

The tricky cases, live

Bending camera rays at two planes is the easy part. Shipping it in Glimpse took three more pieces, each one a demo.

Shading continuity

A glossy object straddling a focus plane reflects neighbouring pixels in different directions, a seam across the highlight (Fig. 3). Eq. 3 evaluates BSDFs with a shading ray that blends the upcoming shear in over a region δ before the plane:

ŵi = T ( wi, max (0, 1 − Fi+1 − zδ) )(3)
drag the sphere through F₁

The hit geometry never changes, only the direction the BSDF sees. The strip plots that direction per pixel: a step where the hit crosses a plane when smoothing is off, a ramp over δ when it’s on. The Fig. 3 preset in the path tracer shows the same seam rendered.

Refraction must not change the blur

An η = 1 glass slab should be invisible. But a continuation ray carries whatever partial shear smoothing already applied, so the renderer shears incrementally: a partial amount at each refractive hit, the remainder at the plane (eq. 4). Drag the slab, only the incremental rule leaves the bundle untouched everywhere.

t = max (0, 1 − Fi+1 − zδ) − tacc(4)
 

The grey ghost is the glass-free reference. Stop tracking freezes the direction at the slab; full shear double-counts what smoothing already applied near a plane. Both depend on where the slab sits, eq. 4 doesn’t.

Flats near a focus plane

Camera-facing discs and ribbons orient to each ray. Inside the shaded wedge, the kink at F1 puts R1’s origin past the disc while R0’s hit lies past the plane, so both halves of the test reject it (Fig. 5). The fix: let R1 hit backwards and start inside the primitive.

 

Drag the disc anywhere, the miss wedge is computed live from the two rejection conditions. It hugs the plane exactly where production hair and ribbon geometry lives.

Cost in production: roughly 0.5–6% over a comparable thin lens at ten bounces across the paper’s test scenes, ray coherence matters more than the extra plane logic.