Phong reflection model: Difference between revisions

Content deleted Content added
No edit summary
4gateftw (talk | contribs)
m #article-section-source-editor
Tags: Mobile edit Mobile app edit iOS app edit
Line 44:
Although the above formulation is the common way of presenting the Phong reflection model, each term should only be included if the term's dot product is positive. (Additionally, the specular term should only be included if the dot product of the diffuse term is positive.)
 
When the color is represented as [[RGB]] values, as often is the case in [[computer graphics]], this equation is typically modeled separately for R, G and B intensities, allowing different reflectionsreflection constants <math>k_\text{a},</math> <math>k_\text{d}</math> and <math>k_\text{s}</math> for the different [[Channel (digital image)|color channels]].
 
=== Computationally more efficient alterations ===
Line 57:
:<math>(1 - \beta\lambda)^\gamma \,=\, (1 - \beta\lambda)^{2^n} \,=\, (1 - \beta\lambda)^{\overbrace{\scriptstyle 2\,\cdot\,2\,\cdot\,\dots\,\cdot\,2}^n} \,=\, (\dots((1 - \beta\lambda)\overbrace{^2)^2\dots)^2}^n.</math>
 
This approximation of the specular term holds for a sufficiently large, integer <math>\gamma</math> (typically, 4 or 8 will be enough).
 
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>, or as <math>\lambda = (\hat{R}_m \times \hat{V})\cdot(\hat{R}_m \times \hat{V}) / 2.</math> The latter is much less sensitive to normalization errors in <math>\hat{R}_m</math> and <math>\hat{V}</math> than Phong's dot-product-based <math>\lambda = 1 - \hat{R}_m \cdot \hat{V}</math> is{{Citation needed|reason=Lyon-1993 does not reference this anywhere|date=April 2022}}, and practically doesn't require <math>\hat{R}_m</math> and <math>\hat{V}</math> to be normalized{{Citation needed|reason=Lyon-1993 does not reference this anywhere|date=April 2022}} except for very low-resolved triangle meshes.