Shader lessons
Short explanations with one picture to match each. Go in order: every lesson adds one idea. New to shaders? Read how to learn shader programming first.
Start here
0 of 2 solvedPixel basics
0 of 8 solved- UV: where am I? Make a gradient: black on the left, full red on the right. Not started Read

- Two axes Red grows to the right, green grows upward, blue is a constant 0.5. Not started Read

- Vectors & swizzling Swap the roles: red should follow the vertical axis and green the horizontal one. Not started Read

- step() and lerp() Split the screen down the middle: color A on the left, color B on the right. Not started Read

- smoothstep(): soft edges Instead of a hard split, fade from the dark color to the orange between x = 0.3 and x = 0.7. Not started Read

- Center, distance & aspect ratio Make the circle truly round by correcting for the aspect ratio. Not started Read

- Distance fields & antialiasing Turn the solid disc into a glowing ring: radius 0.3, soft edge width 0.02. Not started Read

- Time: make it move Make the ring pulse: radius = 0.25 + 0.08 × sin(time × 3). Not started Read

2D toolkit
0 of 8 solved- Repeating: floor & frac Draw an 8×6 checkerboard of black and white. Not started Read

- Moving a shape (the key trick) Draw the yellow disc (radius 0.2) centred 0.3 to the right and 0.15 up from the middle. Not started Read

- Scaling a shape Draw a box (half-size 0.1 by 0.08) and stretch it to twice the width by dividing p. Not started Read

- Turning a quarter turn Draw a horizontal bar with a square on its right end, turned by a quarter turn using p = float2(-p.y, p.x). The square… Not started Read

- Turning by any angle (sin and cos) Take the same bar-with-a-square shape and turn it by 0.5 radians (about 29 degrees) using c and s, no matrices. Not started Read

- Rotation & matrices Spin the box: rotate p by an angle equal to time (in radians) before computing the distance. Not started Read

- Cosine palettes Make a rainbow that scrolls: t = uv.x + time × 0.2. Not started Read

- Polar coordinates Build the spinning pinwheel: wedge pattern sin(a × 6 + time × 2), clipped to a disc of radius 0.4 with a soft edge. Not started Read

Noise
0 of 6 solved- Randomness without random() Make TV-static blocks: a 20×15 grid where each cell is a grey level from hash(cell). Not started Read

- Smooth randomness, step 1: blend two values Plot the curve n as a thin cyan line on the dark background (8 cells across, hash from the Toolbox). Not started Read

- Smooth randomness, step 2: soften the corners Draw the plain blend as a red curve and the softened blend as a green curve in the same picture. Not started Read

- Value noise (smooth randomness) Write vnoise() and display it at scale 8x6 as grey. Not started Read

- Noise on noise: add layers by hand Show three layers of noise added together as grey. Not started Read

- Fractal noise (fBm) Write fbm() with 5 octaves (amp 0.5 → halved each time, frequency doubled each time) and display fbm(uv × float2(6… Not started Read

3D with raymarching
0 of 7 solved- Fake 3D: normals & light Shade the disc as a sphere: compute z and the normal, then diffuse light from the given direction. Not started Read

- 3D, step 1: every pixel has a ray Show every pixel's ray direction as a colour: float4(0.5 + 0.5 * rd, 1.0). Not started Read

- 3D, step 2: is a point inside the sphere? Colour pixels orange when the point 3 units along their ray is inside the sphere (radius 1 at the origin), otherwise… Not started Read

- 3D, step 3: walk along the ray Walk each ray in steps of 0.1 (up to 60 steps). Hit pixels show their depth as grey, misses stay dark. Not started Read

- 3D, step 4: smart steps (sphere tracing) Use smart steps and show the step count as grey: saturate(steps / 12.0). Not started Read

- 3D, step 5: which way does the surface face? Ray march the sphere (smart steps) and colour hit pixels by their normal; misses stay dark. Not started Read

- Raymarching: put it all together Build the whole raymarcher: map() with a sphere, the ray loop, calcNormal from the Toolbox, and diffuse light. Not started Read

Unity bridge
0 of 0 solvedMesh shaders (Three.js)
0 of 5 solved- Real 3D: vertex & fragment shaders Color the sphere by its normals: red = facing +x, green = facing +y, blue = facing +z. Not started Read

- Diffuse light on a torus Light the torus from one direction with a little ambient light. Not started Read

- Fresnel rim glow A dark blue knot with a cyan glow around the edges. Not started Read

- Your first vertex shader: waves Make the plane ripple with a 2D wave and light it using i_faceNormal. Not started Read

- Push vertices along their normals Make rings of bulges travel up the sphere. Not started Read

Advanced shaders
0 of 19 solved- Ocean 1: a surface made of waves Write waveH(): the sum of five moving sine waves. Show it from above as a color map. Not started Read

- Ocean 2: standing in the sea Ray march the waves from a camera above the sea, light them with the sun, and fill the sky with a flat color. Not started Read

- Ocean 3: sky, Fresnel and sun glitter Give the sea a real sky with a sun, mix the water and the reflected sky with a Fresnel factor, and add the sun glitter. Not started Read

- Ocean 4: foam, fine ripples and haze Add two small high-frequency waves, whitecap foam with lacy edges, and distance haze to the finished sea. Not started Read

- Clouds 1: noise in three dimensions Show a moving slice through 3D fractal noise: white clouds on a blue sky. Not started Read

- Clouds 2: marching through the volume Fly the camera forward through a cloud layer. Walk each ray in 44 steps, track how much light is blocked, and blend… Not started Read

- Clouds 3: light and shadow inside the cloud Light the cloud: for every step inside the cloud, sample the density towards the sun to get a shadow, and add the lit… Not started Read

- Smoke grenade 1: a ball of smoke Draw the expanding smoke ball: noisy-edged density, marched inside its bounding sphere, evenly grey, in front of a sky… Not started Read

- Smoke grenade 2: light and a floor Light the smoke with a shadow lookup towards the sun, and put a checkered floor and horizon haze behind it. Not started Read

- Smoke grenade 3: bullet holes Carve four bullet tunnels into the smoke: each is a line fired at its own time, with a radius that shrinks as the… Not started Read

- Snow 1: a field of snow Draw rolling snow dunes with lumpy noise, lit by a low sun with blue shadows, fading into the sky with fog. Not started Read

- Snow 2: footprints Add ten footprints to the height function: oval pits with raised rims, left and right feet turned a little, appearing… Not started Read

- Snow 3: sparkle Add flickering ice glints to the snow: a very fine random grid, a few cells flash, each with its own phase, only in… Not started Read

- Fire 1: a flame you can see into March a ray through a swaying, turbulent flame column and add up its glow: hot at the base, cooler at the tip, on a… Not started Read

- Fire 2: a campfire at night Make it a campfire: the flame lights the ground around it with a flickering glow, and 14 embers rise and fade. Not started Read

- Smoke simulation 1: a flow field from noise Write flow(q): the curl of a slowly scrolling noise. Show it as colors: red = sideways flow, green = upward flow. Not started Read

- Smoke simulation 2: follow the smoke back to its source Trace each pixel back along the flow to the chimney. Where it started inside the chimney it is smoke, thinner the… Not started Read

- Water simulation 1: one drop Make a ring that spreads from a drop at the centre: a wave packet that fades with time. Show a stony pond bed through… Not started Read

- Water simulation 2: rain on the pond Sum the ripples of eight drops at random places and times. Rings from different drops should cross and add up. Not started Read




