/

Experiment

Experiment

2025

WebGL, GLSL

Shader gradients

Mesh gradients you can paint.

Camera report

Scene

Experiment

Year

2025

Tools

WebGL, GLSL

The idea

Mesh gradients look great in a design file and terrible as exported PNGs. I wanted gradients that stay sharp at any size and can be painted, not just picked.

Four colour points you can drag, a little grain, and a slow drift so the page never looks frozen.

How it's built

A single fragment shader in WebGL. The colour points are uniforms, the blend is a weighted distance field, and the grain is a cheap hash so it costs nothing to animate.

  • One full-screen triangle, one shader, no library

  • Colour points dragged straight on the canvas

  • Grain added in the shader to hide banding

  • Falls back to a CSS gradient when WebGL is off

precision mediump float;
uniform vec2 p[4]; uniform vec3 c[4];
varying vec2 uv;
void main(){
  vec3 col = vec3(0.0); float t = 0.0;
  for(int i=0;i<4;i++){ float w = 1.0/pow(distance(uv,p[i])+0.05,2.0); col += c[i]*w; t += w; }
  gl_FragColor = vec4(col/t, 1.0);
}
precision mediump float;
uniform vec2 p[4]; uniform vec3 c[4];
varying vec2 uv;
void main(){
  vec3 col = vec3(0.0); float t = 0.0;
  for(int i=0;i<4;i++){ float w = 1.0/pow(distance(uv,p[i])+0.05,2.0); col += c[i]*w; t += w; }
  gl_FragColor = vec4(col/t, 1.0);
}
precision mediump float;
uniform vec2 p[4]; uniform vec3 c[4];
varying vec2 uv;
void main(){
  vec3 col = vec3(0.0); float t = 0.0;
  for(int i=0;i<4;i++){ float w = 1.0/pow(distance(uv,p[i])+0.05,2.0); col += c[i]*w; t += w; }
  gl_FragColor = vec4(col/t, 1.0);
}

What I learned

Banding is the real enemy of gradients. A tiny amount of noise does more for quality than any extra colour stop.

  • Add grain before you add colours

  • Keep a CSS fallback that looks intentional

The best gradient is the one nobody calls a gradient.

FRAME 10 — Contact

Have a project? Let’s shoot.

Tell me what you are making. I reply within a day with next steps and a rough plan.

Studio 1 · Rec

Studio 1 · Rec

Studio 1 · Rec

Prod.

Portfolio 2026

Scene

Footer

Take

1

Roll

A-09

Director

Mara Voss

Date

27.10.26

Build

main · 9f3c1a

That’s a wrap.

Thanks for watching to the end. Say hello, I read every message and reply within a day.

Write to me

© 2026 Mara Voss

Local time

09:00

· Berlin

Back to top

↑

Create a free website with Framer, the website builder loved by startups, designers and agencies.