|
|
Line 1: |
Line 1: |
| {{Refimprove|date=February 2008}}
| | Adrianne Le is the advertsing name my parents gave i but you can get in touch with me anything you just like. My house is now in South Carolina. Filing is my [http://browse.deviantart.com/?qh=§ion=&global=1&q=day+job day job] but but soon I'll nevertheless be on my own. What me and my family absolutely love is acting but As well as can't make it a profession really. See what's new on my website here: http://Prometeu.net/<br><br>Here is my web-site [http://Prometeu.net/ hack clash of clans jailbreak] |
| | |
| [[File:Specular highlight.jpg|frame|Specular highlights on a pair of spheres.]]
| |
| | |
| A '''specular highlight''' is the bright spot of [[light]] that appears on shiny objects when illuminated (for example, see image at right). Specular highlights are important in [[3D computer graphics]], as they provide a strong visual cue for the shape of an object and its location with respect to light sources in the scene.<!-- <br style="clear:both"/> -->
| |
| | |
| ==Microfacets==
| |
| | |
| The term ''specular'' means that light is [[specular reflection|perfectly reflected]] in a mirror-like way from the light source to the viewer. Specular reflection is visible only where the [[surface normal]] is oriented precisely halfway between the direction of incoming light and the direction of the viewer; this is called the '''half-angle''' direction because it bisects (divides into halves) the angle between the incoming light and the viewer. Thus, a specularly reflecting surface would show a specular highlight as the perfectly sharp reflected image of a light source. However, many shiny objects show blurred specular highlights.
| |
| | |
| This can be explained by the existence of '''microfacets'''. We assume that surfaces that are not perfectly smooth are composed of many very tiny facets, each of which is a perfect specular reflector. These microfacets have normals that are distributed about the normal of the approximating smooth surface. The degree to which microfacet normals differ from the smooth surface normal is determined by the roughness of the surface. At points on the object where the smooth normal is close to the half-angle direction, many of the microfacets point in the half-angle direction and so the specular highlight is bright. As one moves away from the center of the highlight, the smooth normal and the half-angle direction get farther apart; the number of microfacets oriented in the half-angle direction falls, and so the intensity of the highlight falls off to zero.
| |
| | |
| The specular highlight often reflects the color of the light source, not the color of the reflecting object. This is because many materials have a thin layer of clear material above the surface of the pigmented material. For example plastic is made up of tiny beads of color suspended in a clear polymer and human skin often has a thin layer of oil or sweat above the pigmented cells. Such materials will show specular highlights in which all parts of the color spectrum are reflected equally. On metallic materials such as gold the color of the specular highlight will reflect the color of the material.
| |
| | |
| ==Models of microfacets==
| |
| | |
| A number of different models exist to predict the distribution of microfacets. Most assume that the microfacet normals are distributed evenly around the normal; these models are called '''[[isotropy|isotropic]]'''. If microfacets are distributed with a preference for a certain direction along the surface, the distribution is '''[[Anisotropy|anisotropic]]'''.
| |
| | |
| NOTE: In most equations, when it says <math>(\hat{A} \cdot \hat{B})</math> it means <math>\max( 0, (\hat{A} \cdot \hat{B}))</math>
| |
| | |
| ===Phong distribution===
| |
| | |
| In the [[Phong reflection model]], the intensity of the specular highlight is calculated as:
| |
| | |
| :<math>k_\mathrm{spec} = \|R\|\|V\|\cos ^n\beta = (\hat{R} \cdot \hat{V})^n</math>
| |
| | |
| Where ''R'' is the mirror reflection of the light vector off the surface, and ''V'' is the viewpoint vector.
| |
| | |
| In the [[Blinn–Phong shading model]], the intensity of a specular highlight is calculated as:
| |
| | |
| :<math>k_\mathrm{spec} = \|N\|\|H\|\cos ^n\beta = (\hat{N} \cdot \hat{H})^n</math>
| |
| | |
| Where ''N'' is the smooth surface normal and ''H'' is the half-angle direction (the direction vector midway between ''L'', the vector to the light, and ''V'', the viewpoint vector).
| |
| | |
| The number ''n'' is called the Phong exponent, and is a user-chosen value that controls the apparent smoothness of the surface. These equations imply that the distribution of microfacet normals is an approximately [[Gaussian distribution]] (for large <math>n</math>), or approximately [[Pearson distribution|Pearson type II distribution]], of the corresponding angle.<ref>Richard Lyon, "Phong Shading Reformulation for Hardware Renderer Simplification", Apple Technical Report #43, Apple Computer, Inc. 1993 [http://dicklyon.com/tech/Graphics/Phong_TR-Lyon.pdf PDF]</ref> While this is a useful [[Heuristic#Computer science|heuristic]] and produces believable results, it is not a physically based model.
| |
| | |
| :Another similar formula, but only calculated differently:
| |
| :<math>k=(\vec{L}\cdot\vec{R})^n=[\vec{L}\cdot (\vec{E}-2\vec{N}(\vec{N}\cdot \vec{E}))]^n,</math>
| |
| :where '''R''' is an eye reflection vector, '''E''' is an eye vector (view vector), '''N''' is surface normal vector. All vectors are normalized (<math> \|\vec{E}\|=\|\vec{N}\|=1</math>). '''L''' is a light vector. For example, <math>\vec{N}=\{0;\; 1; \; 0\}; \;\; \vec{E}=\{\frac{\sqrt{3}}{2}; \; \frac{1}{2}; \; 0\}; \;\; \vec{L}=\{-0.6; \; 0.8; \; 0\}; \;\; n=3</math> then:
| |
| :<math>k=[\vec{L}\cdot (\vec{E}-2\vec{N}(\vec{N}\cdot \vec{E}))]^n=[\vec{L}\cdot (\vec{E}-2\vec{N}(0\cdot \frac{\sqrt{3}}{2}+1\cdot 0.5 +0\cdot 0))]^3=</math>
| |
| :<math>=[\vec{L}\cdot (\vec{E}-\vec{N})]^3=[\vec{L}\cdot (\{\frac{\sqrt{3}}{2}-0; \; \frac{1}{2}-1; \; 0-0\})]^3=[-0.6\cdot\frac{\sqrt{3}}{2}+ 0.8\cdot (-0.5)+ 0\cdot 0]^3=(-0.5196-0.4)^3=0.9196^3=0.7777.</math>
| |
| :Approximate formula is this:
| |
| :<math>k=(\vec{N}\cdot \vec{H})^n=(\vec{N} \cdot ((\vec{L} + \vec{E}) / 2))^n=(\vec{N} \cdot ((\{ -0.6+\frac{\sqrt{3}}{2}; \; 0.8+0.5; \; 0+0 \}) / 2))^3=(\vec{N} \cdot ((\{ 0.266; \; 1.3; \; 0 \}) / 2))^3=</math>
| |
| :<math>=(\vec{N} \cdot (\{ 0.133; \; 0.65; \; 0 \}))^3=(0\cdot 0.133 + 1\cdot 0.65 + 0 )^3=0.65^3=0.274625.</math>
| |
| :If vector '''H''' is normalized <math>\frac{\vec{H}\{ 0.133; \; 0.65; \; 0 \}}{\|\vec{H}\|}=\frac{\vec{H}\{ 0.133; \; 0.65; \; 0 \}}{\sqrt{0.133^2+0.65^2}}=\frac{\vec{H}\{ 0.133; \; 0.65; \; 0 \}}{0.668}=\{0.20048; 0.979701 ; 0 \},</math> then
| |
| :<math>k=(\vec{N}\cdot \vec{H})^n=(0\cdot 0.2+1\cdot 0.9797+0\cdot 0)^3=0.979701^3=0.940332.</math>
| |
| | |
| ===Gaussian distribution===
| |
| | |
| A slightly better model of microfacet distribution can be created using a [[Gaussian distribution]].{{citation needed|reason=Why is this model better?|date=February 2011}} The usual function calculates specular highlight intensity as: <!-- Note that this model will give almost the same result as the Blinn–Phong shading model for sufficiently small m; see talk page -->
| |
| | |
| :<math>k_\mathrm{spec} = e^{- \left ( \frac{\angle (N, H)}{m} \right )^2}</math>
| |
| | |
| where ''m'' is a constant between 0 and 1 that controls the apparent smoothness of the surface.<ref>[[Andrew Glassner|Glassner, Andrew S.]] (ed). An Introduction to Ray Tracing. San Diego: Academic Press Ltd, 1989. p. 148.</ref>
| |
| | |
| ===Beckmann distribution===
| |
| | |
| A physically based model of microfacet distribution is the Beckmann distribution:<ref>Petr Beckmann, André Spizzichino, The scattering of electromagnetic waves from rough surfaces, Pergamon Press, 1963, 503 pp (Republished by Artech House, 1987, ISBN 978-0-89006-238-8).</ref>
| |
| | |
| :<math>k_\mathrm{spec} = \frac{\exp{\left(-\tan^2(\alpha)/m^2\right)}}{\pi m^2 \cos^4(\alpha)}, ~ \alpha = \arccos(N \cdot H)</math>
| |
| | |
| where ''m'' is the [[Root mean square|rms]] slope of the surface microfacets (the roughness of the material).<ref>Foley et al. [[Computer Graphics: Principles and Practice]]. Menlo Park: Addison-Wesley, 1997. p. 764.</ref> Compare to the empirical models above, this function "gives the absolute magnitude of the reflectance without introducing arbitrary constants; the disadvantage is that it requires more computation".<ref name=CookTorrance/>
| |
| However, this model can be simplified since <math>\tan^2(\alpha)/m^2=\frac{1-\cos^2(\alpha)}{\cos^2(\alpha) m^2}</math>.
| |
| Also note that the product of <math>\cos(\alpha)</math> and a surface distribution function is normalized over the half-sphere which
| |
| is obeyed by this function.
| |
| | |
| ===Heidrich–Seidel anisotropic distribution===
| |
| {{Unreferenced section|date=August 2009}}
| |
| | |
| The Heidrich–Seidel distribution is a simple anisotropic distribution, based on the Phong model. It can be used to model surfaces that have small parallel grooves or fibers, such as [[brushed metal]], satin, and hair. The specular highlight intensity for this distribution is:
| |
| | |
| :<math>k_\mathrm{spec} = \left [ \sin(L, T) \sin(V, T) - \cos(L, T) \cos(V, T) \right ] ^n=(-\cos(\angle(L, T)+\angle(V, T)))^n,</math>
| |
| :<math>k_\mathrm{spec} = \left [ \cos(\angle(L, T)) \cos(\angle(V, T)) -\sin(\angle(L, T)) \sin(\angle(V, T)) \right ] ^n=\cos^n(\angle(L, T)+\angle(V, T)),</math>
| |
| | |
| where ''n'' is the anisotropic exponent, ''V'' is the viewing direction, ''L'' is the direction of incoming light, and ''T'' is the direction parallel to the grooves or fibers at this point on the surface. If you have a unit vector ''D'' which specifies the global direction of the anisotropic distribution, you can compute the vector ''T'' at a given point by the following:
| |
| | |
| :<math>T = | \hat{N} \times | \hat{D} \times \hat{N} | |</math>
| |
| | |
| where ''N'' is the unit normal vector at that point on the surface. You can also easily compute the cosine of the angle between the vectors by using a property of the [[dot product]] and the sine of the angle by using the [[trigonometric function|trigonometric identities]].
| |
| | |
| The anisotropic <math>k_\mathrm{spec}</math> should be used in conjunction with a non-anisotropic distribution like a Phong distribution to produce the correct specular highlight.
| |
| | |
| ===Ward anisotropic distribution===
| |
| | |
| The Ward anisotropic distribution [http://radsite.lbl.gov/radiance/papers/] uses two user-controllable parameters ''α<sub>x</sub>'' and ''α<sub>y</sub>'' to control the anisotropy. If the two parameters are equal, then an isotropic highlight results. The specular term in the distribution is:
| |
| | |
| :<math>k_\mathrm{spec} = \frac{1}{\sqrt{(N\cdot L)(N \cdot R)}}\frac{N\cdot L}{4\pi\alpha_x\alpha_y} \exp \left[ -2 \frac{\left(\frac{H\cdot X}{\alpha_x}\right)^2+\left(\frac{H\cdot Y}{\alpha_y}\right)^2}{1+(H\cdot N)} \right]</math>
| |
| | |
| The specular term is zero if ''N''·''L'' < 0 or ''N''·''R'' < 0. All vectors are unit vectors. The vector ''R'' is the mirror reflection of the light vector off the surface, ''L'' is the direction from the surface point to the light, ''H'' is the half-angle direction, ''N'' is the surface normal, and ''X'' and ''Y'' are two orthogonal vectors in the normal plane which specify the anisotropic directions.
| |
| | |
| ===Cook–Torrance model===
| |
| | |
| The Cook–Torrance model<ref name=CookTorrance>R. Cook and K. Torrance. "[http://inst.eecs.berkeley.edu/~cs283/sp13/lectures/cookpaper.pdf A reflectance model for computer graphics]". Computer Graphics (SIGGRAPH '81 Proceedings), Vol. 15, No. 3, July 1981, pp. 301–316.</ref> uses a specular term of the form
| |
| :<math>k_\mathrm{spec} = \frac{D F G}{4(E \cdot N)(N\cdot L)}</math>.
| |
| Here D is the [[Specular_highlight#Beckmann_distribution|Beckmann distribution]] factor as above and F is the [[Fresnel equations|Fresnel]] term,
| |
| :<math>F=(1+E\cdot N)^\lambda.</math>
| |
| For performance reasons in real-time 3D graphics [[Schlick's approximation]] is often used to approximate Fresnel term.
| |
| | |
| G is the geometric attenuation term, describing selfshadowing due to the microfacets, and is of the form
| |
| :<math>G = \min{\left(1,\frac{2(H\cdot N)(E\cdot N)}{E\cdot H},\frac{2(H\cdot N)(L\cdot N)}{E\cdot H}\right)}</math>.
| |
| In these formulas E is the vector to the camera or eye, H is the half-angle vector, L is the vector to the light source and N is the normal vector, and α is the angle between H and N.
| |
| | |
| ===Using multiple distributions===
| |
| | |
| If desired, different distributions (usually, using the same distribution function with different values of ''m'' or ''n'') can be combined using a weighted average. This is useful for modelling, for example, surfaces that have small smooth and rough patches rather than uniform roughness.
| |
| | |
| ==See also==
| |
| {{Portal|Computer graphics}}
| |
| * [[List of common shading algorithms]]
| |
| * [[Specular reflection]]
| |
| * [[Diffuse reflection]]
| |
| * [[Fresnel equations]]
| |
| * [[Retroreflector]]
| |
| * [[Reflection (physics)]]
| |
| * [[Refraction]]
| |
| | |
| ==References==
| |
| <references/>
| |
| | |
| {{DEFAULTSORT:Specular Highlight}}
| |
| [[Category:Optics]]
| |
| [[Category:Shading]]
| |