Panavision 2.39:1 anamorphic streak & oval bokeh
I wanted to know if one ElementGL WebGL 2 canvas could recreate Panavision 2.39:1 anamorphic squeeze and desqueeze, horizontal cyan-cobalt streak flares, oval bokeh defocus and edge barrel breathe straight from glowing HTML buttons, an editable timecode field and a draggable light puck. Drag the bright puck across the frame, type in the slugline or toggle Ignite flare and Spotlamp.
Starting canvas…
Show the code cinema HUD markup, squeeze layout, bright-pass and 21-tap streak shaders, FBO pipeline and hit-box sync
- One live cinema HUD panel inside the canvas. Bright specular buttons, callouts, the editable slugline and the draggable light puck live inside one
<canvas content="drawable" layoutsubtree>. - Squeeze and desqueeze gate dimensions.
computeGateRect()scales the projected width from a raw1.33xgate up to2.39:1widescreen while keeping the mobile phone frame inside bounds. - Bright-pass threshold, 21-tap horizontal streak and oval bokeh shaders. Extracts luminance above
uThresholdfrom the uploaded DOM texture, applies cyan-cobalt horizontal convolution with warm internal ghosts, adds 32-tap Vogel-disc elliptical bokeh and warps outer corners with edge barrel breathe. - Multi-pass FBO pipeline on one
ElementGLcontext. Callsstage.begin()beforestage.upload(), writes four smallRGBA8FBO passes and composites onto the cinema frame. - Anamorphic hit-box calibration. Measures
geometryUnit(), callsupdateElementGeometry()with the active squeeze/desqueeze scale and togglesdataset.hitTickso controls stay clickable. - Five-argument 2D and plain-HTML fallbacks. Draws the panel with five-argument
drawElementImage()without WebGL 2, or moves the HUD into plain HTML on context loss.
How it works
Every widget inside #cinema-panel sits on a dark matte obsidian ground (#070a10) with muted slate chrome kept below the default 0.54 extraction threshold. Only the glowing buttons, bright callout pills, editable slugline text and the movable SPOT puck cross into high luminance. When you drag the puck, toggle Ignite flare or type a new timecode, Chrome fires a paint event on #flare-canvas. The handler sets hasPainted = true, calls stage.begin() first and uploads #cinema-panel via gl.texElementSubImage2D() with UNPACK_PREMULTIPLY_ALPHA_WEBGL set to true.
Four offscreen 320 by 180 RGBA8 passes run on that single ElementGL WebGL 2 context before the full-resolution composite:
- Bright-pass extraction: unpremultiplies the DOM texture, filters pixels above
uThresholdinside the warped gate and ignores the dark matte HUD chrome. - Horizontal streak convolution: runs two 21-tap horizontal passes across the full stage width with exponential falloff, Panavision cyan-cobalt tinting and a point-reflected warm amber lens ghost.
- Oval bokeh defocus: samples a 32-tap Vogel-disc elliptical aperture kernel stretched vertically in
2.39:1 Desqueeze, compressed in1.33x Squeeze (raw)and circular inFlat. - Widescreen cinema composite: draws the warped DOM panel inside the dark letterbox frame with subtle corner barrel breathe and lateral chromatic shift, then adds the horizontal streak and oval bokeh across the full viewport.
Because WebGL texture draws don't move Chromium's hit boxes when the card squeezes or widens between 1.33x and 2.39:1, syncPanelGeometry() scales canvas.updateElementGeometry() by geometryUnit() and toggles dataset.hitTick. Centering the barrel warp curve around normalised radius squared 0.35 curves the outer frame corners while keeping buttons and the editable input within about 1 to 2 px of their affine hit boxes.
Live checks
These checks run on isolated fixtures on testStage() when you press the button, leaving the cinema frame above untouched.
| Result | Experiment | Detail |
|---|
Findings
Measured in headless Chrome 160 Canary (2026-11-27): 5 of 5 live checks pass. Chrome 159 on Android is not verified yet.
- Purely DOM-driven optical flares: extracting bright pixels directly from
texElementSubImage2D()with unpremultiplied threshold gating lets CSS gradients, glowing buttons, live text glyphs and the dragged puck cast long horizontal streaks and oval bokeh without duplicating DOM layout positions in JavaScript. In the streak fixture, horizontal spill 78 px left and right of a 24 by 24 bright badge measuredrgb(65,84,95)over argb(6,9,15)dark baseline. - Premultiplied alpha uploads matter for translucent radial glows: setting
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true)at context creation, on restore and in live fixtures keeps translucent highlight edges from washing out before bright-pass extraction. - Vogel-disc bokeh vs concentric rings: three 8-tap rings created faint ghost copies around sharp text glyphs; switching to a 32-tap golden-angle Vogel disc blends tall elliptical oval bokeh smoothly around
#light-puckand the spotlamp highlight. - Center-anchored barrel warp preserves affine hit testing: shifting the quadratic barrel coefficient by
r2 - 0.35lets the outer cinema bezel bow and breathe at the corners while keeping buttons and text inputs aligned with linearupdateElementGeometry()transforms across both2.39:1 Desqueeze(263×110) and1.33x Squeeze (raw)(165×110). - Mobile memory budget holds well under 4 MP: at 412 px wide and device scale factor 2.625, the canvas backing store measures 948 by 784 px (
0.74 MP,5.9 MBlive) with zero horizontal overflow, zero lost contexts and zero unasked readbacks. - Not verified on real hardware yet: Chrome 159 on Android touch dragging on
#light-puck, real GPU frame rates and hardware context-loss recovery still need testing on a phone.