University of British Columbia Final CPSC 314 Computer Graphics • exam notes Jan-Apr 2013 • exam will be timed for 2.5 hours, but reserve Tamara Munzner entire 3-hour block of time just in case • closed book, closed notes • except for 2-sided 8.5”x11” sheet of handwritten notes Final Review • ok to staple midterm sheet + new one back to back http://www.ugrad.cs.ubc.ca/~cs314/Vjan2013 • calculator: a good idea, but not required • graphical OK, smartphones etc not ok • IDs out and face up 2 Final Emphasis Sample Final • covers entire course • post-midterm topics: • solutions now posted • Spring 06-07 (label was off by one) • includes material from • lighting/shading • note some material not covered this time before midterm • advanced rendering • projection types like cavalier/cabinet • transformations, • collision • Q1b, Q1c, viewing/picking • rasterization • antialiasing • but heavier weighting • hidden surfaces / • Q1d, Q1l, Q12 for material after last blending • animation midterm • textures/procedural • image-based rendering • clipping • Q1g • scientific visualization • color • Q14 • curves • visualization 3 4
Studying Advice Reading from OpenGL Red Book • do problems! • 1: Introduction to OpenGL • 2: State Management and Drawing Geometric Objects • work through old homeworks, exams • 3: Viewing • 4: Display Lists • 5: Color • 6: Lighting • 9: Texture Mapping • 12: Selection and Feedback • 13: Now That You Know • only section Object Selection Using the Back Buffer • Appendix: Basics of GLUT (Aux in v 1.1) • Appendix: Homogeneous Coordinates and Transformation Matrices 5 6 Reading from Shirley: Foundations of CG • 1: Intro * • 11: Texture Mapping * • 2: Misc Math * • 13: More Ray Tracing * • 3: Raster Algs * • only 13.1 • through 3.3 • 12: Data Structures * • 4: Ray Tracing * • only 12.2-12.4 • 5: Linear Algebra * • 15: Curves and Surfaces * Review – Fast!! • except for 5.4 • 17: Computer Animation * • 6: Transforms * • only 17.6-17.7 • except 6.1.6 • 21: Color * • 7: Viewing * • 22: Visual Perception * • 8: Graphics Pipeline * • only 22.2.2 and 22.2.4 • 8.1 through 8.1.6, 8.2.3-8.2.5, • 27: Visualization * 8.2.7, 8.4 • 10: Surface Shading * 7 8
Review: Rendering Capabilities Review: Rendering Pipeline Model/View Geometry Perspective Lighting Clipping Transform. Database Transform. Frame- Scan Depth Texturing Blending buffer Conversion Test www.siggraph.org/education/materials/HyperGraph/shutbug.htm 9 10 Review: OpenGL Review: Event-Driven Programming • pipeline processing, set state as needed • main loop not under your control void display() • vs. procedural { glClearColor(0.0, 0.0, 0.0, 0.0); • control flow through event callbacks glClear(GL_COLOR_BUFFER_BIT); • redraw the window now glColor3f(0.0, 1.0, 0.0); glBegin(GL_POLYGON); • key was pressed glVertex3f(0.25, 0.25, -0.5); • mouse moved glVertex3f(0.75, 0.25, -0.5); glVertex3f(0.75, 0.75, -0.5); • callback functions called from main loop glVertex3f(0.25, 0.75, -0.5); when events occur glEnd(); • mouse/keyboard state setting vs. redrawing glFlush(); } 11 12
Review: 2D Rotation Review: 2D Rotation From Trig Identities x ′ = x cos ( θ ) - y sin ( θ ) x = r cos ( φ ) (x ′ , y ′ ) y ′ = x sin ( θ ) + y cos ( θ ) y = r sin ( φ ) ( ) ( ) x ' cos sin x � � � � � � � � � x ′ = r cos ( φ + θ ) = � � � � � � ( ) ( ) y ' sin cos y y ′ = r sin ( φ + θ ) � � � � � � � � (x ′ , y ′ ) (x, y) Trig Identity… (x, y) x ′ = r cos( φ ) cos( θ ) – r sin( φ ) sin( θ ) y ′ = r sin( φ ) cos( θ ) + r cos( φ ) sin( θ ) counterclockwise, RHS θ θ Substitute… φ x ′ = x cos ( θ ) - y sin ( θ ) y ′ = x sin ( θ ) + y cos ( θ ) 13 14 Review: 2D Rotation: Another Derivation Review: Shear, Reflection • shear along x axis x ' x cos y sin = � � � • push points to right in proportion to height (x ′ ,y ′ ) y ' x sin y cos = � + � ' y y x B x 1 sh x 0 � � � � � � � � � x = + x � � � � � � � � x x y 0 1 y 0 � � � � � � � � � x ' = A � B (x,y) A = x cos � • reflect across x axis θ • mirror A x x 1 0 x 0 � � � � � � � � � = + � � � � � � � � y 0 1 y 0 � � � � � � � � � � x x 15 16
Review: 2D Transformations Review: Linear Transformations • linear transformations are combinations of matrix multiplication matrix multiplication x ' a 0 x x ' cos ( ) sin ( ) x • shear � � � � � � � � � � � � � � � x ' ax by x ' a b x = + = = � � � � � � � � � � � � � � � � � � • scale ( ) ( ) y ' sin cos y y ' 0 b y � � � � � � � � = � � � � � � � � � � � � y ' cx dy y ' c d y • rotate = + � � � � � � • reflect scaling matrix rotation matrix • properties of linear transformations vector addition • satisifes T( s x + t y ) = s T( x ) + t T( y ) (x ′ ,y ′ ) x a x a x ' � � � � � + � � � • origin maps to origin + = = (x,y) ( a , b ) � � � � � � � � y b y b y ' + • lines map to lines � � � � � � � � a b x x ' • parallel lines remain parallel � � � � � � = � � � � � � • ratios are preserved c d y y ' � � � � � � • closed under composition 17 18 translation multiplication matrix?? Review: Affine Transformations Review: Homogeneous Coordinates homogeneous cartesian • affine transforms are combinations of x y / w • linear transformations x ' a b c x ( , ) ( x , y , w ) � � � � � � • translations w w � � � � � � y ' d e f y x w = � � � � � � � � � � � y w homogenize to convert homog. 3D w 0 0 1 w � � � � � � � • � � � � � � � � point to cartesian 2D point: w � � � � • properties of affine transformations • divide by w to get (x/w, y/w, 1) w • origin does not necessarily map to origin x • projects line to point onto w=1 plane � � � � • like normalizing, one dimension up y • lines map to lines � � when w=0, consider it as direction 1 � � • parallel lines remain parallel • � � w= 1 • points at infinity • ratios are preserved • these points cannot be homogenized y • closed under composition • lies on x-y plane x (0,0,0) is undefined • 19 20
Recommend
More recommend