Changes

Jump to: navigation, search

GAM670/DPS905 Weekly Schedule 20111

1,932 bytes added, 09:18, 3 February 2011
This Week
== Week 4 - Jan 30 ==
=== This Week ===
* [http://msdn.microsoft.com/en-us/library/bb147178%28v=VS.85%29.aspx Mathematics of Lighting]
* Vertex Shaders
* Lighting in Vertex Shaders
** Notation**: G<sub>a</sub> - global ambient color**: C<sub>a</sub> - material ambient color**: C<sub>d</sub> - material diffuse color**: C<sub>s</sub> - material specular color**: L<sub>a<sub>i</sub></sub> - ambient color of light i**: L<sub>d<sub>i</sub></sub> - diffuse color of light i**: L<sub>s<sub>i</sub></sub> - specular color of light i**: L<sub>dir<sub>i</sub></sub> - direction vector of light i**: N - normal to the surface at the vertex*** [http://msdn.microsoft.com/en-us/library/aa451203bb172279%28v=VS.85%29.aspx Lighting FormulasAttenuation and Spotlight Factors] - note the corrections below*** Notation* Atten<sub>i</sub> - attenuation of light i***: Gd<sub>ai</sub> - global ambient colordistance from light i***: C: d<sub>i</sub> = |L<sub>dir<sub>i</sub>a</sub> - material ambient color|***: Ca<sub>d0</sub> - material diffuse colorconstant attenuation factor***: Ca<sub>s1</sub> - material specular colorlinear attenuation factor***: Attena<sub>i2</sub> - quadratic attenuation of light ifactor****: Atten<sub>i</sub> = 1/(a<sub>0</sub> + a<sub>1</sub> d<sub>i</sub> + a<sub>2</sub> d<sub>i</sub><sup>2</sup>)****: Atten<sub>i</sub> = [0, 1]****: dSpot<sub>i</sub> - distance from spot factor of light i***: Spot<sub>i</sub> = {[r<sub>i</sub> - spot factor cos(phi<sub>i</sub>/2)]/[cos(theta<sub>i</sub>/2) - cos(phi<sub>i</sub>/2)]}<sup>f<sub>i</sub></sup>***: r<sub>i</sub> - cosine of angle from axis of light spotlight<sub>i</sub>***: : r<sub>i</sub> = norm(- light direction in camera space) . norm(L<sub>adir<sub>i</sub></sub>)***: phi<sub>i</sub> - ambient color penumbra (exterior cone) angle of light spotlight<sub>i</sub>***: Ltheta<sub>i</sub> - umbra (interior cone) angle of spotlight<sub>di</sub>***: f<sub>i</sub> - diffuse color falloff factor of light spotlight<sub>i</sub>** [http://en.wikipedia.org/wiki/Blinn%E2%80%93Phong_shading_model Blinn-Phong and Phong]**: LV - viewpoint vector**:: V = norm(Camera<sub>sposition</sub>- Vertex<sub>iposition</sub> )** Phong - specular color account accurately for position of light viewer**: Specular reflectance = (R<sub>i</sub> . V)<sup>p<sub>i</sub></sup>**: R<sub>i</sub> - reflection vector**: : R<sub>i</sub> = 2 * (N . L<sub>dir<sub>i</sub></sub>) N - L<sub>dir<sub>i</sub></sub>**: p<sub>i</sub> - direction vector true specular power of light i**:**: N Blinn-Phong - use halfway vector instead of reflection vector - normal adjust power to the surface at the vertexcompensate***: Specular reflectance = (N . H<sub>i</sub> - halfway vector =)<sup>p'<sub>i</sub></sup>****: = norm(norm(CameraH<sub>positioni</sub> - Vertexhalfway vector**:: H<sub>positioni</sub>) = norm(V + L<sub>dir</sub>i</sub>i</sub>)****: : H<sub>i</sub> = norm([0,0,1] + L<sub>dir</sub>i</sub>i</sub>) - less computationally intensive - assumes that camera is at infinity along z axis**: p'<sub>i</sub> - adjusted specular power of light i**:*** [http://msdn.microsoft.com/en-us/library/bb172256%28v=VS.85%29.aspx Ambient]***: C<sub>a</sub> * ( G<sub>a</sub> + sum [AttenL<sub>a<sub>i</sub></sub> * LAtten<sub>ai</sub>* Spot<sub>i</sub>] )*** [http://msdn.microsoft.com/en-us/library/bb219656%28v=VS.85%29.aspx Diffuse]***: C<sub>d</sub> * sum [ L<sub>d</sub>i</sub>i</sub> * (N . L<sub>dir<sub>i</sub></sub>) * Atten<sub>i</sub>) * AttenSpot<sub>i</sub> ]*** [http://msdn.microsoft.com/en-us/library/bb147399%28VS.85%29.aspx Specular]***: C<sub>s</sub> * sum [ L<sub>s</sub>i</sub>i</sub> * (N . H<sub>i</sub>) <sup>p'<sub>i</sub></sup> * Atten<sub>i</sub> * Spot<sub>i</sub> ] - Blinn-Phong**: C<sub>s</sub> * sum [ L<sub>s<sub>i</sub></sub> * (R<sub>i</sub> . V)<sup>p<sub>i</sub></sup> * Atten<sub>i</sub> * Spot<sub>i</sub> ]- Phong
** [http://msdn.microsoft.com/en-us/library/ff471376%28v=vs.85%29.aspx HLSL Intrinsic Functions]
*** [http://msdn.microsoft.com/en-us/library/bb509630%28v=vs.85%29.aspx normalize()] - normalize a vector

Navigation menu