Skip to content
Back to the lab

A WebGL2 dispersion shader in five passes

Liquid-metal button

The metal look of the button is computed in a shader, with no gradients or textures. A scalar field goes through a smoothstep, and each wavelength is sampled at a slightly different height, which produces the rainbow edge.

Source · GitHub

The scroll shows the render pipeline in three stages: the first has only the dispersion field, with sharp edges; the second adds the blur and the moving rim; the third adds bloom and the contrast curve, which gives the final metal. The button works the whole time: it responds to hover, press and keyboard focus. The animation runs only while you interact with it or while it is still settling. The main button on the home page's first screen is this one.

Source

Source files on GitHub:

Back to the lab