Lab · WebGL experiment
Adire, in code
An interactive study of adire, the indigo resist-dyed cloth of Yoruba dyers. Paint a pattern in starch, dip the cloth and keep what you make.
- Type
- WebGL experiment
- Year
- 2026
- Role
- Concept, design and code
- Built with
- Three.js, React Three Fiber, GLSL
Scroll to begin
01 / 06
Start with white cloth
Adire comes from the Yoruba for “tie and dye”. Dyers in Abeokuta and across south-west Nigeria start with plain white cotton.
02 / 06
Paint the resist
For adire eleko, the pattern is painted on in cassava starch paste, by hand with a feather or through a cut metal stencil. Wherever the paste sits, the dye can’t reach.
Draw on the cloth, or start from a pattern.
03 / 06
Into the vat
The cloth is lowered into a vat of fermented indigo. It comes out yellow-green, and turns blue as the air reaches it.
04 / 06
Again, and again
Each dip adds another layer of colour. Dyers let the cloth air between dips and repeat until the blue is as deep as they want.
05 / 06
Scrape away the starch
When the cloth is dry, the paste is scraped off. The pattern underneath stays pale, with fine veins where the starch cracked and let the dye in.
06 / 06
Keep your cloth
That’s your adire. Save it as an image, or start a new one.
How it’s built
One cloth, two shaders
The cloth is a single flat plane. A vertex shader hangs it from the rod and moves it in a light breeze, more at the hem than at the top. A fragment shader works out the colour of every point on it.
Your drawing is a texture
What you paint goes onto a hidden 2D canvas, which the shader reads as the resist. The three patterns are drawn onto the same canvas, stroke by stroke, so they paint themselves in.
Indigo, roughly to physics
Each dip absorbs more red and green light than blue, so the colour deepens quickly at first and then slowly, as real indigo does. Fresh dye shows yellow-green at the edge of each dip, and cracks in the starch let fine veins of blue through.
One number runs the story
Scroll position becomes a single value from 0 to 6. The dips, the scraping and the camera all follow it, so scrolling back up plays the story in reverse, and scrolling never re-renders React.
Light enough for a phone
The 3D code, about 240 KB compressed, loads only on this page and only once you start to scroll. Until then a plain placeholder holds its place, so the headline paints straight away. The scene stops drawing when it’s off screen, and phones get fewer vertices.
Open to everyone
With reduced motion turned on, the cloth hangs still and the colour simply deepens step by step. The patterns work from a keyboard, and browsers without WebGL still get the whole story.
A note on the craft: this is a simplified study written from public accounts of adire, not a dyer’s manual. Real adire takes days, and the dyers’ skill lies in everything a screen leaves out.