How video games use lookup tables
Lookup tables (LUTs) are highlighted as a core technique for squeezing complex behavior and rich visuals out of limited hardware, from early consoles like the NES, SNES, and Game Boy Advance to modern GPUs running WebGL shaders. Commenters share how LUTs power everything from color grading, palette swaps, tunnels, lighting, and “fake” physics to business rule engines and dynamic programming tabulation, contrasting their strengths on GPUs with cache-unfriendly uses on CPUs. The thread also touches on how these precomputed tables enable deterministic game logic, advanced retro effects, and end‑user configurable systems, while noting trade-offs in memory, precision, and usability.
Overall reception & presentation
- Many readers found the article clear, fun, and technically insightful, especially the interactive WebGL samples and ability to upload data.
- Some criticized the heavy use of animated GIFs / autoplaying videos as distracting and battery-unfriendly; the author acknowledged this and considered adding explicit pause controls in the future.
LUTs in modern game graphics
- Commenters emphasized that 3D LUTs for color grading are standard in modern game pipelines, from large AAA to sizable indie titles, not a niche trick.
- Prescaling or “preshaping” with 1D LUTs before 3D LUTs was highlighted as a common way to handle HDR tone mapping.
Retro and engine techniques
- Classic examples: Doom’s pseudorandom-number table makes the engine deterministic, enabling compact demo recording and “seed runs.” Other deterministic games like Factorio were mentioned as similar in spirit.
- Older consoles and PCs used LUTs for trig (e.g., SNES Doom, NES/SNES-era effects), fixed-function color mapping, palette swapping, and division or multiply emulation.
- NES and GBA examples showed LUTs enabling lighting, water, and fog effects that would otherwise exceed CPU/FPU capabilities.
Palettes, color cycling, and asset reuse
- LUTs were likened to color palettes: “palette swaps” and palette cycling enable recoloring sprites, fake animation, tunnels/wormholes, and lighting ramps (e.g., Quake’s colormap).
- There were conflicting views on why palettes “fell out of favor”:
- Some blamed hardware limitations on specific consoles.
- Others said larger memories and true-color framebuffers simply removed the necessity.
- Several argued the technique is still powerful but under-taught to artists.
Performance, hardware, and caching vs LUTs
- Multiple comments contrasted GPU LUTs (with dedicated constant memory and predictable access) to CPU-side LUTs, which often perform worse than simple math due to cache behavior.
- Examples from consoles and 3DFX-era PCs described explicit cache locking and carefully controlled memory patterns to accelerate table-based operations.
- A related discussion distinguished caching, memoization, and tabulation, framing LUTs as fixed-size precomputed tabulations.
Beyond graphics: business logic, DP, and FPGA
- In “boring” business code, large lookup tables can replace complex conditionals and empower non-developers to configure behavior, though some warned this can evolve into a domain-specific language.
- LUTs were cited as central in FPGA design (hardware LUT primitives) and for implementing tunnels, fractals, and integer math on constrained hardware.