1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.

Slides:



Advertisements
Similar presentations
Transformations Ed Angel Professor Emeritus of Computer Science
Advertisements

1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Computer Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Projection Matrices Ed Angel
CS5500 Computer Graphics March 22, Angel: Interactive Computer Graphics 3E © Addison-Wesley 2002 Coordinate-Free Geometry When we learned simple.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Representation Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Transformations. 2 Angel: Interactive Computer Graphics 3E © Addison-Wesley 2002 Coordinate-Free Geometry When we learned simple geometry, most of us.
Representation CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
CS 480/680 Computer Graphics Representation Dr. Frederick C Harris, Jr. Fall 2012.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Introduction to Computer Graphics with WebGL
Intro to 3D Models Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Transformations Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Geometric Objects and Transformation
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Representation. Objectives Introduce concepts such as dimension and basis Introduce coordinate systems for representing vectors spaces and frames for.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 52 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 52 Computer Graphics Three-Dimensional Graphics I.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CSE Real Time Rendering Week 5. Slides(Some) Courtesy – E. Angel and D. Shreiner.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Graphics CSCI 343, Fall 2015 Lecture 10 Coordinate Transformations.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Programming with OpenGL Part 2: Complete Programs Ed Angel Professor of Emeritus of Computer Science University of New Mexico.
Programming with OpenGL Part 2: Complete Programs Ed Angel Professor of Emeritus of Computer Science University of New Mexico.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CSC461: Lecture 13 Coordinates Objectives Introduce concepts such as dimension and basis Introduce concepts such as dimension and basis Introduce coordinate.
1 Representation. 2 Objectives Introduce concepts such as dimension and basis Introduce coordinate systems for representing vectors spaces and frames.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CS5500 Computer Graphics March 20, Computer Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Computer Viewing Isaac Gang University of Mary Hardin-Baylor.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Transformations Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Transformations. Transformations Introduce standard transformations ◦ Rotation ◦ Translation ◦ Scaling ◦ Shear Derive homogeneous coordinate transformation.
Introduction to Computer Graphics with WebGL
Coordinate Change.
Representation Ed Angel Professor Emeritus of Computer Science,
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Isaac Gang University of Mary Hardin-Baylor
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Transformations.
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Isaac Gang University of Mary Hardin-Baylor
CSC461: Lecture 14 Representations
Angel: Interactive Computer Graphics5E © Addison-Wesley 2009
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
University of New Mexico
Transformations Ed Angel Professor Emeritus of Computer Science
Representation Ed Angel Professor Emeritus of Computer Science,
PPT&Programs
Computer Viewing Ed Angel Professor Emeritus of Computer Science
Representation Ed Angel
Presentation transcript:

1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science Laboratory University of New Mexico Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

2 Homogeneous Coordinates Ed Angel Professor Emeritus of Computer Science, University of New Mexico Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

3 Objectives Introduce homogeneous coordinates Introduce change of representation for both vectors and points Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

4 A Single Representation If we define 0P = 0 and 1P =P then we can write v=  1 v 1 +  2 v 2 +  3 v 3 = [  1  2  3 0 ] [v 1 v 2 v 3 P 0 ] T P = P 0 +  1 v 1 +  2 v 2 +  3 v 3 = [  1  2  3 1 ] [v 1 v 2 v 3 P 0 ] T Thus we obtain the four-dimensional homogeneous coordinate representation v = [  1  2  3 0 ] T p = [  1  2  3 1 ] T Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

5 Homogeneous Coordinates and Computer Graphics Homogeneous coordinates are key to all computer graphics systems ­All standard transformations (rotation, translation, scaling) can be implemented with matrix multiplications using 4 x 4 matrices ­Hardware pipeline works with 4 dimensional representations ­For orthographic viewing, we can maintain w=0 for vectors and w=1 for points ­For perspective, we need a perspective division Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

6 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Change of Coordinate Systems Consider two representations of the same vector “x” with respect to two different basis ( ­In basis (v 1,v 2,v 3 ) ­In basis (u 1,u 2,u 3 ) x’ =  1 u 1 +  2 u 2 +  3 u 3 x’ = [  1  2  3 ] [u 1 u 2 u 3 ] T x x =  1 v 1 +  2 v 2 +  3 v 3 x = [  1  2  3 ] [v 1 v 2 v 3 ] T

7 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Change of Coordinate Systems Or, more conveniently, In basis (v 1, v 2, v 3 ) x =[  1  2  3 ] T In basis (u 1, u 2, u 3 ) x’=[  1  2  3 ] T Of course, x = x’

8 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Representing second basis in terms of first Each of the basis vectors, u 1,u 2,u 3, are vectors that can be represented in terms of the first basis u 1 =  11 v 1 +  12 v 2 +  13 v 3 u 2 =  21 v 1 +  22 v 2 +  23 v 3 u 3 =  31 v 1 +  32 v 2 +  33 v 3

9 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Representing second basis in terms of first Using x’=  1 u 1 +  2 u 2 +  3 u 3 we obtain x’=  1 (  11 v 1 +  12 v 2 +  13 v 3 ) +  2 (  21 v 1 +  22 v 2 +  23 v 3 ) +  3 (  31 v 1 +  32 v 2 +  33 v 3 ) x'=(  1  11 +  2  21 +  3  31 ) v 1 + (  1  12 +  2  22 +  3  32 ) v 2 + (  1  13 +  2  23 +  3  33 ) v 3 which can be compared to x=  1 v 1 +  2 v 2 +  3 v 3

10 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Representing second basis in terms of first Therefore,  1  11  1 +  21  2 +  31  3  2  12  1 +  22  2 +  32  3  3   13  1 +  23  2 +  33  3

11 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Matrix Form The coefficients define a 3 x 3 matrix and the bases can be related by x = M T x’ where x=[  1  2  3 ] T x’=[  1  2  3 ] T M =

12 Change of Frames We can apply a similar process in homogeneous coordinates to the representations of both points and vectors Any point or vector can be represented in either frame We can represent Q 0, u 1, u 2, u 3 in terms of P 0, v 1, v 2, v 3 Consider two frames: (P 0, v 1, v 2, v 3 ) (Q 0, u 1, u 2, u 3 ) P0P0 v1v1 v2v2 v3v3 Q0Q0 u1u1 u2u2 u3u3 Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

13 Representing One Frame in Terms of the Other u 1 =  11 v 1 +  12 v 2 +  13 v 3 u 2 =  21 v 1 +  22 v 2 +  23 v 3 u 3 =  31 v 1 +  32 v 2 +  33 v 3 Q 0 =  41 v 1 +  42 v 2 +  43 v 3 +  44 P 0 Extending what we did with change of bases defining a 4 x 4 matrix M = Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

14 Working with Representations Within the two frames any point or vector has a representation of the same form x=[  1  2  3  4 ] in the first frame x'=[  1  2  3  4 ] in the second frame where  4   4  for points and  4   4  for vectors and The matrix M is 4 x 4 and specifies an affine transformation in homogeneous coordinates x=M T x’ Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

15 Affine Transformations Every linear transformation is equivalent to a change in frames Every affine transformation preserves lines However, an affine transformation has only 12 degrees of freedom because 4 of the elements in the matrix are fixed and are a subset of all possible 4 x 4 linear transformations Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

16 The World and Camera Frames When we work with representations, we work with n-tuples or arrays of scalars Changes in frame are then defined by 4 x 4 matrices In OpenGL, the base frame that we start with is the world frame Eventually we represent entities in the camera frame by changing the world representation using the model-view matrix Initially these frames are the same ( M=I ) Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

17 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Moving the Camera Moving the camera in the +Z direction is equivalent to move objects in the –Z direction : M = =

18 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Moving the Camera