Spatial visionOS glass window

I wanted to know if one ElementGL WebGL 2 canvas could render a 3D tilted spatial glass window with mipmapped Gaussian frost, Snell rim refraction, chromatic edge dispersion, directional bevel speculars and gaze button glow while keeping tilted HTML controls clickable with updateElementGeometry().

Spatial window
Studio Dawn
Alpine Dawn Spatial mix · 48 kHz
01:24
starting...

Move your pointer (or drag on touch) across the stage to steer the 3D window tilt, specular rim highlight and radial button glow. Toggle Dim glass, switch tracks or edit the spatial note directly inside the tilted panel.

Show the code Mipmapped room and Gaussian blur FBOs, Snell dispersion bevel shader, 3D homography and hit geometry
  1. The live drawable spatial workspace panel. One <section id="vg-panel" drawable> holds translucent pill buttons, room chips, a range slider and an editable note input inside <canvas content="drawable" layoutsubtree>.
  2. 3D perspective projection and exact planar ray-plane unprojection. Builds matching uMvp and 3D DOMMatrix transforms plus the 3x3 inverse homography invHomography so pointer hover maps back into tilted panel coordinates.
  3. Procedural room, Gaussian frost, Snell rim dispersion and bevel specular shader. Samples mipmapped room and blur FBOs through a rounded-box SDF with R/G/B bevel dispersion, pointer-tracked rim highlights and button proximity glow before compositing premultiplied DOM UI.
  4. Offscreen FBO pipeline with explicit FBO/VAO unbind. Renders the architectural room into roomFbo with mipmaps, blurs through two separable Gaussian passes into blurFboB, and unbinds both FBO and VAO before screen compositing.
  5. Single ElementGL stage, premultiplied upload and projective hit boxes. Enables UNPACK_PREMULTIPLY_ALPHA_WEBGL on creation and restore, calls stage.begin() before stage.upload(), and updates updateElementGeometry() with geometryUnit().
  6. Five-argument drawElementImage() 2D fallback and plain HTML rescue. Draws a 2D rounded frosted slab and directional bevel when WebGL 2 is absent, or unwraps #vg-panel into #plain-host on context loss.

How it works

Live checks

Each check builds an isolated fixture on testStage() and retires its canvas afterwards so the live window above stays untouched.

ResultExperimentDetail

Findings

Measured in headless Google Chrome 160.0.0.0 canary on 2026-11-27 at 412x915 and 2.625 DPR (SwiftShader WebGL). Chrome 157, npm run check:jank and Chrome 159 on Android stay not verified.