November 2019
Intermediate to advanced
404 pages
12h 9m
English
Complicated mathematics can severely bottleneck the rendering process, so we should do whatever we can to limit the damage. It is entirely possible to store a map of complex mathematical function outputs by precalculating them and placing them as floating-point data in a texture file. A texture file is, after all, just a huge blob of floating-point values that can be indexed quickly with three dimensions: x, y, and color (rgba).
We can feed this texture into the shader and sample the pre-generated table in the shader at runtime instead of completing a complex calculation at runtime.
We may not see any improvement with functions such as sin() and cos() since they've been heavily optimized to make use of GPU ...
Read now
Unlock full access