Content deleted Content added
m →Computationally more efficient alterations: Extracted second approximation into own paragraph |
→Computationally more efficient alterations: Added cross product approximation. The other approximation using only the difference between R and V doesn't guarantee to give good results if R and V are not normalized |
||
Line 54:
where <math>\lambda = 1 - \hat{R}_m \cdot \hat{V}</math>, and <math>\beta = \alpha / \gamma\,</math> is a real number which doesn't have to be an integer. This approximation of the specular term holds for a sufficiently large, integer <math>\gamma</math> (typically, 4 or 8 will be enough). If this value is chosen to be a power of 2, i.e. <math>\gamma = 2^n</math> where <math>n</math> is an integer, then the expression <math>(1 - \beta\lambda)^\gamma</math> can be more efficiently calculated by squaring <math>(1 - \beta\lambda)\ n</math> times.
Furthermore, the value <math>\lambda</math> can be approximated as <math>\lambda = (\hat{R}_m - \hat{V})\cdot(\hat{R}_m - \hat{V}) / 2</math>
This method substitutes a few multiplications for a variable exponentiation, and removes the need for an accurate reciprocal-square-root-based vector normalization.
|