Computer Graphics (fall 2009)

Slides:



Advertisements
Similar presentations
Computer Graphics - Viewing -
Advertisements

Three Dimensional Viewing
1 View Shandong University Software College Instructor: Zhou Yuanfeng
Three-Dimensional Viewing Sang Il Park Sejong University Lots of slides are stolen from Jehee Lee’s.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Projection Matrices modified by Ray Wisman Ed Angel Professor of Computer.
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
CS 352: Computer Graphics Chapter 5: Viewing. Interactive Computer GraphicsChapter Overview Specifying the viewpoint Specifying the projection Types.
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.
UBI 516 Advanced Computer Graphics Three Dimensional Viewing
Advanced Computer Graphics Three Dimensional Viewing
1 Projection Matrices. 2 Objectives Derive the projection matrices used for standard OpenGL projections Introduce oblique projections Introduce projection.
Computer Graphics I, Fall 2010 Classical Viewing.
CS559: Computer Graphics Lecture 9: Projection Li Zhang Spring 2008.
Viewing Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
1 E. Angel and D. Shreiner : Interactive Computer Graphics 6E © Addison-Wesley 2012 Classical Viewing Sai-Keung Wong ( 黃世強 ) Computer Science National.
Chapter 5 Viewing.
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.
Computer Graphics Bing-Yu Chen National Taiwan University.
Fundamentals of Computer Graphics Part 5 Viewing prof.ing.Václav Skala, CSc. University of West Bohemia Plzeň, Czech Republic ©2002 Prepared with Angel,E.:
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CAP 4703 Computer Graphic Methods Prof. Roy Levow Chapter 5.
Demetriou/Loizidou – ACSC330 – Chapter 5 Viewing Dr. Giorgos A. Demetriou Computer Science Frederick Institute of Technology.
Computer Graphics I, Fall 2010 Computer Viewing.
Viewing Chapter 5. CS 480/680 2Chapter 5 -- Viewing Introduction: Introduction: We have completed our discussion of the first half of the synthetic camera.
University of North Carolina at Greensboro
Graphics Graphics Korea University kucg.korea.ac.kr Viewing 고려대학교 컴퓨터 그래픽스 연구실.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Chapters 5 2 March Classical & Computer Viewing Same elements –objects –viewer –projectors –projection plane.
Three-Dimensional Viewing
Three-Dimensional Viewing Hearn & Baker Chapter 7
12/24/2015 A.Aruna/Assistant professor/IT/SNSCE 1.
©2005, Lee Iverson Lee Iverson UBC Dept. of ECE EECE 478 Viewing and Projection.
Graphics CSCI 343, Fall 2015 Lecture 16 Viewing I
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
Viewing and Projection. The topics Interior parameters Projection type Field of view Clipping Frustum… Exterior parameters Camera position Camera orientation.
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.
Viewing 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.
Viewing.
Computer Graphics - Chapter 5 Viewing
Computer Viewing.
Isaac Gang University of Mary Hardin-Baylor
CSC461: Lecture 20 Parallel Projections in OpenGL
Projections and Normalization
CSC461: Lecture 19 Computer Viewing
Introduction to Computer Graphics with WebGL
Fundamentals of Computer Graphics Part 5 Viewing
Three Dimensional Viewing
Isaac Gang University of Mary Hardin-Baylor
Projections and Hidden Surface Removal
Chap 3 Viewing Pipeline Reading:
Introduction to Computer Graphics with WebGL
Viewing (Projections)
University of New Mexico
Viewing (Projections)
Interactive Computer Graphics Viewing
Computer Graphics Computer Viewing
Computer Viewing Ed Angel Professor Emeritus of Computer Science
CS 352: Computer Graphics Chapter 5: Viewing.
Presentation transcript:

Computer Graphics (fall 2009) School of Computer Science University of Seoul

Chap 5: Viewing Classical and Computer Viewing Viewing with a Computer Positioning of the Camera Simple Projections Projections in OpenGL Hidden-Surface Removal Interactive Mesh Displays Parallel-Projection Matrices Perspective-Projection Matrices Projections and Shadows

5.1 Classical and Computer Viewing

Basic Elements Object Projector Projection Plane COP (Center of Projection) or DOP (Direction of Projection) Principal faces/directions

Classical Viewing Orthographic projections Axonometric projections Isometric, dimetric, trimetric Oblique projections Perspective projections One-, two-, three-point perspectives

1. Orthographic Projections Projectors perpendicular to the projection plane Multiview orthographic projection (image courtesy of http://img19.imageshack.us/i/importedpsk.jpg)

2. Axonometric Projections Projectors orthogonal to the projection plane Projection plane can have any orientation with respect to the object Isometric, dimetric, trimetric How many principal faces is the projection plane is placed symmetrically with respect to

3. Oblique Projections Most general parallel views Projector can have an arbitrary angle with the projection plane

4. Perspective Viewing To achieve real-looking images One-, two-, three-point perspectives Number of vanishing points How many of three principal directions in the object are parallel to the projection plane?

5.2 Viewing with a Camera

OpenGL Viewing All the classical viewing can be implemented  HOW??? (§5.9 & §5.10) Default camera Orthographic Projection plane: “z=0” At the origin pointing to –z-direction Up direction: +y-direction Viewing volume: cube with side 2  objects outside of this box cannot be rendered! (“clipping”) Objects behind the camera can be rendered! (only for orthogonal projections)

5.3 Positioning of the Camera

Positioning the Camera No separate “viewing” transformation  concatenated into model-view matrices Object coords.world coords.eye coords. What matters is the relative position of objects and the camera At any given time, the state of the model-view matrix encapsulates the relationship between the camera frame and the object frame

Positioning the Camera (cont’d) Separate matrices For model & viewing Model-view matrix (OpenGL) glMatrixMode(GL_MODEL); glMultMatrix(Mo); render_object(); glMatrixMode(GL_VIEW); glMultMatrix(Mc); glMatrixMode(GL_MODELVIEW); glMultMatrix(inv(Mc)); glMultMatrix(Mo); render_object();

Viewing-Coordinate System Defined by Position (VRP: view-reference point, p) Viewing direction (VPN: view-plane normal , n) Up direction (VUP: view-up vector, vup) Projected on the view plane (v) 3rd orthogonal direction (u) obtained by cross product View-orientation matrix derivation? (advanced) x, y, z axes  u, v, n gluLookAt Needs to be called before transforming objects Error in the book (p.251)

Other Viewing APIs Roll, pitch, yaw Elevation, azimuth, twist To specify the orientation Ex) flight simulation Elevation, azimuth, twist Direction from the viewer Ex) star in the sky

5.4 Simple Projections

Perspective Projections All projectors pass through the origin (x,y,z)(xp,yp,zp) Nonlinear, not affine, irreversible Perspective division required “Extended” homogeneous coordinates required  3D points = 4D lines (through the origin): (x,y,z,1)(x,y,z,z/d)=(xp,yp,zp,1) How does the matrix look like?

Orthogonal Projections No division required (x,y,z)(x,y,0)=(xp,yp,zp) How does the matrix look like?

5.5 Projections in OpenGL

Projections in OpenGL Parameters in eye coordinates Near/far clipping planes

Perspective Viewing in OpenGL glFrustum Need not be symmetric gluPerspective Symmetric Defined using fov (field of view)  error in the figure 5.28 of the textbook Calls glFrustum internally near & far parameters must be positive (image courtesy of the redbook)

Parallel Viewing in OpenGL glOrtho gluOrtho2D No sign restrictions on near & far parameters

5.6 Hidden-Surface Removal

Hidden-Surface Removal How to determine which object is closer than others? What happens without hidden-surface removal? Two classes Object space algorithm BSP (Binary Space Partitioning) tree  restriction? Image space algorithm Z-buffer algorithm  used in (most) interactive graphics system including OpenGL Complexity proportional to the resolution Small overhead More in Chap 7 Culling Back faces of closed objects not rendered Number of primitives reduced early

5.7 Interactive Mesh Displays

5.8 Parallel-Projection Matrices

Projection Normalization All projections are converted into orthogonal projections by first distorting the objects such that the orthogonal projection of the distorted objects is the same as the desired projection of the original objects. Simplifies clipping & hidden-surface removal (Chap 7)

Orthogonal-Projection Matrices Normalization (by OpenGL projection matrix) Converts the specified viewing volume to canonical view volume ([-1,1]x[-1,1]x[-1,1] cube) Translation followed by scaling Orthographic projection (x,y,z)  (x,y,0)

Oblique Projections We can either Define the 4x4 matrix directly or Implement by shear followed by orthographic projection (In practice, normalization is required in between)

5.9 Perspective-Projection Matrices

Simple Perspective Projection Frustum defined by x=±z, y=±z, z_max, z_min For the perspective-normalization matrix N, what converts the planes as follows? x=±z  x’’=±1 y=±z  y’’=±1 z=z_max  z’’=1 z=z_minz’’=-1

Perspective Projection Depth ordering preserved by perspective-projection matrix  hidden-surface removal works in the normalized volume General perspective projection Apply shear to convert the asymmetric frustum to a symmetric one Scale to the “simple” frustum

5.10 Projections and Shadows

Shadows A point is in shadow if it is not illuminated by any light source, or equivalently if a viewer at that point cannot see any light source. Shadow polygon

Rendering Shadow Render twice: object polygon and shadow polygon How to find the shadow polygon?  perspective projection (with light source as the camera) Works only for shadows on flat surface More on Chap 12