University of British Columbia Final Logistics CPSC 314 Computer Graphics � 8:30-11:00am Tue Apr 19 in MCML 166 Jan-Apr 2005 � notes: both sides 8.5”x11” handwritten page Tamara Munzner � calculator OK if you want � have photo ID face up on desk � bags at front/side/back of room Final Review Week 13, Fri Apr 8 http://www.ugrad.cs.ubc.ca/~cs314/Vjan2005 � Extra Sessions Reading from OpenGL Red Book � pre-final Q&A session � 1: Introduction to OpenGL � 2: State Management and Drawing Geometric Objects � day before the final: Mon Apr 18, 1-3pm � 3: Viewing � TA Dan Julius � 4: Display Lists � in CICSR 011 lab � 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 � � Final Topics Breakdown Reading from Shirley: Foundations of CG � 2: Misc Math � 10: Texture Mapping � midterm 1 topics: first five weeks � 3: Raster Algs � 11: Graphics Pipeline � midterm 2 topics: second five weeks � except for 3.8 � only 11.1-11.4 � topics covered since then: last three weeks � 4: Linear Algebra � 12: Data Structures � only 4.1-4.2.5 � only 12.3 � 5: Transforms � 13: Curves and Surfaces � posted slides � except 5.1.6 � 17: Human Vision � lecture – more than just slides! � 6: Viewing � 18: Color � 7: Hidden Surfaces � only 18.1-18.8 � readings � 8: Surface Shading � 22: Image-Based Rendering � 9: Ray Tracing � 23: Visualization � only 9.1-9.7 � also animation guest lecture � � Page 1 1
Midterm 1 Topics Covered Review: Rendering Pipeline � rendering pipeline � projective rendering pipeline, coord. systems � pros and cons of pipeline approach � transformations � viewing Geometry Geometry Model/View Model/View Model/View Perspective Perspective Geometry Perspective Lighting Lighting Clipping Clipping Lighting Clipping Transform. Transform. Database Database Database Transform. Transform. Transform. Transform. � projections � lighting � shading Scan Scan Depth Depth Frame- Frame- Frame � barycentric coordinates Scan Depth Texturing Texturing Texturing Blending Blending Blending Conversion Conversion buffer buffer buffer Conversion Test Test Test � review was Wed Feb 9 http://www.cs.ubc.ca/~tmm/courses/314/Vjan2005/slides/week6.day2.6up.pdf � � Review: Projective Rendering Pipeline Review: Transformations, Homog. Coords translate(a,b,c) translate(a,b,c) glVertex3f(x,y,z) glVertex3f(x,y,z) � � ⋅ � � viewing/ � � � � � � x x ⋅ w w x ' 1 a x � � � � � � � � � � object world y ⋅ ⋅ w camera � y w � w w � � y ' 1 b y � � � � � � � � � � alter w alter w = � w � � w � WCS WCS VCS VCS � � � � � � OCS OCS glFrustum(...) glFrustum (...) z ' 1 c z � � � � � � projection projection modeling modeling viewing viewing � � � � � � 1 1 1 transformation transformation transformation transformation transformation transformation � � � � clipping x x scale(a,b,c) scale(a,b,c) � � � � w= w= 1 1 glTranslatef(x,y,z) glTranslatef(x,y,z ) gluLookAt(...) gluLookAt (...) y � y � / w / w � � CCS CCS � � � � � � x ' a x � � � � glRotatef(th,x,y,z) glRotatef(th,x,y,z ) � 1 � � 1 � � � � � � � perspective perspective y ' b y .... .... � � � � � � = normalized division � � � � � � division y y z ' c z OCS - object coordinate system � � � � � � device glutInitWindowSize(w,h glutInitWindowSize(w,h) ) � 1 � � 1 � � 1 � WCS - world coordinate system glViewport(x,y,a,b glViewport(x,y,a,b) ) NDCS NDCS Rotate ( x , θ ) θ Rotate ( z , θ ) viewport viewport Rotate ( y , ) VCS - viewing coordinate system transformation transformation � � � � � � � � � � x ' 1 x cos θ sin θ cos θ − sin θ CCS - clipping coordinate system device � � � � � � � � � � θ − θ θ θ � y ' � � cos sin � � y � 1 sin cos � � � � = DCS DCS � � � � � � � � � � NDCS - normalized device coordinate system z ' sin θ cos θ z − θ θ 1 sin cos � � � � � � � � � � � � 1 � � 1 � � 1 � � 1 � � 1 � �� DCS - device coordinate system Review: Transforming View Volumes Review: Basic Perspective Projection perspective view volume perspective view volume orthographic view volume orthographic view volume y=top y P(x,y,z) P(x,y,z) y y=top similar triangles similar triangles x=left x=left P(x’,y’,d P(x’,y’,d) ) y y z z z x=right z=d VCS z=d y=bottom z=-near x VCS z=-far z=-far x y=bottom ⋅ ⋅ y ' y y d x d x=right z=-near = = z = ' d = z → y ' x ' but but also also z d z NDCS y (1,1,1) � nonuniform foreshortening z � not affine (-1,-1,-1) x �� �� Page 2 2
Review: Lighting Review: Shading Models � reflection equations � flat shading l n I diffuse = k d I light (n • l) � compute Phong lighting once for entire θ polygon I specular = k s I light ( v • r ) n shiny � Gouraud shading � compute Phong lighting at the vertices and interpolate lighting values across polygon R = 2 ( N ( N · L )) – L � Phong shading � full Phong lighting model � compute averaged vertex normals � combine ambient, diffuse, specular � interpolate normals across polygon and components perform Phong lighting across polygon # lights � k d ( n • l i ) + k s ( v • r i ) n shiny ) I total = k s I ambient + I i ( �� �� i = 1 Review: Barycentric Coordinates Midterm 2 Topics Covered � color � weighted combination of vertices � rasterization/scan conversion � clipping = α ⋅ + β ⋅ + γ ⋅ P P P P � visibility / hidden surfaces 1 2 3 α + β + γ = 1 � texturing P � procedural approaches 0 ≤ α , β , γ ≤ 1 (1,0,0) (1,0,0) 1 β = � advanced rendering 0 “convex combination convex combination “ of points” of points” β = 0 . 5 � sampling/antialiasing (0,0,1) (0,0,1) � animation P 3 P β = 1 � picking � review was Fri Mar 18 P (0,1,0) (0,1,0) 2 �� �� http://www.cs.ubc.ca/~tmm/courses/314/Vjan2005/slides/week10.day3.6up.pdf Review: Color Review: Scan Conversion � color perception � lines: midpoint algorithm � optimized: Bresenham � color is combination of stimuli from 3 cones � metamer: identically � polygons perceived color caused by very different spectra 3 1 � flood fill � simple model: based on 5=0 2 P � scanline algorithms RGB triples 4 � component-wise � parity test for general case multiplication of colors � (a0,a1,a2) * (b0,b1,b2) = (a0*b0, a1*b1, a2*b2) �� �� Page 3 3
Review: Clipping Review: Visibility � Cohen Sutherland lines: combining trivial accepts/rejects � painter’s algorithm � trivially accept lines: both endpoints inside all edges � back to front, incorrect � outcode test: OC(p1)== 0 && OC(p2)==0 � BSP trees � trivially reject lines: both endpoints outside same edge � build, then traverse � outcode test: OC(p1) & OC(p2))!= 0 reject � Warnock’s algorithm � otherwise, reduce to trivial: splitting into two segments � subdivide viewport � Sutherman-Hodgeman polygons � Z-buffer � for each viewport edge: clip polygon against edge � process input edge list to make output edge list � depth buffer in addition to framebuffer � inside or outside status between each vertex pair � backface culling � optimization for closed objects �� �� Review: Procedural Approaches Review: Advanced Rendering � Perlin noise � ray tracing � coherency: smooth not abrupt changes � reflection, refraction, hard shadows � turbulence: multiple feature sizes � subsurface scattering � marble, milk � particle systems � radiosity � diffuse lighting, soft shadows � fractal landscapes � image-based rendering � store/access only pixels � L-systems �� �� Review: Recursive Ray Tracing Review: Sampling � ray tracing can handle � Shannon Sampling Theorem � reflection (chrome) � continuous signal can be completely recovered from � refraction (glass) its samples iff sampling rate greater than twice � shadows maximum frequency present in signal � spawn secondary rays � sample past Nyquist Rate to avoid aliasing � reflection, refraction � twice the highest frequency component in the image’s spectrum � if another object is hit, pixel positions recurse to find its color on projection projection plane � shadow reference point � cast ray from intersection point to light source, check if intersects another object �� �� Page 4 4
Recommend
More recommend