Phong reflection model: Difference between revisions

Content deleted Content added
m Computationally more efficient alterations: Extracted second approximation into own paragraph
Line 52:
:<math>\max(0, \hat{R}_m \cdot \hat{V})^\alpha = \max(0, 1-\lambda)^{\beta \gamma} = \left(\max(0,1-\lambda)^\beta\right)^\gamma \approx \max(0, 1 - \beta \lambda)^\gamma </math>
 
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. Furthermore,This approximation of the valuespecular term holds for a sufficiently large, integer <math>\lambdagamma</math> can(typically, be4 approximatedor as8 <math>\lambdawill =be (\hat{R}_menough). -If \hat{V})\cdot(\hat{R}_mthis -value \hat{V})is /chosen 2</math>;to thisbe squareda distancepower betweenof the2, vectorsi.e. <math>\hat{R}_mgamma = 2^n</math> andwhere <math>\hat{V}n</math> is muchan lessinteger, sensitivethen tothe normalizationexpression errors<math>(1 in- those\beta\lambda)^\gamma</math> vectorscan thanbe whatmore Phong'sefficiently dot-product-basedcalculated by squaring <math>\lambda = (1 - \hat{R}_m beta\cdot lambda)\hat{V} n</math> istimes.
 
This approximation ofFurthermore, the specular term holds for a sufficiently large, integervalue <math>\gammalambda</math> (typically,can 4be orapproximated 8as will<math>\lambda be= enough).(\hat{R}_m If- this\hat{V})\cdot(\hat{R}_m value- is\hat{V}) chosen/ to2</math>; bethis asquared powerdistance ofbetween 2,the i.e.vectors <math>\gamma = 2^nhat{R}_m</math> whereand <math>n\hat{V}</math> is anmuch integer,less thensensitive theto expressionnormalization <math>(1errors -in \beta\lambda)^\gamma</math>those canvectors bethan morewhat efficientlyPhong's calculated by squaringdot-product-based <math>(\lambda = 1 - \betahat{R}_m \lambda)cdot \ nhat{V}</math> timesis.
 
This method substitutes a few multiplications for a variable exponentiation, and removes the need for an accurate reciprocal-square-root-based vector normalization.