Every frame of every video game is built by your graphics card from millions of tiny calculations: triangles are positioned, pixels are coloured, textures are read and light is faked in clever ways. Fragment Shack is a place to learn how all of that works, one idea at a time, by playing with it.

Who it’s for

Fragment Shack is written for beginners. If you’ve played a video game and wondered how the picture gets on the screen, you’re in the right place. You don’t need to be a programmer, and you don’t need much maths: where a post needs some, it explains it from scratch.

If you already write shaders or game engines, you should still find something new, especially in the parts that explain what the hardware and drivers are doing behind the scenes.

How the posts work

Every post is built around interactive demos. Most run live on your own graphics card, using WebGL (the browser’s built-in way of letting a web page use the graphics card); a few, such as the maths diagrams and the simulations of what happens inside the hardware, are drawn by ordinary JavaScript in the browser. You’ll find sliders, menus and buttons to tweak, and things you can drag around. The text explains the idea; the demos let you see it, test it and break it. Reading that distant textures can shimmer is one thing; switching off the fix and watching a floor sparkle in front of you is another.

Each post:

  • Teaches one main idea, and takes about 10 minutes to read and play with (the estimate at the top of each post allows 200 words a minute for reading, plus a minute and a half for each demo)
  • Has at least one interactive demo, with a short explanation of what it shows and what to try
  • Includes “Under the hood” boxes explaining what the graphics card and its driver are actually doing
  • Ends with further reading, so you can go deeper
Under the hood Boxes like this one appear throughout the site. They're optional, but they explain what's happening inside the hardware, which is where a lot of the "why" lives.

Where to start

Posts are grouped into series: short learning paths meant to be read in order.

  • New to graphics? Start with Graphics Fundamentals. It goes from “what is a pixel?” all the way to lighting a 3D object, and every later post builds on it. When a post links to a maths post, open it then: Maths for Graphics explains vectors, angles, blending and rays gently, with demos, exactly when you need them.
  • Know the basics? Jump into whichever series catches your eye, or search for a specific technique.

You can also browse by tag or see every post.

What you need

A modern web browser on a computer, tablet or phone. The demos use WebGL2, which every current major browser supports. Animated demos only run while they’re on screen, and don’t start by themselves if your device is set to reduce motion.

The demos run on whatever graphics hardware you have, so a few of them can show slightly different results on different devices. Where that happens, the post explains why, because those differences are often interesting in their own right.

If the demos don’t appear

If a demo shows a “needs WebGL2” message instead of running, try these in order:

  1. Update your browser to the latest version.
  2. Turn on hardware acceleration. In Chrome and Edge it’s in Settings, under System, called “Use graphics acceleration when available”. In Firefox it’s in Settings, under General, then Performance. Restart the browser afterwards.
  3. Try a different browser. Current versions of Chrome, Edge, Firefox and Safari all support WebGL2.
  4. Check your device at get.webgl.org/webgl2, which tells you whether WebGL2 works there at all. Some older or locked-down computers, and some remote desktops, switch it off.

Each demo shows a still picture in its place while it can’t run, so the text around it still makes sense.

Why “Fragment Shack”?

In graphics, a fragment is a candidate pixel: when the graphics card draws a triangle, it produces a fragment for each pixel the triangle covers, and runs a small program called a fragment shader to decide its colour. Fragments are where triangles become pictures, and that’s what this site is about. The shack is just where we keep them.

Welcome in, and have fun breaking things.

Start at part 1 Browse the series