Open main menu

CDOT Wiki β

Changes

GAM670/DPS905 Weekly Schedule 20111

25 bytes removed, 20:02, 2 February 2011
This Week
* 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
**: Atten<sub>i</sub> - attenuation of light i
**:: d<sub>i</sub> - distance from light i
**::: d<sub>i</sub> = |L<sub>dir<sub>i</sub></sub>|
**:: a<sub>0</sub> - constant attenuation factor
**:: a<sub>1</sub> - linear attenuation factor
**:: a<sub>2</sub> - quadratic attenuation factor
**:: 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]
**: Spot<sub>i</sub> - spot factor of light i
**::
**: 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://en.wikipedia.org/wiki/Blinn%E2%80%93Phong_shading_model Blinn-Phong and Phong]
*** Notation***: G<sub>a</sub> V - global ambient colorviewpoint vector***: C<sub>a</sub> - material ambient color***: C<sub>d</sub> - material diffuse color***: C<sub>s</sub> - material specular color***: Atten<sub>i</sub> - attenuation of light i***:: d<sub>i</sub> - distance from light i***::: d<sub>i</sub> V = |Lnorm(Camera<sub>dir<sub>i</sub></sub>|***:: a<sub>0position</sub> - constant attenuation factor***:: aVertex<sub>1position</sub> - linear attenuation factor***:: a<sub>2</sub> - quadratic attenuation factor***:: 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]***: Spot<sub>i</sub> - spot factor of light i***::***: L<sub>a</sub><sub>i</sub> - ambient color of light i***: L<sub>d</sub><sub>i</sub> - diffuse color of light i***: L<sub>s</sub><sub>i</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*** Blinn-Phong - use halfway vector instead of reflection vector - adjust power to compensate***: Specular reflectance = (N.H<sub>i</sub>)<sup>p'<sub>i</sub></sup>***: H<sub>i</sub> - halfway vector***:: H<sub>i</sub> = norm(norm(Camera<sub>position</sub> - Vertex<sub>position</sub>) V + L<sub>dir<sub>i</sub></sub>)***:: H<sub>i</sub> = norm([0,0,1] + L<sub>dir<sub>i</sub></sub>) - less computationally intensive - assumes that camera is at infinity along z axis***: p'<sub>i</sub> - adjusted specular power of light i*** Phong - account accurately for position of 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>***: V - viewpoint vector***: p<sub>i</sub> - true 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 [L<sub>a<sub>i</sub></sub> * Atten<sub>i</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> * Spot<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>i</sub> * (R . V<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