Introduction to Computer Graphics with WebGL

Slides:



Advertisements
Similar presentations
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Projection Matrices modified by Ray Wisman Ed Angel Professor of Computer.
Advertisements

Projection Matrices CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Based on slides created by Edward Angel
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
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Representation Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Objectives Derive the perspective projection matrices used for standard OpenGL projections Derive the perspective projection matrices used for standard.
1 Chapter 5 Viewing. 2 Perspective Projection 3 Parallel Projection.
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.
Computer Graphics (fall 2009)
1 Projection Matrices. 2 Objectives Derive the projection matrices used for standard OpenGL projections Introduce oblique projections Introduce projection.
1 E. Angel and D. Shreiner : Interactive Computer Graphics 6E © Addison-Wesley 2012 Classical Viewing Sai-Keung Wong ( 黃世強 ) Computer Science National.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 67 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 67 Computer Graphics Three-Dimensional Graphics III.
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.
Demetriou/Loizidou – ACSC330 – Chapter 5 Viewing Dr. Giorgos A. Demetriou Computer Science Frederick Institute of Technology.
Computer Graphics I, Fall 2010 Computer Viewing.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Classical Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Classical Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Viewing and Projection
Classical Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Viewing Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
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.
Viewing. Classical Viewing Viewing requires three basic elements - One or more objects - A viewer with a projection surface - Projectors that go from.
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
Viewing.
Introduction to Computer Graphics with WebGL
Computer Viewing.
Introduction to Computer Graphics with WebGL
Isaac Gang University of Mary Hardin-Baylor
Representation Ed Angel Professor Emeritus of Computer Science,
CSC461: Lecture 20 Parallel Projections in OpenGL
Projections and Normalization
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Models and Architectures
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
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Isaac Gang University of Mary Hardin-Baylor
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Projections and Hidden Surface Removal
Introduction to Computer Graphics with WebGL
Chap 3 Viewing Pipeline Reading:
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
University of New Mexico
Introduction to Computer Graphics with WebGL
Computer Graphics Computer Viewing
Computer Viewing Ed Angel Professor Emeritus of Computer Science
Implementation I Ed Angel Professor Emeritus of Computer Science
Introduction to Computer Graphics with WebGL
Viewing and Projection
Viewing and Projection
Presentation transcript:

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

Orthogonal Projection Matrices Ed Angel Professor Emeritus of Computer Science University of New Mexico Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Objectives Derive the projection matrices used for standard orthogonal projections Introduce oblique projections Introduce projection normalization Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Normalization Rather than derive a different projection matrix for each type of projection, we can convert all projections to orthogonal projections with the default view volume This strategy allows us to use standard transformations in the pipeline and makes for efficient clipping Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Pipeline View modelview transformation projection transformation perspective division 4D  3D nonsingular clipping projection 3D  2D against default cube Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Notes We stay in four-dimensional homogeneous coordinates through both the modelview and projection transformations Both these transformations are nonsingular Default to identity matrices (orthogonal view) Normalization lets us clip against simple cube regardless of type of projection Delay final projection until end Important for hidden-surface removal to retain depth information as long as possible Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Orthogonal Normalization ortho(left,right,bottom,top,near,far) normalization  find transformation to convert specified clipping volume to default Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Orthogonal Matrix Two steps Move center to origin T(-(left+right)/2, -(bottom+top)/2,(near+far)/2)) Scale to have sides of length 2 S(2/(left-right),2/(top-bottom),2/(near-far)) P = ST = Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Final Projection Set z =0 Equivalent to the homogeneous coordinate transformation Hence, general orthogonal projection in 4D is Morth = P = MorthST Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Oblique Projections The OpenGL projection functions cannot produce general parallel projections such as However if we look at the example of the cube it appears that the cube has been sheared Oblique Projection = Shear + Orthogonal Projection Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

General Shear top view side view Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Shear Matrix xy shear (z values unchanged) Projection matrix General case: H(q,f) = P = Morth H(q,f) P = Morth STH(q,f) Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Equivalency Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Effect on Clipping The projection matrix P = STH transforms the original clipping volume to the default clipping volume object top view z = 1 DOP DOP x = -1 x = 1 far plane z = -1 clipping volume near plane distorted object (projects correctly) Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015