3 ms·
Some context : I was learning about rational trigonometry[1] and wanted to know if it can be used in computer graphics. I thought about John Carmack inventing
by grondilu 10y ago
Some context : I was learning about rational trigonometry[1] and wanted to know if it can be used in computer graphics. I thought about John Carmack inventing his own square root function[2] because vector normalization is often needed and it requires evaluating a square root. Usually this happens while computing specular reflection.
I looked at Phong's reflection model[3] and saw that the specular part requires a power of the cosine. The exponent is called "shininess".
I wondered if it's possible to compute this power of a cosine without having to normalize vectors.
Turns out it's possible, as long as shininess is an even integer.
1. https://en.wikipedia.org/wiki/Rational_trigonometry https://en.wikipedia.org/wiki/Rational_trigonometry
2. https://en.wikipedia.org/wiki/Fast_inverse_square_root https://en.wikipedia.org/wiki/Fast_inverse_square_root
3. https://en.wikipedia.org/wiki/Phong_reflection_model https://en.wikipedia.org/wiki/Phong_reflection_model