Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

Of course there's "Fast Inverse Square Root — A Quake III Algorithm"

[0] https://www.youtube.com/watch?v=p8u_k2LIZyo



sort by: page size:

finding an approximate root for these purposes can be really quite fast, as was demonstrated in Quake III. https://en.wikipedia.org/wiki/Fast_inverse_square_root

Also related: Quake III fast inverse square root[1].

[1]: https://github.com/id-Software/Quake-III-Arena/blob/master/c...


Here's a link to the infamous fast inverse square root function: https://github.com/id-Software/Quake-III-Arena/blob/master/c...

I was just talking about this paper with a coworker on Friday.

One of the best parts about this code is its initial implementation in Quake III. The comments are especially funny. It's on Wikipedia - https://en.wikipedia.org/wiki/Fast_inverse_square_root


Fast inverse square root as seen in Quake (as mentioned in other comments)

https://en.wikipedia.org/wiki/Fast_inverse_square_root#Overv...



The Fast Inverse Square Root function from Quake III:

    i  = 0x5f3759df - ( i >> 1 );               // what the fuck?
https://en.wikipedia.org/wiki/Fast_inverse_square_root

Fast inverse square root for computer graphics programming! [1] Popularized by leaked Quake III code (attributed to John Carmack), but dates back much further.

[1] https://en.wikipedia.org/wiki/Fast_inverse_square_root


The famous "fast inverse square root" was in Quake 3.

It's a shame you picked q3's fast inverse square root. It's not a great example as it turns out someone else implemented it in Quake 3 and someone else entirely devised the algorithm itself. Though you're right - he's a bit of a hero and deservedly so.

edit: however ... I've just read that article and it is actually the most in-depth and interesting analysis I've read on the subject so thanks!


did somebody say fast inverse square root algorithm?


Do we have another example than the famous quake fast square root function?

Relevant Quake engine trivia, for those that are interested:

https://en.m.wikipedia.org/wiki/Fast_inverse_square_root



The same trick (approximating with a first order Taylor series), is also the basis of quake's famous fast inverse square root [1]. I love these methods because they always involve a "magic constant".

[1] https://en.m.wikipedia.org/wiki/Fast_inverse_square_root


Wasn't Quake the one where they did a really good approximation of he inverse square root because they needed it?

I wonder whether it still uses fast inverse square root algorithm.

Fast inverse square root[0] is something that I encountered in the mid-2000s in the Q3A source code. It took me a really long time to understand it, and I eventually had to show it to some professors before I really understood what was going on and why this worked.

That's really an example of how arbitrary human thought processes are. When you release the constraint that your code has to have some human-comprehensible analog, you might arrive at interesting results.

[0] https://en.wikipedia.org/wiki/Fast_inverse_square_root

next

Legal | privacy