Shader Learn

A Appendix

Built-in function cheat sheet

Pick a function to plot it. Drag or edit the numbers in the code and the curve follows.

Runs once per pixelDrag numbers, or edit the code

Remember functions by shape: shaping, repeat, periodic and vector cover most shaders. Then learn the traps: mod with negatives, atan’s argument order, smoothstep’s edge order, pow’s negative base.

Try it

  • Swap the two edges in smoothstep: what does the curve become?
  • Change fract(x) to fract(x * 3.0) and count the teeth
  • Compare mod and fract on the negative side
  • Open the pixel debugger, put the pointer on the curve and read x and y