Craft — 3 min
What Shaders Taught Me About Design
18 June 2025
Before I wrote my first fragment shader, I thought of an image as a fixed thing — pixels, baked in, final. A shader can't think that way. Every pixel is the output of a small function run fresh, sixty times a second, with no memory of what came before unless you explicitly feed it back in. You're not painting. You're describing a process that happens to look like a painting if you get the math right.
That shift — from "what does this look like" to "what process produces this" — turned out to be a useful lens for interface design generally, not just for GPU code.
float wave(vec2 uv, float time) {
float d = length(uv);
return sin(d * 18.0 - time * 2.4) * 0.5 + 0.5;
}
A layout is a function of its inputs
Once you've spent time writing uv coordinates by hand, you start seeing every component the same way: given these inputs — viewport width, data length, scroll offset, hover state — what should this look like? A card grid isn't a fixed arrangement, it's a function from an array to a layout. Thinking in that direction makes responsive and empty states feel like the same problem as the happy path, instead of an afterthought bolted on at the end.
Cheap tricks read as expensive when they're precise
The liquid-metal field in this site's hero is, under the hood, a few octaves of simplex noise, a fresnel term, and a chromatic aberration pass in post-processing — nothing a modern laptop GPU notices. What makes it read as "expensive" isn't complexity, it's precision: the noise frequency was tuned by hand over an evening until the motion felt unhurried instead of nervous, and the bloom is dialed down until it's almost not there. The lesson generalises past shaders: restraint applied with precision beats complexity applied generally, nearly every time.
Debugging a shader is debugging your assumptions
When a shader is wrong, it's rarely wrong in a way that throws an error — it's wrong in a way that looks like static, or a flat color, or a shape that's subtly the wrong size. You debug by visualizing intermediate values as color, one variable at a time, until you find the one that doesn't behave the way you assumed. It's the most honest kind of debugging I've done, and it's made me far more suspicious, in every other part of a codebase, of code that "looks right" without being checked against what it actually produces.
Three months into writing shaders regularly, I shipped fewer bugs in ordinary React components — not because the skills transferred directly, but because the discipline of checking assumptions against output, instead of against intention, did.