Difference between revisions of "GAM670/DPS905 Weekly Schedule 20111"

From CDOT Wiki
Jump to: navigation, search
(This Week)
(This Week)
 
(17 intermediate revisions by the same user not shown)
Line 111: Line 111:
 
== Week 4 - Jan 30 ==
 
== Week 4 - Jan 30 ==
 
=== This Week ===
 
=== This Week ===
 +
* [http://msdn.microsoft.com/en-us/library/bb147178%28v=VS.85%29.aspx Mathematics of Lighting]
 
* Vertex Shaders
 
* Vertex Shaders
 
* Lighting in Vertex Shaders
 
* Lighting in Vertex Shaders
** Lighting Formulas
+
** Notation
*** Ambient
+
**: G<sub>a</sub> - global ambient color
*** Diffuse
+
**: C<sub>a</sub> - material ambient color
*** Specular
+
**: 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/bb172279%28v=VS.85%29.aspx Attenuation and Spotlight Factors]
 +
**** 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
 +
***: Spot<sub>i</sub> = {[r<sub>i</sub> - 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 spotlight<sub>i</sub>
 +
***:: r<sub>i</sub> = norm(- light direction in camera space) . norm(L<sub>dir<sub>i</sub></sub>)
 +
***: phi<sub>i</sub> - penumbra (exterior cone) angle of spotlight<sub>i</sub>
 +
***: theta<sub>i</sub> - umbra (interior cone) angle of spotlight<sub>i</sub>
 +
***: f<sub>i</sub> - falloff factor of spotlight<sub>i</sub>
 +
** [http://en.wikipedia.org/wiki/Blinn%E2%80%93Phong_shading_model Blinn-Phong and Phong]
 +
**: V - viewpoint vector
 +
**:: V = norm(Camera<sub>position</sub> - Vertex<sub>position</sub>)
 +
** 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>
 +
**: p<sub>i</sub> - true specular power of light i
 +
**:
 +
** 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(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
 +
**:
 +
** [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></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></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/ff471376%28v=vs.85%29.aspx HLSL Intrinsic Functions]
*** [http://msdn.microsoft.com/en-us/library/bb509630%28v=vs.85%29.aspx normalize()]
+
*** [http://msdn.microsoft.com/en-us/library/bb509630%28v=vs.85%29.aspx normalize()] - normalize a vector
*** [http://msdn.microsoft.com/en-us/library/bb509594%28v=vs.85%29.aspx dot()]
+
*** [http://msdn.microsoft.com/en-us/library/bb509594%28v=vs.85%29.aspx dot(,)] - dot product of two vectors of any size
*** [http://msdn.microsoft.com/en-us/library/bb509617%28v=vs.85%29.aspx length()]
+
*** [http://msdn.microsoft.com/en-us/library/bb509617%28v=vs.85%29.aspx length()] - length of a vector
*** [http://msdn.microsoft.com/en-us/library/bb509645%28v=vs.85%29.aspx saturate()]
+
*** [http://msdn.microsoft.com/en-us/library/bb509645%28v=vs.85%29.aspx saturate()] - clamp scalar, vector, or matrix to [0, 1]
  
 
=== To Do ===
 
=== To Do ===

Latest revision as of 08:18, 3 February 2011


GAM670/DPS905 | Weekly Schedule | Student List | Project Requirements | Teams and their Projects | Student Resources


GAM670/DPS905 -- Weekly Schedule 20111

Week 1 - Jan 9

This Week

  • Suggested Enhancements
  • Assignment Discussion
  • Review of base code
    • camera, sound, and light attachments now made at the Frame class
    • textures still attach at the object level
    • texture connection uncoupled from drawing
    • time tracking now within HUD class completely
    • introduction of relative reference frames
    • very simple collision detection
  • Relative Reference Frames
    • Recursive calls
      Vector Frame::position()
      Matrix Frame::rotation()
      Matrix Frame::world()
    • Detaching from and attaching to a parent frame
      Frame::attachTo()
  • Visibility Determination
    • Plane
      normal + constant - examples
      equation of a plane: dot(n, x) + D = 0
      positive side of a plane dot(n, x) + D > 0
      test a point for presence within a set of planes
      normal calculations - general rotation matrix - vector and angle
    • ViewingFrustum
      parameters
      near-clipping plane
      far-clipping plane
      field of view angle
      aspect ratio
      6 planes
      near and far planes
      left and right planes
      top and bottom planes
      coding
      constructor
      ViewingFrustum::contains()
  • Finite Size of Objects
    Expansion of the Viewing Frustum
    Bounded Volume
    BoundedVolume : Frame
    BoundedVolume::setRadius()
    BoundedVolume::getRadius()

To Do

Resources

Week 2 - Jan 16

This Week

  • Collision Detection
    types of colliders
    spheres
    planes
    axis-aligned bounding boxes
    oriented bounding boxes
  • Comprehensive Camerawork
    rotation about an axis
    order of rotation matters
    Euler angles
    gimble lock
    quaternions
    geometric algebra (more abstract)
  • Billboards
    definition, purpose of a billboard
    types of billboards
  • SkyBox
    definition of a skybox
    other forms
  • Index Buffers
    amount of storage needed for vertex data
    duplication of vertex data
    indexing
    indexed primitives
  • Meshes
    Stock Objects
    Sphere
    Cylinder
    Torus
    Utah Teapot
    Simple Mesh COM object
    What is a mesh?
    Create a Mesh
    DrawSubset
    FVF settings

To Do

  • Form Teams, Identify Members (2-5 members) and add your team and members to Teams 20111 Before Thursday 20th.
  • Confirm your name and information at Student List 20111

Resources

Week 3 - Jan 23

This Week

To Do

Resources

Week 4 - Jan 30

This Week

  • Mathematics of Lighting
  • Vertex Shaders
  • Lighting in Vertex Shaders
    • Notation
      Ga - global ambient color
      Ca - material ambient color
      Cd - material diffuse color
      Cs - material specular color
      Lai - ambient color of light i
      Ldi - diffuse color of light i
      Lsi - specular color of light i
      Ldiri - direction vector of light i
      N - normal to the surface at the vertex
      • Attenuation and Spotlight Factors
        • Atteni - attenuation of light i
        di - distance from light i
        di = |Ldiri|
        a0 - constant attenuation factor
        a1 - linear attenuation factor
        a2 - quadratic attenuation factor
        Atteni = 1/(a0 + a1 di + a2 di2)
        Atteni = [0, 1]
        • Spoti - spot factor of light i
        Spoti = {[ri - cos(phii/2)]/[cos(thetai/2) - cos(phii/2)]}fi
        ri - cosine of angle from axis of spotlighti
        ri = norm(- light direction in camera space) . norm(Ldiri)
        phii - penumbra (exterior cone) angle of spotlighti
        thetai - umbra (interior cone) angle of spotlighti
        fi - falloff factor of spotlighti
    • Blinn-Phong and Phong
      V - viewpoint vector
      V = norm(Cameraposition - Vertexposition)
    • Phong - account accurately for position of viewer
      Specular reflectance = (Ri . V)pi
      Ri - reflection vector
      Ri = 2 * (N . Ldiri) N - Ldiri
      pi - true specular power of light i
    • Blinn-Phong - use halfway vector instead of reflection vector - adjust power to compensate
      Specular reflectance = (N . Hi)p'i
      Hi - halfway vector
      Hi = norm(V + Ldiri)
      Hi = norm([0,0,1] + Ldiri) - less computationally intensive - assumes that camera is at infinity along z axis
      p'i - adjusted specular power of light i
    • Ambient
      Ca * ( Ga + sum [Lai * Atteni * Spoti] )
    • Diffuse
      Cd * sum [ Ldi * (N . Ldiri) * Atteni * Spoti ]
    • Specular
      Cs * sum [ Lsi * (N . Hi)p'i * Atteni * Spoti ] - Blinn-Phong
      Cs * sum [ Lsi * (Ri . V)pi * Atteni * Spoti ] - Phong
    • HLSL Intrinsic Functions

To Do

  • reorganize framework code so that vertex shader receives product of world, view, and projection matrices
    • store viewProjection matrix as an instance variable in Display
    • add viewProjection query to Display to extract product of view and projection matrices
    • retrieve viewProjection in *::draw() method
    • pre-multiply viewProjection by world to obtain composite matrix to pass to vertex shader
    • add composite matrix to the constant table in the vertex shader
  • reorganize framework code to minimize duplication of heading normalization
    • perform normalization of heading in Display::beginDraw()

Resources

Week 5 - Feb 6

This Week

To Do

Resources

Week 6 - Feb 13

This Week

To Do

Resources

Week 7 - Feb 20

This Week

To Do

Resources