Split-diopter two-plane focus lens

I wanted to know if one ElementGL WebGL 2 canvas could keep a close-up foreground HTML card and a distant background HTML panel razor sharp side-by-side across an adjustable optical seam, while blurring each defocused half with cinema bokeh and keeping controls in both planes clickable. Drag across the stage or move the sliders to sweep and tilt the glass edge, type and click inside either card, or turn on single-lens mode to see what a standard lens loses.

WIDE · 8.5 m 01:14:08:22

Scene 14B: Catwalk

Waiting for cue
28 mm · f/8.0 2 rigs on
CLOSE-UP · 0.42 m +2 diopter

Macro cue card

Near plane at 42 cm.

50 mm · f/2.0 · DoF 14 mm 0 cues fired

Starting canvas…

Show the code two drawable focal planes, Vogel bokeh and glass seam shader, pointer drag, geometry sync and 2D fallback
  1. Two live drawable planes in one canvas. Both #bg-card (distant 8.5 m plane) and #fg-card (close-up 0.42 m plane) live inside <canvas content="drawable" layoutsubtree>.
  2. Split-diopter bokeh and glass-edge shader. Keeps the focused half of each element 1:1 sharp, applies a 24-tap Vogel disc bokeh with highlight bloom to the defocused half, and adds a refractive bevel band across uSoftness.
  3. Pointer drag and single-lens comparison controls. Lets you slide and tilt the optical boundary by dragging the stage or prism tabs while keeping text selection active inside <input>.
  4. Hit-box calibration with geometryUnit(). Positions both cards via updateElementGeometry() and toggles dataset.hitTick so clicks and focus land on controls in both planes.
  5. Five-argument 2D and plain-HTML fallbacks. Clips and blurs half-planes with ctx.filter and 5-argument drawElementImage() without WebGL 2, or extracts both planes into plain HTML on context loss.

How it works

Live checks

Each check builds an isolated fixture on the hidden test stage and retires its canvas when done, leaving the visible stage untouched.

ResultExperimentDetail

Findings

Measured in headless Chrome 160.0.8188.0 canary on 2026-11-27 (412 px mobile at 2.625 DPR and 1024 px desktop at 1 DPR). Chrome 159 on Android isn't verified yet.