---
title: "How to Make Grainy, Glowing Gradient Wallpapers in WebGL (the Wrapped Look)"
seoTitle: "Grainy Thermal Gradients in WebGL: Animated Wallpapers Like Spotify Wrapped"
description: "The Wrapped look is a soft glow, a thermal colour ramp and film grain. I built a free WebGL generator for it: rings, aurora, your logo, your GitHub graph."
date: "2026-12-03"
type: "build"
tags: ["webgl", "shaders", "glsl", "creative coding", "gradients", "github", "nextjs"]
output: "/lab/afterglow"
---

This year's Spotify Wrapped looks like it was shot through a thermal camera: soft rings of violet, cyan and lime breathing out of a dark, grainy background, with heavy lavender type on top. I wanted that look for my own things, my logo, my GitHub year, a Reel cover, so I built a generator for it: [it is live at avivashishta.com/lab/afterglow](/lab/afterglow).

Pick a shape, a palette and some words. It runs live, and you can save a PNG for your phone or desktop, or record eight seconds of video for a Reel.

<div class="highlight"><p><strong>The short version:</strong> the look has a name, more or less: grainy gradients, or thermal (heat map) gradients. It is three layers. A soft shape, a colour ramp that turns one soft value into thin bands of colour, and film grain on top. One WebGL fragment shader does all three, and the words go into the same shader so the grain runs through the type too.</p></div>

## The look, in three layers

**1. A soft shape.** Every frame starts as one number per pixel, from 0 (nothing) to 1 (hottest). Rings, a blob, your logo, a grid of commit squares. The trick is that this number has to be soft: gaussians and slow sine waves, never thin lines or raw noise. My first version used thin, sharp rings and it looked cheap. The softness is what makes it feel expensive.

**2. A thermal colour ramp.** Instead of fading between two colours, the value runs through six stops: near black, indigo, cyan, olive, lime, peach. Because the colours change quickly, one smooth glow becomes thin bands of colour, which is where the iridescent, almost metallic feel comes from. It is exactly what a thermal camera does with temperature.

```glsl
vec3 ramp(float v) {
  vec3 c = uC[0];
  for (int i = 1; i < 6; i++) c = mix(c, uC[i], smoothstep(uStop[i - 1], uStop[i], v));
  return c;
}
```

One more line made a big difference: a contrast curve before the ramp, `pow(v, 1.7)`, so only the peaks reach the hot colours and most of the frame stays dark. The reference is mostly dark. Mine was mostly glowing until I added that.

**3. Film grain.** Random noise added to every pixel. Two details matter more than the noise itself:

- **Size it to the frame, not the screen.** One-pixel grain disappears on a Retina display and in exports. Mine is about 2px on a 1080-wide story, so it looks the same everywhere.
- **Refresh it at film rate.** New grain every frame at 60fps looks like TV static. At 24 times a second it shimmers like film.

## Put the words inside the shader

My first version drew the glow in WebGL and the words on a separate 2D canvas with its own grain on top. Two different grains never match, and the type looked stuck on. Now the words are drawn once to an offscreen canvas, handed to the shader as a texture, and mixed in before the grain. One grain covers everything, and the PNG and the video are exactly what you see.

## The shapes

**Rings.** Thick, soft ellipses stacked above and below the middle, small near the centre and wide at the edges, so it reads as a tunnel. Each ring is a gaussian around an ellipse, thicker and hotter the further out it is, and they travel outwards like sound leaving a speaker. They combine like light, `1 - (1 - a) * (1 - b)`, instead of adding up, so neighbouring rings stay separate.

**Aurora.** A few wavy ribbons of light along the top and bottom, each a line with a gaussian cross-section that swells and thins along its length.

**Blobs.** Five soft lights drifting past each other. Use a gaussian falloff, not the classic metaball `1 / distance²`, which gives every blob a hard, hot centre.

**Your mark.** Type a couple of letters or upload a transparent logo. Its shape glows outside and gets a slow diagonal colour sweep inside.

**Globe.** A turning noise planet with soft coasts, dim on purpose, sitting inside the rings.

**Commits.** My real GitHub year, and the one I spent longest on:

- The squares pop in one by one in date order, each with a small overshoot, while the glow builds behind them.
- They are flat tiles coloured by how much I did that day. My first version gave them the logo's shiny fill and they looked like glass. Data should look like data.
- Most days stay a quiet indigo and only the biggest days reach lime and peach. Mapping every day straight onto the full ramp looked like confetti.
- Two soft ripples spread out from my busiest day, lighting up the squares they cross.
- The numbers roll in like a ticker: 8,546 contributions, a 169-day streak, a best day of 128. Each digit scrolls up through 0 to 9 in its own slot and settles, the rightmost spinning most.

## Two bugs worth knowing about

- **Big canvas shadows can crash the GPU.** I drew each glow as a canvas shadow blur. At 2560 × 1440 with 370 commit squares, that made the GPU reset, and the browser dropped the WebGL context. Then, after a few resets, it switched WebGL off for the whole site. A blur does not need detail, so the glow is now drawn at 512px and scaled up. It looks identical and costs almost nothing.
- **Handle a lost context, and do not cause one.** Listen for `webglcontextlost` and `webglcontextrestored` and rebuild when it comes back. And do not call `loseContext()` in a React effect's cleanup: in development React runs effects twice, the canvas survives, and the second run gets a dead context.

## Make one for your own site

Give your AI coding tool this. Swap in your own palette and shapes.

<div class="promptbox">
  <button class="copybtn" type="button" data-copy>Copy prompt</button>
  <div class="prompt">
<p>Build an animated wallpaper generator page with one WebGL fragment shader (plain WebGL, no library). Look: dark charcoal background, soft glowing shapes coloured through a six-stop thermal colour ramp (near black, indigo, cyan, olive, lime, peach), and film grain.</p>
<p>Shader: compute one soft value per pixel from 0 to 1, using only gaussians and slow sine waves, never thin lines or raw noise. Apply pow(v, 1.7) so only the peaks get hot, then map it through the ramp with a chain of mix and smoothstep between the stops. Shapes: (1) rings: thick gaussian ellipses stacked above and below the centre, small in the middle and wide at the edges, travelling outwards and combined with a screen blend; (2) aurora: wavy gaussian ribbons along the top and bottom; (3) blobs: five drifting gaussian lights.</p>
<p>Words: draw the headline and a smaller line under it on an offscreen 2D canvas only when they change, upload it as a texture and mix it in before the grain. Grain: about 2px at 1080 wide (scale it with the frame height), half soft value noise and half per-pixel specks, refreshed 24 times a second, a little stronger in the darks.</p>
<p>Controls: shape, palette, headline, subline, speed, grain, heat, and 9:16, 1:1 and 16:9 frames. Render the preview at the pixels it covers on screen. Save PNG at full size (1080 × 1920, 1440 × 1440, 2560 × 1440) and record 8 seconds of video with canvas.captureStream and MediaRecorder (MP4 where supported, else WebM). Handle webglcontextlost and webglcontextrestored, and respect prefers-reduced-motion by starting paused.</p>
  </div>
</div>

## What I'd tell you before you make one

- **Soft fields, hard ramp.** Keep the shape blurry and let the colour ramp make the bands.
- **Dark by default.** If most of your frame glows, nothing does.
- **One grain for everything.** Glow, type and export should all sit in the same film.

The tool is the lab page itself: [`/lab/afterglow`](/lab/afterglow). Make a wallpaper, record a clip, and send me what you make.
