University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Transformations Week 2,

Slides:



Advertisements
Similar presentations
CS 691 Computational Photography Instructor: Gianfranco Doretto Image Warping.
Advertisements

Computer Graphics Lecture 4 Geometry & Transformations.
Geometric Transformations
MAE152 Computer Graphicsfor Scientists and Engineers Revision of Matrices Relevance to Graphics.
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 2008 Tamara Munzner Transformations II Week.
University of British Columbia CPSC 314 Computer Graphics May-June 2005 Tamara Munzner Transformations I, II,
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Transformations I Week.
Transformations II Week 2, Wed Jan 17
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Math Review Rendering.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Transformations II Week.
HCI 530 : Seminar (HCI) Damian Schofield. HCI 530: Seminar (HCI) Transforms –Two Dimensional –Three Dimensional The Graphics Pipeline.
Transformations IV Week 3, Wed Jan 23
Image Warping : Computational Photography Alexei Efros, CMU, Fall 2006 Some slides from Steve Seitz
Graphics-1 Gentle Introduction to Computer Graphics (2) Based on: –David Brogan’s “Introduction to Computer Graphics” Course Slides, University of Virginia.
Welcome to CSc 830 Advanced Computer Graphics
Image Warping : Computational Photography Alexei Efros, CMU, Fall 2008 Some slides from Steve Seitz
Image Warping : Computational Photography Alexei Efros, CMU, Fall 2005 Some slides from Steve Seitz
University of British Columbia © MIchiel van de Panne Geometric Transformations and quick OpenGL intro.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner OpenGL, GLUT, Transformations.
Computer Graphics (Fall 2008) COMS 4160, Lecture 3: Transformations 1
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Transformations III Week.
Computer Graphics (Fall 2004) COMS 4160, Lecture 3: Transformations 1
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Rendering Pipeline OpenGL/GLUT.
2D transformations and homogeneous coordinates Dr Nicolas Holzschuch University of Cape Town Modified.
Introduction to Computer Graphics CS 445 / 645 Lecture 5 Transformations Transformations M.C. Escher – Smaller and Smaller (1956)
Image Warping Computational Photography Derek Hoiem, University of Illinois 09/27/11 Many slides from Alyosha Efros + Steve Seitz Photo by Sean Carroll.
Image Warping (Szeliski 3.6.1) cs129: Computational Photography James Hays, Brown, Fall 2012 Slides from Alexei Efros and Steve Seitz
Transformations Aaron Bloomfield CS 445: Introduction to Graphics
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
Multimedia Programming 06: Image Warping Departments of Digital Contents Sang Il Park.
Warping CSE 590 Computational Photography Tamara Berg.
CS 445 / 645 Introduction to Computer Graphics Lecture 3 Mathematical Primitives Introduction to Transformations Lecture 3 Mathematical Primitives Introduction.
ICS201 Lecture 12 : Gentle Introduction to Computer Graphics II King Fahd University of Petroleum & Minerals College of Computer Science & Engineering.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner GLUT, Transformations.
Image Warping Computational Photography Derek Hoiem, University of Illinois 09/23/10 Many slides from Alyosha Efros + Steve Seitz Photo by Sean Carroll.
16/5/ :47 UML Computer Graphics Conceptual Model Application Model Application Program Graphics System Output Devices Input Devices API Function.
Transformational Geometry CS418 Computer Graphics John C. Hart.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Scan Conversion Week 5, Fri 3 Oct 2003 recap: shading scan conversion: lines.
Transformations
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner OpenGL/GLUT Intro Week.
3D Transformation A 3D point (x,y,z) – x,y, and z coordinates
Transformations: Projection CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
Recap from Monday DCT and JPEG Point Processing Histogram Normalization Questions: JPEG compression levels Gamma correction.
Image Warping Many slides from Alyosha Efros + Steve Seitz + Derek oeim Photo by Sean Carroll.
Image Warping 2D Geometric Transformations
Transformations. Modeling Transformations  Specify transformations for objects  Allows definitions of objects in own coordinate systems  Allows use.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Viewing/Projections I.
Transformations University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016 Tamara Munzner.
Final Review I University of British Columbia
Computer Graphics CC416 Week 15 3D Graphics.
Computer Graphics Transformations.
Computer Graphics Transformations.
Introduction to Computer Graphics CS 445 / 645
Image Warping (Szeliski Sec 2.1.2)
Image Warping (Szeliski Sec 2.1.2)
Image Warping : Computational Photography
Transformations 6 University of British Columbia
Recap from Friday Image Completion Synthesis Order Graph Cut Scene Completion.
Transformations 3 University of British Columbia
Rendering Pipeline, OpenGL/GLUT
Image Warping : Computational Photography
Three-Dimensional Graphics
Image Warping (Szeliski Sec 2.1.2)
Transformations III Week 3, Mon Jan 21
Transformations II Week 2, Fri Jan 18
OpenGL, GLUT, Transformations I Week 2, Wed Jan 16
Transformations IV Week 3, Wed Jan 23
3D transformations Dr Nicolas Holzschuch University of Cape Town
Transformations 2 University of British Columbia
Presentation transcript:

University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Transformations Week 2, Wed Jan 12

2 Reading FCG Chap 5 (except 5.1.6, 5.3.1), FCG pages RB Chap Viewing: Sect. Viewing and Modeling Transforms until Viewing Transformations Sect. Examples of Composing Several Transformations through Building an Articulated Robot Arm RB Appendix Homogeneous Coordinates and Transformation Matrices until Perspective Projection

3 Textbook Errata list at math review: also p 48 a x (b x c) != (a x b) x c transforms: p 91 should halve x (not y) in Fig 5.10 transforms: p 106 second line of matrices: [x p, y p, 1]

4 Review: Rendering Pipeline GeometryDatabaseGeometryDatabase Model/ViewTransform.Model/ViewTransform. LightingLightingPerspectiveTransform.PerspectiveTransform. ClippingClipping ScanConversionScanConversion DepthTestDepthTest TexturingTexturing BlendingBlending Frame-bufferFrame-buffer

5 Review: OpenGL void display() { glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); glColor3f(0.0, 1.0, 0.0); glBegin(GL_POLYGON); glVertex3f(0.25, 0.25, -0.5); glVertex3f(0.75, 0.25, -0.5); glVertex3f(0.75, 0.75, -0.5); glVertex3f(0.25, 0.75, -0.5); glEnd(); glFlush(); } pipeline processing, set state as needed

6 Review: Event-Driven Programming main loop not under your control vs. procedural control flow through event callbacks redraw the window now key was pressed mouse moved callback functions called from main loop when events occur mouse/keyboard state setting vs. redrawing

7 Keyboard/Mouse Callbacks do minimal work request redraw for display example: keypress triggering animation do not create loop in input callback! what if user hits another key during animation? shared/global variables to keep track of state display function acts on current variable value

8 Transformations

9 transforming an object = transforming all its points transforming a polygon = transforming its vertices

10 Matrix-Vector Multiplication linear transformation of a vector maps one vector to another preserves linear combinations any linear transform can be represented by a matrix scaling rotation translation

11 Scaling scaling a coordinate means multiplying each of its components by a scalar uniform scaling means this scalar is the same for all components:  2 2

12 non-uniform scaling: different scalars per component: how can we represent this in matrix form? Scaling X  2, Y  0.5

13 Scaling scaling operation: or, in matrix form: scaling matrix

14 2D Rotation  (x, y) (x’, y’) x’ = x cos(  ) - y sin(  ) y’ = x sin(  ) + y cos(  )

15 2D Rotation From Trig Identities x = r cos (  ) y = r sin (  ) x’ = r cos (  +  ) y’ = r sin (  +  ) Trig Identity… x’ = r cos(  ) cos(  ) – r sin(  ) sin(  ) y’ = r sin(  ) cos(  ) + r cos(  ) sin(  ) Substitute… x’ = x cos(  ) - y sin(  ) y’ = x sin(  ) + y cos(  )  (x, y) (x’, y’) 

16 2D Rotation Matrix easy to capture in matrix form: even though sin(q) and cos(q) are nonlinear functions of q, x’ is a linear combination of x and y y’ is a linear combination of x and y

17 2D Rotation: Another Derivation (x’,y’)  (x,y)

18 2D Rotation: Another Derivation (x’,y’) (x,y)  x y

19 2D Rotation: Another Derivation (x’,y’) (x,y)  x y  x y

20 2D Rotation: Another Derivation x ' B A (x’,y’) (x,y)

21 2D Rotation: Another Derivation x x ' B A (x’,y’) (x,y)  x

22 2D Rotation: Another Derivation x B A y y   (x’,y’) (x,y)  x ' 

23 2D Translation (x,y) (x’,y’)

24 2D Translation (x,y) (x’,y’) scaling matrixrotation matrix

25 2D Translation (x,y) (x’,y’) scaling matrixrotation matrix vector addition matrix multiplication

26 2D Translation (x,y) (x’,y’) scaling matrixrotation matrix translation multiplication matrix?? vector addition matrix multiplication

27 Challenge matrix multiplication for everything except translation how to do everything with multiplication? then just do composition, no special cases homogeneous coordinates trick represent 2D coordinates (x,y) with 3-vector (x,y,1)

28 Homogeneous Coordinates our 2D transformation matrices are now 3x3: use rightmost column

29 Homogeneous Coordinates Geometrically © Marc Levoy point in 2D cartesian + weight w = point P in 3D homog. coords multiples of (x,y,w) form a line L in 3D all homogeneous points on L represent same 2D cartesian point example: (2,2,1) = (4,4,2) = (1,1,0.5) homogeneouscartesian / w

30 Homogeneous Coordinates Geometrically © Marc Levoy homogenize to convert homog. 3D point to cartesian 2D point: divide by w to get (x/w, y/w, 1) projects line to point onto w=1 plane when w=0, consider it as direction points at infinity these points cannot be homogenized (0,0,0) is undefined homogeneouscartesian / w

31 Homogeneous Coordinates Geometrically © Marc Levoy w=0 denotes points at infinity think of as direction cannot be homogenized lies on x-y plane (0,0,0) is not allowed homogeneouscartesian / w

32 Homogeneous Coordinates Summary may seem unintuitive, but they make graphics operations much easier allow all linear transformations to be expressed through matrix multiplication use 4x4 matrices for 3D transformations

33 3D Rotation About Z Axis glRotatef(angle,x,y,z); glRotatef(angle,0,0,1); general OpenGL command rotate in z

34 3D Rotation in X, Y glRotatef(angle,1,0,0); around x axis: glRotatef(angle,0,1,0); around y axis:

35 3D Scaling glScalef(a,b,c); scale(a,b,c)

36 3D Translation glTranslatef(a,b,c); translate(a,b,c)