CAP 4703 Computer Graphic Methods Prof. Roy Levow Chapter 5.

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.
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.
Classical Viewing CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
1 Chapter 5 Viewing. 2 Perspective Projection 3 Parallel Projection.
Modeling and Viewing Modeling
Projection Projection - the transformation of points from a coordinate system in n dimensions to a coordinate system in m dimensions where m
Introduction to 3D viewing 3D is just like taking a photograph!
Computer Graphics (fall 2009)
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.
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.
1 Classical Viewing. 2 Objectives Introduce the classical views Compare and contrast image formation by computer with how images have been formed by architects,
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.:
Demetriou/Loizidou – ACSC330 – Chapter 5 Viewing Dr. Giorgos A. Demetriou Computer Science Frederick Institute of Technology.
Computer Graphics I, Fall 2010 Computer Viewing.
Viewing and Projection. 2 3 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009  Introduce the classical views  Compare and contrast image.
OpenGL The Viewing Pipeline: Definition: a series of operations that are applied to the OpenGL matrices, in order to create a 2D representation from 3D.
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.
Viewing Chapter 5. CS 480/680Chapter 5 -- Viewing2 n Introduction: -We have completed our discussion of the first half of the synthetic camera model specifying.
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.
Taxonomy of Projections FVFHP Figure Taxonomy of Projections.
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.
OpenGL LAB III.
Viewing. Classical Viewing Viewing requires three basic elements - One or more objects - A viewer with a projection surface - Projectors that go from.
CS 490: Computer Graphics Chapter 5: Viewing. Interactive Computer GraphicsChapter Overview Specifying the viewpoint Specifying the projection Types.
Viewing 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.
Viewing.
Computer Graphics - Chapter 5 Viewing
Computer Viewing.
Projection Our 3-D scenes are all specified in 3-D world coordinates
Isaac Gang University of Mary Hardin-Baylor
CSC461: Lecture 20 Parallel Projections in OpenGL
CSC461: Lecture 19 Computer Viewing
Classical Viewing Ed Angel
Viewing Chapter 5.
Fundamentals of Computer Graphics Part 5 Viewing
Three Dimensional Viewing
Viewing (Projections)
University of New Mexico
Viewing (Projections)
Interactive Computer Graphics Viewing
Isaac Gang University of Mary Hardin-Baylor
CS 352: Computer Graphics Chapter 5: Viewing.
Presentation transcript:

CAP 4703 Computer Graphic Methods Prof. Roy Levow Chapter 5

Viewing  Classical viewing –Need to be able to reproduce classical views for a variety of applications –Isometric  Preserves measurements –Elevation  View a face of object –Perspective  Reflects size change of distant objects

Viewing Terminology  Center of Projection (COP) –Point where all projectors meet –Center of camera or eye lens –Origin of synthetic camera frame  Direction of Projection (DOP) –Direction of projectors when COP is moved to infinity

Types of Viewing  Classical (many) –Orthographic –One-, two-, and 3-point perspectives  Computer –Orthographic –Perspective

Classical Viewing Concepts  Principal face –Primary surface of view  Based on rectangular solid structures  Orthographic Projection –Single view –Multiview  Show three orthogonal views

Axonometric Projections  Projectors are orthogonal to the projection plane but plane can be at angle to principal face –Isometric – symmetric with all three axes –Dimetric – symmetric with two axes –Trimetric – general case –Produces foreshortening of distances

Oblique Projection  Most general parallel view –Projectors make arbitrary angle with projection plane  In computer graphics system, isometric, axonometric and oblique projections are all variations on one case

Perspective  Characterized by diminution of size of more distant objects  Classically, viewer is symmetrical with respect to the projection plane  One-, two-, and three-point perspectives depending on number of vanishing points

Computer Viewing  Choose parallel or perspective view  No separation of perspective degrees  Two key elements –Position camera –Apply projection transformaton

OpenGL Camera  Default –Camera at origin –Pointing in negative z direction –Orthogonal view –Viewing volume is cube  Centered at origin  Side of length 2

Default Camera

Positioning Camera Frame  Can construct camera frame through translation and rotation of model view to get camera to desired viewing position from default position  For orthographic view, this does not change clipping volume set by glOrtho() –Size is unchanged –What is seen will change

View as Change of Frames  Set View-Reference Point (VRP) –Center of camera  View plane defined by –View-plane normal (VPN) –View-up vector (VUP) –Project VUP onto projection plane to get up direction (v up )  Construct new frame with basis for view plane, u-v and normal n; u-v-n

Look-At Positioning

OpenGL Look-At  OpenGL simplifies camera positioning as follows – e = eye point – a = look-at point –Determines vpn as e – a glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glLoadIdentity(); gluLookAt(eyex, eyey, eyez, gluLookAt(eyex, eyey, eyez, atx, aty, atz, upx, upy, upz); /* define objects here */

Perspective Projection  Note: x/z = x p /d or x p = x/(z/d) –Similarly for y –Provides non-uniform foreshortening  Perspective Transformation –(x, y, z) -> (x p, y p, z p )

Perspective Projection (cont)  Moving to 4 dimensions, consider (wx, wy, wz, w) T  Perspective transformation matrix takes (x, y, z, 1) T to 0 0 1/d 0(x, y, z, z/d) T  Division by last coordinate gives (x p, y p, d, 1), the projection (x p, y p, d, 1), the projection

Orthogonal Projection in OpenGL  Simply map z into zero

Projection in OpenGL  Clipping region is a frustum, a truncated pyramid

OpenGL Frustum  glFrustum(xmin, xmax, ymin, ymax, near, far); // left, right, top, bottom, near, far

Parallel Viewing in OpenGL  glOrtho(xmin, xmax, ymin, ymax, near, far);

Hidden Surface Removal  Remove hidden surfaces  Different view –Visible-surface algoritims  Identify visible surfaces  Work in either –Object space –Image space

Z-Buffer Algorithm  Image Space  Requires depth buffer, called z-buffer to store depth  Depth resolution usually 16, 24, or 32 bits  As polygon is rasterized, depth is computed and compared with current z- buffer value; only nearer values update  Very efficient

OpenGL Implementation  Enable with –glutInitDisplayMode(GLUT_DEPTH…); –glEnabel(GL_DEPTH_TEST);  Clear with –glClear(GL_DEPTH_BUFFER_BIT);

Scene Walkthrough  Move camera to view color cube from different locations –cubeview.c

Parallel-Projection Matrices  Previous projection matrices do not cover all possibilities  Projection Normalization –convert all projections to orthogonal –by distorting objects –distortion is called normalization  Map viewing volume into 2x2x2 cube at origin; translate and then scale

Oblique Projection  Projectors do not need to be orthogonal to projection plane as in standard OpenGL projection  Equivalent to a shear transformation of the objects

Perspective-Projection Matrices  Again, distort object  Skipping details  OpenGL Perspective Transformations 2z/(X-x) 0 (X+x)/(X-x) 0 0 2z/(Y-y) (Y+y)/(Y-y) 0 0 2z/(Y-y) (Y+y)/(Y-y) (f+n)/(f-n) -2fn/(f-n) 0 0 -(f+n)/(f-n) -2fn/(f-n)

Projections and Shadows  Shadow –projection of original polygon onto surface –center of projection is light source –shadow-polygon –shadow.c