Feature Library

Liquid glass panels

3.10 GPU · 0.16 CPU ms
A still of the Liquid glass panels demo
Still
The live demo starts when it’s in view.Click the water to ripple it · right-click anywhere for the menu

Glass slabs over live water, drawn by WebGPU (or its WebGL2 twin) behind ordinary DOM.

What it costs a frame

3.10 ms
0.16 ms
GPU
3.10 ms
CPU, median
0.16 ms
CPU, 95th pct
0.25 ms
Draw calls
0
Weight
Heavy

Measured 11 November 2026 on 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 157, 1920×1080 at 1×. 600 frames × 3 rounds, median kept. What ran: Measured with the water moving under five glass panels and three chips: two full-screen passes (water and glass, then the menu blob), timed with their own timestamp queries. Phones: tiers are being measured next.

On every machine it was measured on
MachineGPU msCPU msCPU p95
unknown GPU · 13th Gen Intel(R) Core(TM) i9-13900Hreference · measuring tool3.100.160.25
apple · Apple A19 Proin a browser tab · 16 November 20266.880.300.38
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 20261.640.330.55

Bars against one 16.7 ms frame. A browser-tab run is timed in a visible tab without the tool’s scripted input, so read it as close, not exact.

How steadily it runs on Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258V · in a browser tab

Typical frame ?
16.65 ms
1% low ?
55 fps
Varies by ?
±0.41 ms
All metricsIntel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258V · in a browser tab
p50p95p9916.03 ms17.90 ms +
How long each frame took. Most frames sit in the tall bars; a long tail to the right is hitching.

Frames run on a 60 Hz timer (a page demo), so most frames take about one tick, 16.7 ms: the spread around it is what matters.

Frames

Median (p50) ?
16.65 ms
p95 ?
17.38 ms
p99 ?
17.77 ms
Slowest ?
19.73 ms
Mean ?
16.69 ms
Standard deviation ?
0.41 ms
1% low ?
55 fps
0.1% low ?
51 fps
Hitches ?
0 of 600
Over budget ?
0 of 600

Main thread

Long tasks ?
0
Long frames ?
0
Event-loop delay ?
0.1 / 0.7 / 0.8 ms

Input

No input during this run. A browser-tab run plays none.

Memory

JavaScript heap ?
76.8 → 68.4 MB
Growth ?
-8.45 MB

What it needs

Renders with
WebGPU or WebGLWebGPU where there is one, WebGL2 where there is not.
Your browser
Runs hereNo WebGPU needed
Depends on
NothingNo other packages

What it’s for

  1. Dashboards and control panels
  2. Hero sections
  3. Context menus and popovers
  4. Settings and onboarding screens
  5. Game menus
  6. HUD panels over a 3D scene
  7. Text over a picture or map

Pitfalls, in brief

  1. Give marked elements a transparent background: the GPU draws their glass under them.
  2. Each frame reads every marked element’s rect (getBoundingClientRect): keep the count to the 32 the frame uniform holds, minus the ripples and the theme.
  3. A corner radius is read from CSS once per element and cached: change an element’s radius and it keeps the old one.
  4. The canvases are premultiplied alpha: a shader must return rgb × a.
  5. On a weak GPU pass tier (GLASS_TIER): low draws at most 1 pixel per CSS px and medium 1.5, where high draws 2; both skip the over pass (the menu blob, a second full-screen pass and canvas) while no menu or drop shows, clearing it once when they go.
6 more in brief
  1. Never queue more than one frame ahead: frame() skips while the last one is still on the GPU.
  2. The pipelines compile in the background (createRenderPipelineAsync): the glass appears a moment after the page, never freezing it.
  3. Without WebGPU, createLiquidGlass draws the same glass with WebGL2 by itself (two canvases, a WebGL2 context each; webgl: false turns it off, and it returns null without WebGL2 too: style the panels so they still read).
  4. Over a scene, the glass pass is the last thing drawn: draw the scene into a texture with TEXTURE_BINDING usage (not the canvas) and give the canvas to encode() as the target.
  5. Over a scene, setPanels() takes the pixel ratio of the picture to the host (device px over CSS px): pass the one you sized the picture with, or the rects and the pointer land in the wrong place.
  6. Hover and alert light only tint the rim and a thin band inside it: they are not a state on their own.
11 pitfalls in full, the hook-up guide, the module source and its tests come with the part.

Where it comes from

From HaTac. Fully custom code.

Inigo Quilez, 2D distance functions and smooth minimum: sdRoundBox (every panel’s shape) and the polynomial smin (the menu blob and toasts melting together) follow his published formulas, re-written in WGSL.

Apple, Liquid Glass (2025): The look this answers: a design inspiration, no code.

Kenny Mitchell, Volumetric Light Scattering as a Post-Process (GPU Gems 3, 2007): The demo’s sun shafts over a scene: a radial gather toward the light, here at a quarter of the size and masked by the panels.

Mark Jarzynski and Marc Olano, Hash Functions for GPU Rendering (2020): The PCG hash behind the demo scene’s stars and the shafts’ jitter.

glassmorphismrefractionsdfwgslraw webgpudom + gpucontext menucausticshudfrosted glassmaskwebgl2 fallback

Near it in the frame