1 / 48

CSCE 441 Computer Graphics

CSCE 441 Computer Graphics. Jinxiang Chai. Midterm. Time: 10:10pm-11:20pm, 10/20 Location: HRBB 113 . What you’ve learned in this class?. 2D Graphics Drawing lines, polygons Color 3D Graphics Transformations Hidden surface removals. Scan Line Conversion. How to draw a line?

Gabriel
Download Presentation

CSCE 441 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. CSCE 441 Computer Graphics Jinxiang Chai

  2. Midterm • Time: 10:10pm-11:20pm, 10/20 • Location: HRBB 113

  3. What you’ve learned in this class? • 2D Graphics • Drawing lines, polygons • Color • 3D Graphics • Transformations Hidden surface removals

  4. Scan Line Conversion • How to draw a line? - Digital Differential Analyzer (DDA) - Midpoint algorithm - Understand both algorithms - Strengths and limitations

  5. Scan Conversion of Polygons • How to draw a polygons? - Active edge list - Boundary fill - Flood fill - Understand three algorithms - Limitations and strengths

  6. Clipping Lines

  7. Clipping Lines

  8. Clipping Lines • Given a line with end-points (x0, y0), (x1, y1) and clipping window (xmin, ymin), (xmax, ymax), determine if line should be drawn and clipped end-points of line to draw. (xmax,ymax) (x1, y1) (x0, y0) (xmin,ymin)

  9. Line Clipping • How to clip a line? - Simple line clipping algorithm - Cohen--Sutherland - Liang-Barsky

  10. Clipping Polygons • Clipping polygons is more complex than clipping the individual lines • - Input: polygon

  11. Clipping Polygons • Clipping polygons is more complex than clipping the individual lines • - Input: polygon • - Output: original polygon, new polygon, or nothing

  12. Polygon Clipping • How to clip a polygon? - Sutherland-Hodgman Clipping (convex polygons) - Weiler-Atherton Algorithm (general polygons)

  13. 2D/3D Transformation • Various transform matrices - 2D/3D rotation - 2D/3D translation - 2D/3D scaling - 2D affine transform

  14. Arbitrary Rotation Center (px,py) To rotate about an arbitrary point P (px,py) by q:

  15. Arbitrary Rotation Center (px,py) • To rotate about an arbitrary point P (px,py) by q: • Translate the object so that P will coincide with the origin: T(-px, -py)

  16. Arbitrary Rotation Center (px,py) • To rotate about an arbitrary point P (px,py) by q: • Translate the object so that P will coincide with the origin: T(-px, -py) • Rotate the object: R(q)

  17. Arbitrary Rotation Center (px,py) • To rotate about an arbitrary point P (px,py) by q: • Translate the object so that P will coincide with the origin: T(-px, -py) • Rotate the object: R(q) • Translate the object back: T(px,py)

  18. x’ 1 0 px cos(q) -sin(q) 0 1 0 -px x y’ = 0 1 py sin(q) cos(q) 0 0 1 -py y 1 0 0 1 0 0 1 0 0 1 1 Arbitrary Rotation Center • Translate the object so that P will coincide with the origin: T(-px, -py) • Rotate the object: R(q) • Translate the object back: T(px,py) • Put in matrix form: T(px,py) R(q) T(-px, -py) * P

  19. Scaling Revisit • What if I want to scale about an arbitrary pivot point? • The standard scaling matrix will only anchor at (0,0) Sx 0 0 0 Sy 0 0 0 1

  20. 2D/3D Coordinate Transformation • Various transform matrix - 2D/3D rotation - 2D/3D translation - 2D/3D scaling - 2D affine transform • How to do 2D/3D matrix composition

  21. 2D Coordinate Transformation p Transform object description from to 21

  22. 2D Coordinate Transformation 0 1 p 0 1 2D translation 22

  23. 2D Coordinate Transformation p 2D translation&rotation 23

  24. 2D Coordinate Transformation p 2D translation & scaling 24

  25. Hierarchical Modeling: Lamp How to do opengl implementation? What’s the current coordinate A ? 25

  26. A More Complex Example: Human Figure How to do opengl implementation?

  27. 3D->2D Geometry Pipeline Rotate and translate the camera Object space World space View space Focal length Aspect ratio & resolution Normalized project space Image space 27

  28. 3D Geometry Pipeline Model space (Object space) Before being turned into pixels by graphics hardware, a piece of geometry goes through a number of transformations... 28

  29. 3D Geometry Pipeline World space (Object space) Before being turned into pixels by graphics hardware, a piece of geometry goes through a number of transformations... 29

  30. 3D Geometry Pipeline Eye space (View space) Before being turned into pixels by graphics hardware, a piece of geometry goes through a number of transformations... 30

  31. Camera Coordinate 31

  32. 3D Coordinate Trans. Transform object description from camera to world 32

  33. Viewing Trans: gluLookAt gluLookAt(eyex,eyey,eyez,atx,aty,atz,upx,upy,upz) 33

  34. Viewing Trans: gluLookAt gluLookAt(eyex,eyey,eyez,atx,aty,atz,upx,upy,upz) How to determine ? Mapping from world to eye coordinates

  35. Viewing Trans: gluLookAt gluLookAt(eyex,eyey,eyez,atx,aty,atz,upx,upy,upz) Mapping from world to eye coordinates

  36. Viewing Trans: gluLookAt gluLookAt(eyex,eyey,eyez,atx,aty,atz,upx,upy,upz) Mapping from world to eye coordinates

  37. Viewing Trans: gluLookAt gluLookAt(eyex,eyey,eyez,atx,aty,atz,upx,upy,upz) H&B equation (7-1) Mapping from world to eye coordinates

  38. 3D Geometry Pipeline Normalized projection space Before being turned into pixels by graphics hardware, a piece of geometry goes through a number of transformations... 38

  39. 3D->2D By similar triangles, we can compute how much the x and y coordinates are scaled Consider the projection of a point on the camera plane 39

  40. The Perspective Matrix After the division by w, we have Now we can rewrite the perspective projection equation as matrix-vector multiplications 40

  41. Projections • Parallel projection - definition - properties • Perspective projection - definition - homogeneous coordinates - vanishing point - properties

  42. 3D Geometry Pipeline Image space, window space, raster space, screen space, device space Before being turned into pixels by graphics hardware, a piece of geometry goes through a number of transformations... 42

  43. 3D Rendering pipeline Modeling transformation Transform into 3D world system Illuminate according to lighting and reflectance lighting Transform into 3D camera coordinate system Viewing transformation Transform into 2D camera system Project transformation Clip primitives outside camera’s view Clipping Draw pixels (includes texturing, hidden surface, etc.) Scan conversion Image

  44. Hidden Surface Removals • Backface Culling • Painter’s algorithm • BSP • Z-buffer • Scan line • Ray casting

  45. For Example, BSP Tree 6 7-2 5-2 3 7-1 5-1 1 2 4 1 b 3 f b 7-1 7-2 f b b 4 6 2 b f Traversal order? 1->6->(5-2)->(7-2)->3->4->(5-1)->(7-1)->2 5-1 5-2

  46. Color • Understanding chromaticity diagram and its concept • Understanding various color models: - RGB - CMY/CMYK - YUV/YIQ - HSV - XYZ, etc.

  47. Chromaticity Diagram • How to obtain chromaticity diagram? • Where are spectral colors and non-spectral colors located? • How to determine purity/saturation and dominant wave length/hues for a given color? • How to identify complementary colors? • How to compare color gamuts for different primaries? • Why three primary colors are not sufficient to represent all colors? Image taken from http://fourier.eng.hmc.edu/e180/handouts/color1/node27.html

  48. What you’ve learned in this class? • 2D Graphics • Drawing lines, polygons Color • 3D Graphics • Transformations

More Related