University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Midterm Review Week 7, Wed 16 Oct 2003 midterm review project 1 demos, hall.

Slides:



Advertisements
Similar presentations
Graphics Pipeline.
Advertisements

2 COEN Computer Graphics I Evening’s Goals n Discuss the fundamentals of lighting in computer graphics n Analyze OpenGL’s lighting model n Show.
3D Graphics Rendering and Terrain Modeling
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Transformations III Week.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Display Lists, Viewing.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Textures I Week 8, Mon.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Transformations III Week.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Viewing/Projections I.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Prog 2, Kangaroo Hall.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Viewing/Projections IV.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Lighting/Shading III Week.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Transformations Week 2,
Transformations II Week 2, Wed Jan 17
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Projections II Week 4,
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Viewing/Projections III.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Interpolation Clipping.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Lighting/Shading I Week.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Viewing/Projections II.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Transformations II Week.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Viewing/Projections III.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Lighting and Shading Week.
University of British Columbia CPSC 314 Computer Graphics May-June 2005 Tamara Munzner Viewing, Projections.
Transformations IV Week 3, Wed Jan 23
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Scan Conversion Week 6, Mon 6 Oct 2003 recap: Bresenham line algorithm scan.
Projections and Picking Wed 24 Sep 2003
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Viewing and Projections Wed 17 Oct 2003 project 1 recap: display lists viewing.
Scan Conversion Week 6, Wed 8 Oct 2003
University of British Columbia CPSC 414 Computer Graphics Week 3, Monday 15 Oct 03 © Tamara Munzner 1 Hierarchies, Display Lists recap: matrix hierarchies,
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Transformations III Week.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Viewing/Projections I.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Viewing and Projections Mon 22 Sep 2003 project 1 solution demo recap: projections.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Picking and Lighting Week 4, Fri 26 Sep 2003 recap: viewports and picking.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Shading Week 5, Wed 1 Oct 2003 recap: lighting shading.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Lighting and Shading Week.
Rendering Pipeline Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006 (Slide set originally by Greg Humphreys)
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) CS 426 Intro to 3D Computer Graphics © 2003, 2004, 2005 Jason Leigh Electronic.
COMP 175: Computer Graphics March 24, 2015
Computer Graphics Panos Trahanias ΗΥ358 Spring 2009.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
MIT EECS 6.837, Durand and Cutler Graphics Pipeline: Projective Transformations.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 Going-through.
Rendering Overview CSE 3541 Matt Boggus. Rendering Algorithmically generating a 2D image from 3D models Raster graphics.
CAP4730: Computational Structures in Computer Graphics 3D Transformations.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Lighting/Shading I Week.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner Rasterization.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
RENDERING Introduction to Shading models – Flat and Smooth shading – Adding texture to faces – Adding shadows of objects – Building a camera in a program.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Scan Conversion Week 5, Fri 3 Oct 2003 recap: shading scan conversion: lines.
12/24/2015 A.Aruna/Assistant professor/IT/SNSCE 1.
MIT EECS 6.837, Durand and Cutler The Graphics Pipeline: Projective Transformations.
Computer Graphics Filling. Filling Polygons So we can figure out how to draw lines and circles How do we go about drawing polygons? We use an incremental.
Rendering Pipeline Fall, D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination.
CS559: Computer Graphics Final Review Li Zhang Spring 2010.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Viewing/Projections IV.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Viewing/Projections I.
Final Review I University of British Columbia
Rendering Pipeline Fall, 2015.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016
Computer Graphics Filling.
Transformations V, Viewing I Week 3, Fri Jan 22
Rendering Pipeline Aaron Bloomfield CS 445: Introduction to Graphics
3D Graphics Rendering PPT By Ricardo Veguilla.
Viewing/Projections I Week 3, Fri Jan 25
Transformations 6 University of British Columbia
Viewing II Week 4, Mon Jan 25
Transformations IV Week 3, Wed Jan 20
Viewing III Week 4, Wed Jan 27
Transformations III Week 3, Mon Jan 21
Viewing/Projections I Week 3, Fri Jan 25
Transformations IV Week 3, Wed Jan 23
Presentation transcript:

University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Midterm Review Week 7, Wed 16 Oct 2003 midterm review project 1 demos, hall of fame

Week 7, Wed 15 Oct 03 © Tamara Munzner2 News homework 1 due now –one day late if in handin box 18 by 9am Thu –two days late if in at class beginning Fri –no homeworks accepted after Fri 9am! solutions out then

Week 7, Wed 15 Oct 03 © Tamara Munzner3 Midterm Exam Monday Oct 20 9am-9:50am –you may use one handwritten 8.5”x11” sheet OK to use both sides of page –no other notes, no books –nonprogrammable calculators OK –arrive on time!!

Week 7, Wed 15 Oct 03 © Tamara Munzner4 What’s Covered transformations viewing and projections coordinate systems of rendering pipeline picking lighting and shading scan conversion not sampling

Week 7, Wed 15 Oct 03 © Tamara Munzner5 Reading Angel book –Chap 1, 2, 3, 4, 5, 6, , –you can be tested on material in book but not covered in lecture –you can be tested on material covered in lecture but not covered in book

Week 7, Wed 15 Oct 03 © Tamara Munzner6 Old Exams Posted see course web page

Week 7, Wed 15 Oct 03 © Tamara Munzner7 The Rendering Pipeline pros and cons of pipeline approach GeometryDatabaseGeometryDatabase Model/ViewTransform.Model/ViewTransform. LightingLightingPerspectiveTransform.PerspectiveTransform.ClippingClipping ScanConversionScanConversion DepthTestDepthTest TexturingTexturing BlendingBlending Frame-bufferFrame-buffer

Week 7, Wed 15 Oct 03 © Tamara Munzner8 Transformationstranslate(a,b,c) scale(a,b,c)

Week 7, Wed 15 Oct 03 © Tamara Munzner9 Homogeneous Coordinates x y w w=1

Week 7, Wed 15 Oct 03 © Tamara Munzner10 Composing Transformations Ta Tb = Tb Ta, but Ra Rb != Rb Ra and Ta Rb != Rb Ta

Week 7, Wed 15 Oct 03 © Tamara Munzner11 Composing Transformations example: rotation around arbitrary center

Week 7, Wed 15 Oct 03 © Tamara Munzner12 Composing Transformations example: rotation around arbitrary center –step 1: translate coordinate system to rotation center

Week 7, Wed 15 Oct 03 © Tamara Munzner13 Composing Transformations example: rotation around arbitrary center –step 2: perform rotation

Week 7, Wed 15 Oct 03 © Tamara Munzner14 Composing Transformations example: rotation around arbitrary center –step 3: back to original coordinate system

Week 7, Wed 15 Oct 03 © Tamara Munzner15 Composing Transformations rotation about a fixed point p’ = TRT -1 p rotation around an arbitrary axis considering frame vs. object p’ = DCBAp object frame OpenGL: D C B A draw p

Week 7, Wed 15 Oct 03 © Tamara Munzner16 Transformation Hierarchies hierarchies don’t fall apart when changed transforms apply to graph nodes beneath

Week 7, Wed 15 Oct 03 © Tamara Munzner17 Matrix Stacks push and pop matrix stack –avoid computing inverses or incremental xforms –avoid numerical error World coordinates T 1 (x) T 2 (x) T 3 (x)

Week 7, Wed 15 Oct 03 © Tamara Munzner18 Matrix Stacks glPushMatrix() glPopMatrix() A B C A B C A B C C glScale3f(2,2,2) D = C scale(2,2,2) trans(1,0,0) A B C D DrawSquare() glTranslate3f(1,0,0) DrawSquare() glPushMatrix() glPopMatrix()

Week 7, Wed 15 Oct 03 © Tamara Munzner19 Transformation Hierarchies example x y glTranslate3f(x,y,0); glRotatef(,0,0,1); DrawBody();glPushMatrix(); glTranslate3f(0,7,0); glTranslate3f(0,7,0); DrawHead(); DrawHead();glPopMatrix();glPushMatrix(); glTranslate(2.5,5.5,0); glTranslate(2.5,5.5,0); glRotatef(,0,0,1); glRotatef(,0,0,1); DrawUArm(); DrawUArm(); glTranslate(0,-3.5,0); glTranslate(0,-3.5,0); glRotatef(,0,0,1); glRotatef(,0,0,1); DrawLArm(); DrawLArm();glPopMatrix();... (draw other arm)

Week 7, Wed 15 Oct 03 © Tamara Munzner20 Display Lists reuse block of OpenGL code more efficient than immediate mode –code reuse, driver optimization good for static objects redrawn often –can’t change contents –not just for multiple instances interactive graphics: objects redrawn every frame nest when possible for efficiency

Week 7, Wed 15 Oct 03 © Tamara Munzner21 Double Buffering two buffers, front and back –while front is on display, draw into back –when drawing finished, swap the two avoid flicker

Week 7, Wed 15 Oct 03 © Tamara Munzner22 Projective Rendering Pipeline OCS - object coordinate system WCS - world coordinate system VCS - viewing coordinate system CCS - clipping coordinate system NDCS - normalized device coordinate system DCS - device coordinate system OCS WCS VCS CCS NDCS DCSmodelingtransformationviewingtransformationprojectiontransformationviewporttransformation alter w / w objectworld viewing/ camera device normalized device clipping perspectivedivision glVertex3f(x,y,z) glTranslatef(x,y,z)glRotatef(th,x,y,z)....gluLookAt(...) glFrustum(...) glutInitWindowSize(w,h)glViewport(x,y,a,b)

Week 7, Wed 15 Oct 03 © Tamara Munzner23 Projection theoretical pinhole camera imageplane eye point point – image inverted, more convenient equivalent imageplane eye point point

Week 7, Wed 15 Oct 03 © Tamara Munzner24 Projection Taxonomy planarprojections perspective:1,2,3-point parallel oblique orthographic cabinet cavalier top,front,side axonometric:isometricdimetrictrimetric

Week 7, Wed 15 Oct 03 © Tamara Munzner25 Projective Transformations transformation of space –center of projection moves to infinity –viewing frustum transformed into a parallelpiped -z x -z x Frustum

Week 7, Wed 15 Oct 03 © Tamara Munzner26 Normalized Device Coordinates left/right x =+/- 1, top/bottom y =+/- 1, near/far z =+/- 1 -z x Frustum z=-n z=-f right left z x x= -1 z=1 x=1 Camera coordinates NDC z= -1

Week 7, Wed 15 Oct 03 © Tamara Munzner27 Projection Normalization distort such that orthographic projection of distorted objects is desired persp projection -zxz x

Week 7, Wed 15 Oct 03 © Tamara Munzner28 Transforming View Volumes x z NDCS y (-1,-1,-1) (1,1,1) orthographic view volume x z VCS y x=left y=top x=right z=-far z=-near y=bottom perspective view volume x=left x=right y=top y=bottom z=-near z=-far x VCS y

Week 7, Wed 15 Oct 03 © Tamara Munzner29 Basic Perspective Projection similar triangles z P(x,y,z) P(x’,y’,d) z=d y also nonuniform foreshortening – not affine but

Week 7, Wed 15 Oct 03 © Tamara Munzner30 Basic Perspective Projection can express as homogenous 4x4 matrix!

Week 7, Wed 15 Oct 03 © Tamara Munzner31 Projective Transformations determining the matrix representation –need to observe 5 points in general position, e.g. [left,0,0,1] T  [-1,0,0,1] T [0,top,0,1] T  [0,1,0,1] T [0,0,-f,1] T  [0,0,1,1] T [0,0,-n,1] T  [0,0,-1,1] T [left*f/n,top*f/n,-f,1] T  [-1,1,1,1] T –solve resulting equation system to obtain matrix

Week 7, Wed 15 Oct 03 © Tamara Munzner32 OpenGL Orthographic Matrix scale, translate, reflect for new coord sys –understand derivation!

Week 7, Wed 15 Oct 03 © Tamara Munzner33 OpenGL Perspective Matrix shear, scale, reflect for new coord sys –understand derivation!

Week 7, Wed 15 Oct 03 © Tamara Munzner34 Viewport Transformation x (0,0)(w,h)DCS a b y (0,0) (w,h) DCS a bxy (-1,-1) (1,1) NDCS xy display viewportxy onscreen pixels: map from [-1,1] to [0, displaywidth] DCS

Week 7, Wed 15 Oct 03 © Tamara Munzner35 3 Simple Picking Approaches manual ray intersection bounding extents backbuffer coloring x VCS y

Week 7, Wed 15 Oct 03 © Tamara Munzner36 Picking Select/Hit assign (hierarchical) integer key/name(s) small region around cursor as new viewport redraw in selection mode –equivalent to casting pick “tube” –store keys, depth for drawn objects in hit list examine hit list –usually use frontmost, but up to application

Week 7, Wed 15 Oct 03 © Tamara Munzner37 Light Sources directional/parallel lights point at infinity: (x,y,z,0) T point lights finite position: (x,y,z,1) T spotlights position, direction, angle ambient lights

Week 7, Wed 15 Oct 03 © Tamara Munzner38 Illumination as Radiative Transfer –model light transport as packet flow particles not waves heat / light source thermometer / eye reflective objects energy packets

Week 7, Wed 15 Oct 03 © Tamara Munzner39 Reflectance specular: perfect mirror with no scattering gloss: mixed, partial specularity diffuse: all directions with equal energy + + = specular + glossy + diffuse = reflectance distribution

Week 7, Wed 15 Oct 03 © Tamara Munzner40 Reflection Equations I diffuse = k d I light (n l) nl  2 ( N (N · L)) – L = R

Week 7, Wed 15 Oct 03 © Tamara Munzner41 Reflection Equations Blinn improvement full Phong lighting model –combine ambient, diffuse, specular components lnv h

Week 7, Wed 15 Oct 03 © Tamara Munzner42 Lighting vs. Shading lighting –simulating the interaction of light with surface shading –deciding pixel color –continuum of realism: when do we do lighting calculation?

Week 7, Wed 15 Oct 03 © Tamara Munzner43 Shading Models 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

Week 7, Wed 15 Oct 03 © Tamara Munzner44 Shutterbug: Flat Shading

Week 7, Wed 15 Oct 03 © Tamara Munzner45 Shutterbug: Gouraud Shading

Week 7, Wed 15 Oct 03 © Tamara Munzner46 Shutterbug: Phong Shading

Week 7, Wed 15 Oct 03 © Tamara Munzner47 Scanline Algorithms given vertices, fill in the pixels arbitrary polygons (non-simple, non-convex) build edge table for each scanline obtain list of intersections, i.e., AEL use parity test to determine in/out and fill in the pixels triangles split into two regions fill in between edges

Week 7, Wed 15 Oct 03 © Tamara Munzner48 Edge Equations define triangle as intersection of three positive half-spaces: A 1 x + B 1 y + C 1 < 0 A 2 x + B 2 y + C 2 < 0 A 3 x + B 3 y + C 3 < 0 A 1 x + B 1 y + C 1 > 0 A 3 x + B 3 y + C 3 > 0 A 2 x + B 2 y + C 2 > 0

Week 7, Wed 15 Oct 03 © Tamara Munzner49 Edge Equations So…simply turn on those pixels for which all edge equations evaluate to > 0:

Week 7, Wed 15 Oct 03 © Tamara Munzner50 Parity for General Case use parity for interior test –draw pixel if edgecount odd –horizontal lines: count –vertical max: count –vertical min: don’t count

Week 7, Wed 15 Oct 03 © Tamara Munzner51 Edge Tables edge table (ET) –store edges sorted by y in linked list at ymin, store ymax, xmin, slope active edge table (AET) –active: currently used for computation –store active edges sorted by x update each scanline, store ET values + current_x –for each scanline (from bottom to top) do EAT bookkeeping traverse EAT (from leftmost x to rightmost x) –draw pixels if parity odd

Week 7, Wed 15 Oct 03 © Tamara Munzner52 Barycentric Coordinates weighted combination of vertices –understand derivation! (1,0,0) (0,1,0) (0,0,1) “convex combination of points” of points”

Week 7, Wed 15 Oct 03 © Tamara Munzner53 apply nonuniform scale: stretch along x by 2 –can’t transform normal by modelling matrix solution: Transforming Normals normal to any surface transformed by inverse transpose of modelling transformation