Lookup tables are great to produce impressive graphics effects under strict
compute limits. I use them in many FPGA projects. On FPGA there is a balance
between limited memory (often BRAM) and limited compute, but they can be used to
great effect:
Tunnel effect (exactly as user bemmu described below):
Sine tables are also very typical, for animating things on screen or plain
trigonometry, for instance my small fixed integer raytracer uses a sine table
to animate the spheres (and the cos is easy to get from the sin, especially if
the table has a power of two size ;) ):
Tunnel effect (exactly as user bemmu described below):
- see it live: https://htmlpreview.github.io/?https://github.com/sylefeb/gf...
- lookup table: https://github.com/sylefeb/gfxcat/blob/main/tunnel/tunnel.h
- how it is computed: https://github.com/sylefeb/Silice/blob/master/projects/ice-v...
Julia fractal, with a table to do integer multiply! (2.a.b = (a+b)^2 - a^2 - b^2, so just precompute all x^2 in a table! )
- see it live: https://htmlpreview.github.io/?https://github.com/sylefeb/gf...
- code (see 'sq' table): https://github.com/sylefeb/gfxcat/blob/main/julia/julia.c
- credits (mul trick): http://cowlark.com/2018-05-26-bogomandel/index.html
In-hardware lookup division for perspective correct texturing!
- doom-chip on-ice (rC3 2021 talk): https://www.youtube.com/watch?v=2ZAIIDXoBis
- detailed write up: https://github.com/sylefeb/tinygpus?tab=readme-ov-file#preco...
- actual lookup table generation: https://github.com/sylefeb/tinygpus/blob/498be1b803d0950328a...
Sine tables are also very typical, for animating things on screen or plain trigonometry, for instance my small fixed integer raytracer uses a sine table to animate the spheres (and the cos is easy to get from the sin, especially if the table has a power of two size ;) ):
- see it live: https://htmlpreview.github.io/?https://github.com/sylefeb/gf...
- source code: https://github.com/sylefeb/gfxcat/blob/main/raytrace/raytrac...
And of course procedural textures!! Perlin noise is made of lookup tables, and often multiple lookups are combined to then lookup a clolormap (https://redirect.cs.umbc.edu/~ebert/691/Au00/Notes/procedura...)
There are so many other examples. Also, FPGAs are quite literally made of LookUp Tables, or LUTs:
- https://github.com/sylefeb/Silice/tree/master/learn-silice#f...
- https://github.com/sylefeb/silixel
(edit: formatting)