Changes

Jump to: navigation, search

GAM670/DPS905 Weekly Schedule 20111

762 bytes added, 18:23, 2 February 2011
This Week
* Vertex Shaders
* Lighting in Vertex Shaders
** [http://msdn.microsoft.com/en-us/library/aa451203.aspx Lighting Formulas]- note the corrections below
*** Notation
***: G<sub>a</sub> - global ambient color
***: C<sub>s</sub> - material specular color
***: Atten<sub>i</sub> - attenuation of light i
****: 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]
****: d<sub>i</sub> - distance from light i
***: 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><sub>i</sub> - direction vector of light i
***: N - normal to the surface at the vertex
***: H<sub>i</sub> - halfway vector =
****: = norm(norm(Camera<sub>position</sub> - Vertex<sub>position</sub>) + L<sub>dir</sub><sub>i</sub>)
****: = norm([0,0,1] + L<sub>dir</sub><sub>i</sub>) - less computationally intensive - assumes that camera is at infinity along z axis
***:
*** Ambient
***: C<sub>a</sub> * ( G<sub>a</sub> + sum [Atten<sub>i</sub> * sum[ L<sub>a</sub><sub>i</sub> ])
*** Diffuse
***: C<sub>d</sub> * sum [ L<sub>d</sub><sub>i</sub> * (N . L<sub>dir</sub><sub>i</sub>) * Atten<sub>i</sub> ]
*** Specular
***:C<sub>s</sub> * sum [ L<sub>s</sub><sub>i</sub> * (N . H<sub>i</sub>) * Atten<sub>i</sub> ]
** [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