Shader Learn

01 Fragments and data

One rule paints the whole picture

Drag the radius. Every position runs the same program and gets its own colour.

0.050.48
0.0010.2
ExerciseEdit code0%

Turn the circle into a square — by editing code, not dragging sliders

Runs once per pixelDrag numbers, or edit the code

JS sidegl.uniform2f(uResolution, …, …)

Vertices set shape and position → fragments compute colour → the picture appears. Same code, different position, different result.

Try it

  • Make the circle’s edge very blurry
  • Open “Pixel debugger”, put the pointer on the circle’s edge and read d and circle