How the classic demoscene effects work
Most demo effects are a simple formula evaluated for every pixel, every frame. In ASCII, each character cell plays the part of a pixel and a ramp of characters stands in for the palette:
- Fire: the bottom row is seeded with hot values, and each cell above takes a cooled average of the cells beneath it, so heat rises and fades into tongues.
- Plasma: several sine waves over x, y and time are added together, and the sum indexes a cycling color palette.
- Tunnel: each cell's angle and distance from the center become texture coordinates, and scrolling the distance flies you forward.
- Rotozoomer: the texture coordinates of every cell are rotated and scaled each frame over a repeating pattern, such as x XOR y.
- Metaballs: each blob adds a field that falls off with distance, and cells above a threshold light up, so nearby blobs merge.
- Raycasting: Endless Corridor casts a ray for each column to find the nearest wall, the trick behind early first-person views.
