Understanding Fast Inverse Square Root As Used In The Game Quake
I’m no graphics expert, but appreciate why square roots are useful. The Pythagorean theorem computes distance between points, and dividing by distance helps normalize vectors. (Normalizing is often just a fancy term for division).
3D games like Quake divide by distance zillions (yes zillions) of times each second, so “minor” performance improvements help immensely. We don’t want to take the square root and divide the regular way: exponentiation and division are really, really expensive for the CPU.
Given these conditions, there is a magic formula to get 1/sqrt(x) found in the game Quake.”