Weyl character formula: Difference between revisions

From formulasearchengine
Jump to navigation Jump to search
en>David Eppstein
→‎Harish-Chandra Character Formula: pretty sure this is the right herb for the wikilink
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{original research|date=January 2012}}
The author is known as Irwin. To do aerobics is a thing that I'm completely addicted to. California is exactly where her house is but she needs to move simply because of her family members. Managing people has been his day occupation for a while.<br><br>Look into my web-site: std home test; [http://forums.cellphonedge.com/groups/valuable-guidance-for-successfully-treating-candidiasis/ mouse click the up coming website],
 
The '''Blinn–Phong shading model''' (also called '''Blinn–Phong reflection model''' or '''modified Phong reflection model''') is a modification to the [[Phong reflection model]] developed by [[Jim Blinn]].<ref>{{cite journal | journal = Proc. 4th annual conference on computer graphics and interactive techniques | title = Models of light reflection for computer synthesized pictures | author = James F. Blinn | year = 1977 | url = http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.131.7741&rep=rep1&type=pdf | doi = 10.1145/563858.563893 | pages = 192–198}}</ref>
 
Blinn–Phong is the default shading model used in [[OpenGL]]<ref>{{cite book
| last1                = Shreiner
| first1                = Dave
| last2                = The Khronos OpenGL ARB Working Group
| authorlink2          = Khronos Group
| title                = OpenGL programming guide : the official guide to learning OpenGL, version 3.0 and 3.1
| edition              = 7th
| year                  = 2010
| publisher            = [[Pearson Education, Inc.]]
| isbn                  = 978-0-321-55262-4
| pages                = 240–245
| chapter              = The Mathematics of Lighting
}}</ref> and [[Direct3D]]'s fixed-function pipeline (before Direct3D 10 and OpenGL 3.1), and is carried out on each vertex as it passes down the [[graphics pipeline]]; [[pixel]] values between vertices are interpolated by [[Gouraud shading]] by default, rather than the more computationally-expensive [[Phong shading]].
 
==Description==
 
[[File:Blinn Vectors.svg|thumb|Vectors for calculating Phong and Blinn–Phong shading]]
 
In Phong shading, one must continually recalculate the [[scalar product]] <math>R \cdot V</math> between a viewer (''V'') and the beam from a light-source (''L'') reflected (''R'') on a surface.
 
If, instead, one calculates a ''halfway vector'' between the viewer and light-source vectors,
 
:<math>
H = \frac{L + V}{\left| L + V \right|}
</math>
 
we can replace <math>R \cdot V</math> with <math>N \cdot H</math>, where <math>N</math> is the normalized surface normal. In the above equation, <math>L</math> and <math>V</math> are both normalized vectors, and <math>H</math> is a solution to the equation <math>V=P_H(-L),</math> where <math>P_H</math> is the [[Householder matrix]] that reflects a point in the hyperplane that contains the origin and has the normal <math>H.</math>
 
This dot product represents the cosine of an angle that is half of the angle represented by Phong's dot product if ''V'', ''L'', ''N'' and ''R'' all lie in the same plane. This relation between the angles remains approximately true when the vectors don't lie in the same plane, especially when the angles are small. The angle between ''N'' and ''H'' is therefore sometimes called the halfway angle.
 
Considering that the angle between the halfway vector and the surface normal is likely to be smaller than the angle between ''R'' and ''V'' used in Phong's model (unless the surface is viewed from a very steep angle for which it is likely to be larger), and since Phong is using <math>\left( R \cdot V \right)^{\alpha},</math> an exponent can be set <math>\alpha\prime > \alpha</math> such that <math>\left(N \cdot H \right)^{\alpha\prime}</math> is closer to the former expression.
 
For front-lit surfaces (specular reflections on surfaces facing the viewer), <math>\alpha\prime = 4\,\alpha</math> will result in specular highlights that very closely match the corresponding Phong reflections. However, while the Phong reflections are always round for a flat surface, the Blinn–Phong reflections become elliptical when the surface is viewed from a steep angle. This can be compared to the case where the sun is reflected in the sea close to the horizon, or where a far away street light is reflected in wet pavement, where the reflection will always be much more extended vertically than horizontally.
 
[[Image:Blinn phong comparison.png|400px|Visual comparison: Blinn–Phong highlights are larger than Phong with the same exponent, but by lowering the exponent, they can become nearly equivalent.]]
 
Additionally, while it can be seen as an approximation to the Phong model, it produces more accurate models of empirically determined [[bidirectional reflectance distribution function]]s than Phong for many types of surfaces. (''See: [http://people.csail.mit.edu/wojciech/BRDFValidation/index.html Experimental Validation of Analytical BRDF Models, Siggraph 2004]'')
 
==Efficiency==
This rendering model is less efficient than pure Phong shading in most cases, since it contains a square root calculation. While the original Phong model only needs a simple vector reflection, this modified form takes more into consideration. However, as many CPUs and GPUs contain single and double precision square root functions (as standard features) and other instructions that can be used to speed up rendering, the time penalty for this kind of shader will not be noticed in most implementations.
 
However, Blinn-Phong will be faster in the case where the viewer and light are treated to be at infinity. This is the case for directional lights. In this case, the half-angle vector is independent of position and surface curvature. It can be computed once for each light and then used for the entire frame, or indeed while light and viewpoint remain in the same relative position. The same is not true with Phong's original reflected light vector which depends on the surface curvature and must be recalculated for each pixel of the image (or for each vertex of the model in the case of vertex lighting).
 
In most cases where lights are not treated to be at infinity, for instance when using point lights, the original Phong model will be faster.
 
==  Code sample ==
{{Original research|date=June 2011}}
 
This sample in [[High Level Shader Language]] is a method of determining the diffuse and specular light from a point light. The light structure, position in space of the surface, view direction vector and the normal of the surface are passed through. A Lighting structure is returned;
 
<source lang="c">
 
struct Lighting
{
    float3 Diffuse;
    float3 Specular;
};
 
struct PointLight
{
float3 position;
float3 diffuseColor;
float  diffusePower;
float3 specularColor;
float  specularPower;
};
 
Lighting GetPointLight( PointLight light, float3 pos3D, float3 viewDir, float3 normal )
{
Lighting OUT;
if( light.diffusePower > 0 )
{
float3 lightDir = light.position - pos3D; //3D position in space of the surface
float distance = length( lightDir );
lightDir = lightDir / distance; // = normalize( lightDir );
distance = distance * distance; //This line may be optimised using Inverse square root
 
//Intensity of the diffuse light. Saturate to keep within the 0-1 range.
float NdotL = dot( normal, lightDir );
float intensity = saturate( NdotL );
 
// Calculate the diffuse light factoring in light color, power and the attenuation
OUT.Diffuse = intensity * light.diffuseColor * light.diffusePower / distance;
 
                //Calculate the half vector between the light vector and the view vector.
                //This is faster than calculating the actual reflective vector.
                float3 H = normalize( lightDir + viewDir );
 
        //Intensity of the specular light
float NdotH = dot( normal, H );
intensity = pow( saturate( NdotH ), specularHardness );
 
//Sum up the specular light factoring
OUT.Specular = intensity * light.specularColor * light.specularPower / distance;
}
return OUT;
}
</source>
 
== See also ==
 
{{Portal|Computer graphics}}
* [[List of common shading algorithms]]
* [[Phong reflection model]] for Phong's corresponding model
* [[Specular highlight]]
 
==References==
{{Reflist}}
 
{{DEFAULTSORT:Blinn-Phong shading model}}
[[Category:Shading]]

Latest revision as of 02:17, 1 January 2015

The author is known as Irwin. To do aerobics is a thing that I'm completely addicted to. California is exactly where her house is but she needs to move simply because of her family members. Managing people has been his day occupation for a while.

Look into my web-site: std home test; mouse click the up coming website,