1 / 31

CS 445 / 645: Introductory Computer Graphics

CS 445 / 645: Introductory Computer Graphics. Light. Administrivia. Assignment 3 Due Sunday, October 21 st at Midnight Midterm Exam Tuesday, October 23 rd See web page for reading material Review in class today. Lighting Models. Lighting Models Ambient Normals don’t matter

kaspar
Download Presentation

CS 445 / 645: Introductory Computer Graphics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 445 / 645: Introductory Computer Graphics Light

  2. Administrivia • Assignment 3 Due • Sunday, October 21st at Midnight • Midterm Exam • Tuesday, October 23rd • See web page for reading material • Review in class today

  3. Lighting Models • Lighting Models • Ambient • Normals don’t matter • Lambert/Diffuse • Angle between surface normal and light • Phong/Specular • Surface normal, light, and viewpoint • Rendering Equation (Kajiya)

  4. Shading Models (Direct lighting) • Flat Shading • Compute Phong lighting once for entire polygon • Gouraud Shading • Compute Phong lighting at the vertices and interpolate lighting values across polygon • Phong Shading • Compute averaged vertex normals • Interpolate normals across polygon and perform Phong lighting across polygon

  5. Shading Models (Indirect lighting) • Ray Tracing Radiosity

  6. Radiosity • Ray tracing models specular reflection and refractive transparency, but still uses an ambient term to account for other lighting effects • Radiosity is the rate at which energy is emitted or reflected by a surface • By conserving light energy in a volume, these radiosity effects can be traced

  7. Radiosity • Radiosity of patch ‘i’ is • ei is the rate at which light is emitted • ri is patch i’s reflectivity • Fj,i is the form factor • fraction of patch j that reaches patch i as determined by orientation of both patches and obstructions • Use Aj/Ai (Area of patch j / Area of patch I) to scale units to total light emitted by j as received per unit area by i

  8. Form Factors • Compute n-by-n matrix of form factors to store radiosity relationships between each light patch and every other light patch Hij = 1 or 0 depending on occlusion

  9. Form Factor – Another example • Spherical projections to model form factor • project polygon Aj on unit hemisphere centered at (and tangent to) Ai • Contributes cosqj / r2 • Project this projection to base of hemisphere • Contributes cosqi • Divide this area by area of circle base • Contributes p

  10. Form Factor – Another Model • Hemicube allows faster computations • Analytic solution of hemisphere is expensive • Use rectangular approximation, hemicube • cosine terms for top and sides are simplified • Dimension of 50 – 200 squares is good

  11. Solving for all Patches • One patch defined by: • Symmetry: AiFi,j = AjFj,I • Therefore: • And: • Use matrix algebra to solve for Bi’s

  12. Radiosity • Radiosity is expensive to compute • Get your PhD by improving it • Emitted light and viewpoint can change • Light angles and object positions cannot • Computing form factors is expensive • Specular reflection information is not modeled

  13. View-dependent vs View-independent • Ray-tracing models specular reflection well, but diffuse reflection is approximated • Radiosity models diffuse reflection accurately, but specular reflection is ignored • Advanced algorithms combine the two

  14. Texture Mapping • Limited ability to generate complex surfaces with geometry • Images can convey the illusion of geometry • Images painted onto polygons is called texture mapping

  15. Texture Mapping • Texture map is an image, two-dimensional array of color values (texels) • Texels are specified by texture’s (u,v) space • At each screen pixel, texel can be used to substitute a polygon’s surface property • We must map (u,v) space to polygon’s (s, t) space T V U S

  16. Texture Mapping • (u,v) to (s,t) mapping can be explicitly set at vertices by storing texture coordinates with each vertex • How do we compute (u,v) to (s,t) mapping for points in between • Watch for aliasing • Watch for many to one mappings • Watch for perspective foreshortening effects and linear interpolation

  17. Bump Mapping • Use textures to modify surface geometry • Use texel values to modify surface normals of polygon • Texel values correspond to height field • Height field models a rough surface • Partial derivative of bump map specifies change to surface normal

  18. Bump Mapping

  19. Displacement Mapping • Bump mapped normals are inconsistent with actual geometry. Problems arise (shadows). • Displacement mapping actually affects the surface geometry

  20. Assignment 3 – Plane Rendering • Plane defined by Ax + By + Cz + D = 0 • (A, B, C) defines normal to the plane • -D specifies translation from origin • Ex: 1x + 0y + 0z + 4 = 0 • All values of y and z work. X must be –4 • y-z plane at x = -4 • y-z plane has normal of (1, 0, 0)

  21. Plane Rendering • Imagine first rendering plane of desired size centered on x-z plane • We must then rotate and translate this plane so its normal aligns with the (A, B, C) vector and the plane is –D from the origin U = Normal of x-z plane (0, 1, 0) V = Normal of clip plane (A, B, C)

  22. Plane Rendering • Angle between U and V is computed with the dot product: u.dot.v = ||V|| ||U|| cos (n) Rotate -n degrees Rotate about VxU • Vector to rotate about is VxU:[vyuz-vzuy, -vxuz+vzux, vxuy-vyux]

  23. Clipping Plane Rendering • So we have a glRotate to execute • glRotatef (-n, VxUx, VxUy, VxUz) • And we have a glTranslate to execute • glTranslatef (0, -D, 0) • And we have a command to draw a polygon • glBegin (GL_POLYGON) • glVertex3fv(front-left); glVertex3fv(front-right); • glVertex3fv(back-right); glVertex3fv(back-left); • So just put them in the right order • An exercise for the reader

  24. Review • Hearn and Baker • Chapter 2 • Chapter 3 (84-102, 117-126) • Chapter 5 • Chapter 6 (225-248) • Chapter 11 (No Quaternions) [Recently added] • Chapter 12 (432-456) • Chapter 14 • Chapter 15 • Appendix 1 – 4 • OpenGL Red Book • Chapter 1 - 3

  25. Review • If you’re going to print out all the slides from my lectures, please try to keep our costs down. • Render multiple slides to a page. • Convert black backgrounds to white to reduce toner usage • Make sure you convert fonts to black • Doesn’t PowerPoint have a mode that does this automatically?

  26. Review • Vector arithmetic • Add, subtract • Dot (to determine angle between and length of projection (when normalized vectors) • Cross product (Right-hand rule) • Coordinate space • Right-handed coordinate system • openGL camera initialized to look down –z axis

  27. Review • OpenGL • No significant coding required • I might ask you to tell me what a function does • One you’ve used for the projects • I might ask you to tell me what order to put the transformation commands • Direction of rotations • Ordering of polygon vertices • Back-face rendering • Rendering Pipeline (model, light, view, clip, project) • Line Drawing, Circle Drawing • Difference Equations, symmetry • Triangle Rasterization

  28. Review • Polygon rasterization • Example Problems • Active Edge Table • Clipping • Parametric equations of lines • Slope-intercept equation of line • Outcode • Line-plane intersection

  29. Review • Homogeneous Coordinate System • What does w do? • Modeling Transformations • Rotate, translate, scale, rotate about arbitrary axis • Viewing Transformations • Orthographic (parallel) and Perspective • Understand how matrix formed by compositing many modeling and viewing transformations effect the vertices of a model and its rendering

  30. Review • Color • Metamers • Relative changes versus absolute values • RGB sensitivity • Color spaces • Intuitive spaces, distance between similar colors • Lighting Equations • Dependent on what factors • Calculate the reflection vector • Know how parameters effect images

  31. Review • Shading • Flat, Gouraud, Phong • Improvements versus cost • Indirect lighting • Ray tracing, radiosity • Viewer dependent/independent • Costs/benefits

More Related