CSC461: Lecture 19 Computer Viewing

Slides:



Advertisements
Similar presentations
Computer Graphics - Viewing -
Advertisements

Defining the Viewing Coordinate System
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.
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,
CS 352: Computer Graphics Chapter 5: Viewing. Interactive Computer GraphicsChapter Overview Specifying the viewpoint Specifying the projection Types.
1 Chapter 5 Viewing. 2 Perspective Projection 3 Parallel Projection.
Introduction to 3D viewing 3D is just like taking a photograph!
CS 480/680 Computer Graphics Representation Dr. Frederick C Harris, Jr. Fall 2012.
Computer Graphics (fall 2009)
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 CS418 Computer Graphics John C. Hart. Graphics Pipeline Homogeneous Divide Model Coords Model Xform World Coords Viewing Xform Still Clip Coords.
Viewing Chapter 5. CS 480/680 2Chapter 5 -- Viewing Introduction: Introduction: We have completed our discussion of the first half of the synthetic camera.
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.
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.
1 Representation. 2 Objectives Introduce concepts such as dimension and basis Introduce coordinate systems for representing vectors spaces and frames.
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
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.
3D Viewing and Clipping Ming Ouhyoung 歐陽明 Professor Dept. of CSIE and GINM NTU.
Objectives Introduce standard transformations Introduce standard transformations Derive homogeneous coordinate transformation matrices Derive homogeneous.
Viewing 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.
Chapter 11 Three-Dimensional Geometric and Modeling Transformations
Three Dimensional Viewing
Viewing.
Coordinate Change.
Computer Viewing.
Isaac Gang University of Mary Hardin-Baylor
CSCE 441 Computer Graphics 3-D Viewing
CSC461: Lecture 20 Parallel Projections in OpenGL
Projections and Normalization
Introduction to Computer Graphics with WebGL
Viewing Chapter 5.
Fundamentals of Computer Graphics Part 5 Viewing
Three Dimensional Viewing
Introduction to Computer Graphics with WebGL
Projections and Hidden Surface Removal
Chap 3 Viewing Pipeline Reading:
Introduction to Computer Graphics with WebGL
University of New Mexico
Viewing (Projections)
Computer Graphics Computer Viewing
THREE-DIMENSIONAL VIEWING II
Computer Viewing Ed Angel Professor Emeritus of Computer Science
Viewing and Projection
CS 352: Computer Graphics Chapter 5: Viewing.
Viewing and Projection
Presentation transcript:

CSC461: Lecture 19 Computer Viewing Objectives Introduce computer views and positioning camera Look at alternate viewing APIs Introduce the mathematics of projection

Computer Viewing There are three aspects of the viewing process, all of which are implemented in the pipeline, Positioning the camera Setting the model-view matrix Selecting a lens Setting the projection matrix Clipping Setting the view volume

The OpenGL Camera In OpenGL, initially the world and camera frames are the same Default model-view matrix is an identity The camera is located at origin and points in the negative z direction OpenGL also specifies a default view volume that is a cube with sides of length 2 centered at the origin Default projection matrix is an identity

Default Projection Default projection is orthogonal clipped out 2 z=0

Moving the Camera Frame If we want to visualize object with both positive and negative z values we can either Move the camera in the positive z direction Translate the camera frame Move the objects in the negative z direction Translate the world frame Both of these views are equivalent and are determined by the model-view matrix A translation: glTranslatef(0.0,0.0,-d); d > 0

Moving Camera back from Origin default frames frames after translation by –d d > 0

Moving the Camera We can move the camera to any desired position by a sequence of rotations and translations Example: side view Rotate the camera Move it away from origin Model-view matrix Concatenation of rotation and translation: C = TR OpenGL code: last transformation specified is first applied glMatrixMode(GL_MODELVIEW) glLoadIdentity(); glTranslatef(0.0, 0.0, -d); glRotatef(90.0, 0.0, 1.0, 0.0);

Camera Positioning Where the camera is How the camera is oriented View-reference point (VRP) in the world system How the camera is oriented View-plane normal (VPN): specifying the orientation of the projection plan View-up vector (VUP): specifying the up direction With VRP, VPN and VUP, can build a frame The origin: VRP Three independent vectors: VPN, VUP, and VRN×VUP

The LookAt Function Syntax: glLookAt( The function glLookAt to form the required model-view matrix through a simple interface Syntax: glLookAt( eyex,eyey,eyez, atx,aty,atz, upx,upy,upz) VRP = eye, VPN = at-eye, VUP=up Example: isometric view of cube aligned with axes glMatrixMode(GL_MODELVIEW): glLoadIdentity(); gluLookAt(1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0)

Constructing LookAt View Create an isometric view of the cube Start with default setting Transformations Rotate about the y-axis -45 degrees Rotate about the x-axis 35.26 degrees Translate along the z-axis by the distance d Result: C = T(0,0,-d)Rx(35.26)Ry(-45) Equivalent to gluLookAt(1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0)

Other Viewing APIs The LookAt function is only one possible API for positioning the camera in OpenGL Others include – not provided by OpenGL View reference point, view plane normal, view up (PHIGS, GKS-3D) Yaw, pitch, roll – flight simulation Elevation, azimuth, twist – rotation about other objects instead of points Direction angles All these viewing can be constructed by specifying concatenation of translation and rotations

Orthogonal Projections The default projection in the eye (camera) frame is orthogonal A special case of parallel projections in which the projectors are perpendicular to the view plane For points within the default view volume xp = x, yp = y, zp = 0

Homogeneous Coordinate Representation pp = Mp xp = x yp = y zp = 0 wp = 1 M = In practice, we can let M = I and set the z term to zero later Normalization Most graphics systems use view normalization All other views are converted to the default view by transformations that determine the projection matrix Allows use of the same pipeline for all views

Simple Perspective Projection Center of projection at the origin All projectors pass through the origin Simple projection: Projection plane z = d, d < 0 General projection: Projection plane can have any orientation w.r.t. the front

Simple Perspective Equations Consider top and side views xp = yp = zp = d

Characteristics Nonlinear equations Non-uniform foreshortening: the images of objects from the COP are reduced in size compared to the images of objects closer to the COP Can be considered as a transformation of from (x, y, z) to (xp, yp, zp) Preserves lines but not affine Irreversible: because all points along a projector project into the same point

Homogeneous Coordinate Form Consider q = Mp where M transforms p to q M = p =  q = Represent points (x, y, z) as (wx, wy, wz, w), w≠0 The difference is the coefficient w When w=1, homogeneous coordinates Can represent a broader class of transformations

Perspective Division However w  1, so we must divide by w to return to homogeneous coordinates This perspective division yields the desired perspective equations d/z is the foreshortening factor We will consider the corresponding clipping volume with the OpenGL functions xp = yp = zp = d

Projection Pipeline Set the model-view matrix Apply the projection matrix Perform a perspective division