1 91.427 Computer Graphics I, Fall 2010 Computer Viewing.

Slides:



Advertisements
Similar presentations
Computer Graphics - Viewing -
Advertisements

1 View Shandong University Software College Instructor: Zhou Yuanfeng
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
OpenGL and Projections
OpenGL (II). How to Draw a 3-D object on Screen?
CS 4731: Computer Graphics Lecture 11: 3D Viewing Emmanuel Agu.
1 Chapter 5 Viewing. 2 Perspective Projection 3 Parallel Projection.
Computer Graphics (fall 2009)
1 Projection Matrices. 2 Objectives Derive the projection matrices used for standard OpenGL projections Introduce oblique projections Introduce projection.
Geometric transformations The Pipeline
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.
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.
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.
Viewing and Projection. 2 3 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009  Introduce the classical views  Compare and contrast image.
Viewing CS418 Computer Graphics John C. Hart. Graphics Pipeline Homogeneous Divide Model Coords Model Xform World Coords Viewing Xform Still Clip Coords.
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.
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.
The Camera Analogy ► Set up your tripod and point the camera at the scene (viewing transformation) ► Arrange the scene to be photographed into the desired.
©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.
Chap 3 Viewing and Transformation
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.
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.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Viewing 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.
Viewing.
Viewing and Navigating using OpenGL
Computer Viewing.
Isaac Gang University of Mary Hardin-Baylor
CSC461: Lecture 20 Parallel Projections in OpenGL
Projections and Normalization
Introduction to Computer Graphics with WebGL
Advanced Graphics Algorithms Ying Zhu Georgia State University
CSC461: Lecture 19 Computer Viewing
Introduction to Computer Graphics with WebGL
Viewing Chapter 5.
Fundamentals of Computer Graphics Part 5 Viewing
Viewing and Navigating using OpenGL
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University View & Projection.
Isaac Gang University of Mary Hardin-Baylor
Introduction to Computer Graphics with WebGL
Projections and Hidden Surface Removal
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
University of New Mexico
Computer Graphics Computer Viewing
THREE-DIMENSIONAL VIEWING II
Computer Viewing Ed Angel Professor Emeritus of Computer Science
Viewing and Projection
Viewing and Projection
Presentation transcript:

Computer Graphics I, Fall 2010 Computer Viewing

Computer Graphics I, Fall 2010 Objectives Introduce mathematics of projection Introduce OpenGL viewing functions Look at alternate viewing APIs

Computer Graphics I, Fall 2010 Computer Viewing Three aspects of viewing process All implemented in pipeline ­Position camera Set model-view matrix ­Select lens Set projection matrix ­Clip Set view volume

Computer Graphics I, Fall 2010 The OpenGL Camera In OpenGL, initially object and camera frames same ­Default model-view matrix = identity Camera located at origin points in negative z direction OpenGL also specifies default view volume cube with sides of length 2 centered at origin ­Default projection matrix = identity

Computer Graphics I, Fall 2010 Default Projection Default projection is orthogonal clipped out z = 0 2

Computer Graphics I, Fall 2010 Moving the Camera Frame If want to visualize object with both positive and negative z values can either ­Move camera in positive z direction Translate camera frame ­Move objects in negative z direction Translate world frame Both views equivalent and determined by model-view matrix ­Want translation ( glTranslatef(0.0,0.0,-d); ) ­d > 0

Computer Graphics I, Fall 2010 Moving Camera back from Origin default frames frames after translation by –d d > 0

Computer Graphics I, Fall 2010 Moving the Camera Can move camera to any desired position by sequence of Rs and Ts Example: side view ­Rotate camera ­Move it away from origin ­Model-view matrix C = TR

Computer Graphics I, Fall 2010 OpenGL code Remember that last transformation specified is first to be applied glMatrixMode(GL_MODELVIEW) glLoadIdentity(); glTranslatef(0.0, 0.0, -d); glRotatef(90.0, 0.0, 1.0, 0.0);

Computer Graphics I, Fall 2010 The LookAt Function GLU library contains function gluLookAt form required modelview matrix through simple interface Note: need to set an up direction Still need to initialize ­Can concatenate with modeling transformations Example: isometric view of cube aligned w/ axes glMatrixMode(GL_MODELVIEW): glLoadIdentity(); gluLookAt(1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, ); eye at up

Computer Graphics I, Fall 2010 glLookAt glLookAt(eyex, eyey, eyez, atx, aty, atz, upx, upy, upz)

Computer Graphics I, Fall 2010 Other Viewing APIs LookAt function only one possible API for positioning camera Others include ­View reference point, view plane normal, view up (PHIGS, GKS-3D) ­Yaw, pitch, roll ­Elevation, azimuth, twist ­Direction angles

Computer Graphics I, Fall 2010 Projections and Normalization Default projection in eye (camera) frame orthogonal For points within default view volume Most graphics systems use view normalization ­All other views converted to default view by transformations that determine projection matrix ­Allows use of same pipeline for all views x p = x y p = y z p = 0

Computer Graphics I, Fall 2010 Homogeneous Coordinate Representation x p = x y p = y z p = 0 w p = 1 p p = Mp M = In practice, can let M = I and set z term to zero later default orthographic projection

Computer Graphics I, Fall 2010 Simple Perspective Center of projection at origin Projection plane z = d, d < 0

Computer Graphics I, Fall 2010 Perspective Equations Consider top and side views x p =y p = z p = d

Computer Graphics I, Fall 2010 Homogeneous Coordinate Form M = consider q = Mp where q =  p =

Computer Graphics I, Fall 2010 Perspective Division However w  1, so must divide by w to return from homogeneous coordinates perspective division ==> desired perspective equations Will consider corresponding clipping volume with OpenGL functions x p =y p = z p = d

Computer Graphics I, Fall 2010 OpenGL Orthogonal Viewing glOrtho(left,right,bottom,top,near,far) near and far measured from camera

Computer Graphics I, Fall 2010 OpenGL Perspective glFrustum(left,right,bottom,top,near,far)

Computer Graphics I, Fall 2010 Using Field of View With glFrustum often difficult to get desired view gluPerpective(fovy, aspect, near, far) often provides better interface aspect = w/h front plane