THE READING ROOM / BOOK GUIDE
The Book of Shaders
A guide to fragment shaders, the small programs that set the color of each pixel, with runnable examples in the browser.
About the book
The Book of Shaders is a free, web-based text about writing fragment shaders, the short programs that run once per pixel and decide its color. Its subject is the fragment stage of the graphics pipeline, where math becomes light, pattern, and motion. The material uses GLSL and the browser, so readers can edit code and see results without installing a graphics stack.
The approach is visual and incremental. It begins with the idea of a shader as a function of position and time, then moves toward noise, distance fields, and procedural pattern. Examples are meant to be changed rather than copied. A companion site hosts runnable sketches, which matters for a subject where a single wrong sign flips an image.
This is a text about craft, not engine architecture. It does not survey renderers, asset pipelines, or performance tuning at scale. Its center is the pixel program and the habits of thinking in coordinates, vectors, and continuous functions.
How to read it
Read with the editor open. Type the examples, break them, and change one variable at a time. Shader debugging is visual, and the book rewards readers who treat each snippet as a small experiment rather than a listing to admire.
The math arrives as needed: dot products, interpolation, and periodic functions recur. Readers rusty on linear algebra should pause on those sections rather than skim, because later patterns assume them. The prose is plain and the pace steady, though density rises once noise and signed distance fields appear.
Who it suits
This suits programmers who know a language such as JavaScript or C and want to understand what happens between geometry and final color. Designers and generative artists who work with code will find a direct route to procedural texture and motion. Readers who prefer a project-driven path over formal graphics theory will get the most from it.
Reading considerations
The material is tied to GLSL in a browser context, so readers working in other shading languages will need to translate syntax and check what their platform supports. Web graphics practices change, so verify specific API details against current documentation.
Follow the HN conversation
39 different recommenders are recorded in the upstream dataset. These are AI-classified source counts, not an independent rating.
Search HN comments about this book ↗
Explore videos on the same subject ↗
Book notes prepared with DeepSeek, using catalogue records and Open Library subject information. They are reading guidance, not a personal review or a verified chapter-by-chapter account. Book details can vary by edition. HN data methodology · Book metadata and covers.
