Generate the SDF map
A rounded-rectangle signed distance function is rendered to a PNG map; the red channel encodes horizontal displacement and the green channel encodes vertical shift.
Building glass for the web
Real-time optical refraction for the web. Pick a component — button, navigation bar, dock, card, or switch — and watch every glass surface bend the scene behind it using an SVG displacement map. Tune parameters live with the sliders below or load presets from the gallery with a single click.
Drag the lens
Drag the glass across the stage; edge refraction, center magnification, and chromatic dispersion are computed in real time.
Playground
Select a component and backdrop, then sculpt the glass surface with live sliders. Changes apply instantaneously.
Examples
Load any preset into the playground above with a single click and customize it live.
How it works
A rounded-rectangle signed distance function is rendered to a PNG map; the red channel encodes horizontal displacement and the green channel encodes vertical shift.
feDisplacementMap offsets each pixel according to the map — strong deflection along the beveled edges and zero shift at the center, producing true optical refraction.
The filter is bound to live content behind the element via backdrop-filter: url(#id), layered with subtle blur, saturation, and specular highlights.