Describe the Orthographic and Perspective projections. How do we combine together transform matrices?
|
|
- Coral Hodge
- 5 years ago
- Views:
Transcription
1 Aims and objectives By the end of the lecture you will be able to Work with multiple transform matrices Describe the viewing process in OpenGL Design and build a camera control APIs Describe the Orthographic and Perspective projections 1 Composing Matrices Composing Transforms How do we combine together transform matrices? We can multiply two matrices together to get a new transform M = RT Composing Transforms Order matters The effect of transforming a matrix by M is: Mv = RTv = R(Tv) This is the same as doing T then doing R TR does R then doing T Note that this is the opposite order from how it is written 2 GL Transform Matrices Transform Matrices in OpenGL OpenGL keeps a current transform matrix This is multiplied with all vertices that are drawn call it C Transform Matrices in OpenGL You can all glloadidentity to set C to the identity matrix C = I 1
2 Transform Matrices in OpenGL When you call glscale, glrotate and gltranslate the current matrix is multiplied by a scale, rotation or translation matrix C = CR Transform Matrices in OpenGL g l. g l L o a d I d e n t i t y ( ) ; g l. g l T r a n s l a t e f ( 1 0 0, 0, 0 ) ; g l. g l R o t a t e f ( 4 5, 0, 1, 0 ) ; g l. g l S c a l e ( 1. 5, 1. 5, 1. 5 ) ; If T is a translate, R a rotate and S a scale this code does: C = ITRS NB the transforms are done in the opposite order from how they are written in the code Transform Matrices in OpenGL g l. g l T r a n s l a t e f ( 1 0 0, 0, 0 ) ; box ( ) ; g l. g l T r a n s l a t e f ( 2 0 0, 0, 0 ) ; box ( ) ; / / T1 / / T2 What does this code do? C = CT1 draw a box C = CT2 draw a box When the 2nd box is drawn, C = T1T2 Transform Matrices in OpenGL We want to be able to draw different objects in different positions This means creating a transform for one object and drawing it then getting rid of that transform before drawing the next object We use a method called glpushmatrix 2
3 Matrix Stack Matrices in OpenGL are stored as a stack A stack is like a stack of paper Matrix Stack 3
4 Matrices in OpenGL are stored as a stack A stack is like a stack of paper You can add things to the top of a stack (Push) Matrix Stack 4
5 Matrices in OpenGL are stored as a stack A stack is like a stack of paper Or remove them again from the top (Pop) Matrix Stack 5
6 Matrices in OpenGL are stored as a stack A stack is like a stack of paper Or remove them again from the top (Pop) Matrix Stack The last thing to be put on is the first to be taken off Last in, first out Matrix Stack When you add a matrix to the stack it is multiplied into the current matrix When remove it, it is removed from the current matrix 6
7 Matrix Stack Storing matrices as a stack means that the most recent transforms are the ones you remove first Generally what you want Global transforms that affect the whole scene are at the bottom Transforms that only affect a single object at the top PushMatrix and PopMatrix glpushmatrix() creates a new matrix and puts it on the top of the stack You can then do any transforms you like glpopmatrix() will then remove the matrix from the stack i.e. it will remove all the transforms you have done PushMatrix and PopMatrix g l. g l P u s h M a t r i x ( ) ; g l. g l T r a n s l a t e f ( 1 0 0, 0, 0 ) ; box ( ) ; g l. g l P o p M a t r i x ( ) ; g l. g l P u s h M a t r i x ( ) ; g l. g l T r a n s l a t e f ( 2 0 0, 0, 0 ) ; box ( ) ; g l. g l P o p M a t r i x ( ) ; / / T1 / / T2 For multiple objects: glpushmatrix() before drawing each object Do all the transforms for that object glpopmatrix() to get rid of the transforms before moving on to the next matrix 3 Coordinate System Transforms Coordinate Systems 7
8 The world in 3D geometry is defined by: The position of the origin The direction of x, y and z (called the axes) Together these are called a coordinate system Often it is convenient to use different coordinate system definitions in different situations Coordinate Systems 8
9 Objects are positioned relative to the cooridinate system Coordinate Systems 9
10 But we can define a separate coordinate system for an object This can be very useful for modelling an object e.g. the origin can be in the middle of a sphere e.g. The axes can run along the walls of a house Coordinate Systems 10
11 By transforming an object we are changing the coordinate system of an object relative to the world Translating the origin Rotating the axes Coordinate Systems 11
12 If you have lots of axes you will have lots of coordinate systems Coordinate Systems 12
13 Sometimes you want to share a coordinate system between objects If you have a sofa and a chair in your house you want to position them relative to the house not the world You can have a heirarchy of coordinate systems sofa and chair have a CS relative to the CS of the house which is relative to the world CS Coordinate Systems 13
14 If you rotate the coordinate system of the house, the furniture moves with it You don t have to move items individually 4 Viewing and Projection Aims and objectives By the end of the lecture you will be able to Work with multiple transform matrices Describe the viewing process in OpenGL Design and build a camera control APIs Describe the Orthographic and Perspective projections Viewing and Projection Up to now we have talked about creating an moving objects 14
15 But how do we draw them on screen A complex process Position a virtual camera Project the 3D object onto a flat screen Draw the individual polygons onto the pixels of the screen Will talk about the first two 5 Model, View and Projection Matrix Viewing Coordinate Systems Each object has its own coordinate system This is converted into a world coordinate system To view it we have to convert it into another coordinate system: The coordinate system of the camera This means that we are viewing everything relative to the camera Camera Coordinate System 15
16 Y Z X camera has its own coordinate system The The origin is at the position of the camera z points out of the camera y points up x points left (or sometimes right) Viewing Matrices You need 3 matrices to view an object The Modelling matrix positions an object relative to the world The Viewing matrix transforms it into the coordinates of the camera The Projection matrix projects it onto a flat screen OpenGL combines the first 2 into a single ModelView matrix 16
17 Viewing Matrices To change one of these matrices use the method gl.glmatrixmode gl.glmatrixmode(gl.gl_modelview) gl.glmatrixmode(gl.gl_projection) You can then use normal transform commands or the projection matrix commands I ll talk about later 6 Camera Control Camera control The point of all this is to be able to control the camera You put transforms into the ModelView matrix Traslations position the camera Rotations change where its pointing Camera control gl. glmatrixmode ( gl.gl_modelview ) ; g l. g l L o a d I d e n t i t y ( ) ; g l. g l T r a n s l a t e f ( 0. 0 f, 0. 0 f, f ) ; Move the camera back along the z axis This can work if you model everything at the origin Camera control gl. glmatrixmode ( gl.gl_modelview ) ; g l. g l L o a d I d e n t i t y ( ) ; g l. g l R o t a t e f ( c a m e r a R o t a t i o n. x, 1, 0, 0 ) ; g l. g l R o t a t e f ( c a m e r a R o t a t i o n. y, 0, 1, 0 ) ; g l. g l T r a n s l a t e f ( 0. 0 f, 0. 0 f, f ) ; Rotate the camera as well The camerarotation variable can be set by mouse rotation glulookat p g l. g l u. glulookat ( eyex, eyey, eyez, atx, aty, atz, upx, upy, upz ) ; A handy function that is part of the glu library (OpenGL utilities) Sets the camera position based on 3 vectors eye: the position of the camera at: where it is looking at up: the up direction 17
18 glulookat p g l. g l u. glulookat ( eyex, eyey, eyez, atx, aty, atz, upx, upy, upz ) ; glulookat gl. glmatrixmode ( gl.gl_modelview ) ; g l. g l L o a d I d e n t i t y ( ) ; p g l. g l u. glulookat ( 0, 0, 500, 200, 0, 0, 0, 1, 1 ) ; Put the camera at -500 z look at an object at 200 x you will normally use y as up Moving cameras glulookat is good for setting up a static camera most of the time we want to be able to move it around navigate based on user input glulookat can get complex use glulookat to set up a sensible starting point use transforms to move around 18
19 Model View Matrix The model view matrix includes both the position of the model and the camera Any transform in there can be interpreted as either 1. keeping world still and moving the camera 2. keeping the camera still and moving the world While 2 might sound strange it can often be easier to think about Transforms are hard to think about, any little bit helps Object viewing interface If you have an application about viewing an object a good interface is to be able to: Spin the camera around the object Zoom in and out Use 2 rotations to spin about x and y The transform by z to zoom gl. glmatrixmode ( gl.gl_modelview ) ; g l. g l L o a d I d e n t i t y ( ) ; p g l. g l u. glulookat ( 0. 0 f, 0. 0 f, 1.0f, 0. 0 f, 0. 0 f, 0. 0 f, 0. 0 f, 1. 0 f, 0. 0 f ) ; g l. g l T r a n s l a t e f ( 0. 0 f, 0. 0 f, zoom ) ; g l. g l R o t a t e f ( c a m e r a R o t a t i o n. x, 1, 0, 0 ) ; g l. g l R o t a t e f ( c a m e r a R o t a t i o n. y, 0, 1, 0 ) ; Object viewing interface We are keeping the camera still and rotating the world To do the opposite we reverse the order of the translation and rotations More like a first person camera First Person Camera For a proper first person shooter type camera we need to be able to: 1. Rotate the camera to change where you are looking 2. Move in the direction you are looking gl. glmatrixmode ( gl.gl_modelview ) ; g l. g l L o a d I d e n t i t y ( ) ; p g l. g l u. glulookat ( 0. 0 f, 0. 0 f, 1.0f, 0. 0 f, 0. 0 f, 0. 0 f, 0. 0 f, 1. 0 f, 0. 0 f ) ; g l. g l R o t a t e f ( c a m e r a R o t a t i o n. x, 1, 0, 0 ) ; g l. g l R o t a t e f ( c a m e r a R o t a t i o n. y, 0, 1, 0 ) ; g l. g l T r a n s l a t e f ( foward. x, f o r w a r d. y, f o r w a r d. z ) ; 19
20 First Person Camera We need to move in the current forward direction (based on camera rotation) Take the z-axis and rotate it by the current camera rotation GL doesn t have a method to translate by a matrix do it by hand based on the trigonometry equations (see the code for more details) Third Person Camera Move your avatar (character, vehicle) keep the camera behind the avatar and pointing at it no longer directly controlling the camera 7 Projection and clipping Projection We need to take a 3D scene and represent it as a 2D image This is a fundamental change of representation loses information Different ways of doing this with different mathematical representations Projection 20
21 Orthographic Projection Orthographic Projection Points are projected in a parallel line to the screen Preserves distances Useful for exact measurement and scientific work Not very realistic Perspective Projection 21
22 Perspective Projection Perspective Projection Models how points in the distance grow smaller lines are drawn from the obejct to the viewers eye Produces realistic images for normal viewing Perspective Projection 22
23 Clipping Projection onto 2D means that there is a lot of the scene that we don t see To make the process more efficient, we avoid drawing objects that won t get projected Called clipping (different from objects that are hidden behind other objects) Clipping 23
24 Clipping Clipping is controlled by 6 planes: near, far left, right top, bottom We can use these to define the parameters of our project glortho g l. g l O r t h o ( GLdouble l e f t, GLdouble r i g h t, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far ) ; Does orthonormal projection and clipping Creates a Projection Matrix (won t go into the details) Perspective Clipping 24
25 glfrustum g l. glfrustum ( GLdouble l e f t, GLdouble r i g h t, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far ) ; Does perspective projection and clipping Pretty much the same as glortho top, bottom, left and right are defined at the near clipping plane 25
Computer Viewing Computer Graphics I, Fall 2008
Computer Viewing 1 Objectives Introduce mathematics of projection Introduce OpenGL viewing functions Look at alternate viewing APIs 2 Computer Viewing Three aspects of viewing process All implemented in
More informationThe Viewing Pipeline adaptation of Paul Bunn & Kerryn Hugo s notes
The Viewing Pipeline adaptation of Paul Bunn & Kerryn Hugo s notes What is it? The viewing pipeline is the procession of operations that are applied to the OpenGL matrices, in order to create a 2D representation
More informationCS354 Computer Graphics Viewing and Modeling
Slide Credit: Donald S. Fussell CS354 Computer Graphics Viewing and Modeling Qixing Huang February 21th 2018 Computer Viewing There are three aspects of the viewing process, all of which are implemented
More informationSpring 2013, CS 112 Programming Assignment 2 Submission Due: April 26, 2013
Spring 2013, CS 112 Programming Assignment 2 Submission Due: April 26, 2013 PROJECT GOAL: Write a restricted OpenGL library. The goal of the project is to compute all the transformation matrices with your
More information3D Viewing. With acknowledge to: Ed Angel. Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico
3D Viewing With acknowledge to: Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico 1 Classical Viewing Viewing plane projectors Classical
More informationCIS 636 Interactive Computer Graphics CIS 736 Computer Graphics Spring 2011
CIS 636 Interactive Computer Graphics CIS 736 Computer Graphics Spring 2011 Lab 1a of 7 OpenGL Setup and Basics Fri 28 Jan 2011 Part 1a (#1 5) due: Thu 03 Feb 2011 (before midnight) The purpose of this
More informationViewing Transformation
CS38: Computer Graphics Viewing Transformation Sung-Eui Yoon ( 윤성의 ) Course URL: http://sglab.kaist.ac.kr/~sungeui/cg/ Class Objectives Know camera setup parameters Understand viewing and projection processes
More informationCOMP3421. Week 2 - Transformations in 2D and Vector Geometry Revision
COMP3421 Week 2 - Transformations in 2D and Vector Geometry Revision Exercise 1. Write code to draw (an approximation) of the surface of a circle at centre 0,0 with radius 1 using triangle fans. Transformation
More informationCSC Graphics Programming. Budditha Hettige Department of Statistics and Computer Science
CSC 307 1.0 Graphics Programming Department of Statistics and Computer Science Graphics Programming OpenGL 3D Drawing 2 3D Graphics Projections Getting 3D to 2D 3D scene 2D image 3 Projections Orthographic
More information1 Transformations. Chapter 1. Transformations. Department of Computer Science and Engineering 1-1
Transformations 1-1 Transformations are used within the entire viewing pipeline: Projection from world to view coordinate system View modifications: Panning Zooming Rotation 1-2 Transformations can also
More informationChapter 3 - Basic Mathematics for 3D Computer Graphics
Chapter 3 - Basic Mathematics for 3D Computer Graphics Three-Dimensional Geometric Transformations Affine Transformations and Homogeneous Coordinates OpenGL Matrix Logic Translation Add a vector t Geometrical
More informationCOMP3421. Introduction to 3D Graphics
COMP3421 Introduction to 3D Graphics 3D coodinates Moving to 3D is simply a matter of adding an extra dimension to our points and vectors: 3D coordinates 3D coordinate systems can be left or right handed.
More information7. 3D Viewing. Projection: why is projection necessary? CS Dept, Univ of Kentucky
7. 3D Viewing Projection: why is projection necessary? 1 7. 3D Viewing Projection: why is projection necessary? Because the display surface is 2D 2 7.1 Projections Perspective projection 3 7.1 Projections
More informationAdvanced Computer Graphics (CS & SE )
Advanced Computer Graphics (CS & SE 233.420) Topics Covered Picking Pipeline Viewing and Transformations Rendering Modes OpenGL can render in one of three modes selected by glrendermode(mode) GL_RENDER
More informationOverview. Viewing and perspectives. Planar Geometric Projections. Classical Viewing. Classical views Computer viewing Perspective normalization
Overview Viewing and perspectives Classical views Computer viewing Perspective normalization Classical Viewing Viewing requires three basic elements One or more objects A viewer with a projection surface
More informationCS380: Computer Graphics Viewing Transformation. Sung-Eui Yoon ( 윤성의 ) Course URL:
CS38: Computer Graphics Viewing Transformation Sung-Eui Yoon ( 윤성의 ) Course URL: http://sglab.kaist.ac.kr/~sungeui/cg/ Class Objectives Know camera setup parameters Understand viewing and projection processes
More informationGraphics and Visualization
International University Bremen Spring Semester 2006 Recap Representing graphic objects by homogenous points and vectors Using affine transforms to modify objects Using projections to display objects
More informationCOMP3421. Introduction to 3D Graphics
COMP3421 Introduction to 3D Graphics 3D coordinates Moving to 3D is simply a matter of adding an extra dimension to our points and vectors: 3D coordinates 3D coordinate systems can be left or right handed.
More informationCOMP3421. Introduction to 3D Graphics
COMP3421 Introduction to 3D Graphics 3D coodinates Moving to 3D is simply a matter of adding an extra dimension to our points and vectors: 3D coordinates 3D coordinate systems can be left or right handed.
More informationMORE OPENGL. Pramook Khungurn CS 4621, Fall 2011
MORE OPENGL Pramook Khungurn CS 4621, Fall 2011 SETTING UP THE CAMERA Recall: OpenGL Vertex Transformations Coordinates specified by glvertex are transformed. End result: window coordinates (in pixels)
More informationGeometry: Outline. Projections. Orthographic Perspective
Geometry: Cameras Outline Setting up the camera Projections Orthographic Perspective 1 Controlling the camera Default OpenGL camera: At (0, 0, 0) T in world coordinates looking in Z direction with up vector
More informationLecture 5: Viewing. CSE Computer Graphics (Fall 2010)
Lecture 5: Viewing CSE 40166 Computer Graphics (Fall 2010) Review: from 3D world to 2D pixels 1. Transformations are represented by matrix multiplication. o Modeling o Viewing o Projection 2. Clipping
More informationCOMP Computer Graphics and Image Processing. 5: Viewing 1: The camera. In part 1 of our study of Viewing, we ll look at ˆʹ U ˆ ʹ F ˆʹ S
COMP27112 Û ˆF Ŝ Computer Graphics and Image Processing ˆʹ U ˆ ʹ F C E 5: iewing 1: The camera ˆʹ S Toby.Howard@manchester.ac.uk 1 Introduction In part 1 of our study of iewing, we ll look at iewing in
More informationOverview of Projections: From a 3D world to a 2D screen.
Overview of Projections: From a 3D world to a 2D screen. Lecturer: Dr Dan Cornford d.cornford@aston.ac.uk http://wiki.aston.ac.uk/dancornford CS2150, Computer Graphics, Aston University, Birmingham, UK
More informationCS 4204 Computer Graphics
CS 4204 Computer Graphics 3D Viewing and Projection Yong Cao Virginia Tech Objective We will develop methods to camera through scenes. We will develop mathematical tools to handle perspective projection.
More informationCSE 690: GPGPU. Lecture 2: Understanding the Fabric - Intro to Graphics. Klaus Mueller Stony Brook University Computer Science Department
CSE 690: GPGPU Lecture 2: Understanding the Fabric - Intro to Graphics Klaus Mueller Stony Brook University Computer Science Department Klaus Mueller, Stony Brook 2005 1 Surface Graphics Objects are explicitely
More informationCOMP3421. Week 2 - Transformations in 2D and Vector Geometry Revision
COMP3421 Week 2 - Transformations in 2D and Vector Geometry Revision Exercise 1. Write code to draw (an approximation) of the surface of a circle at centre 0,0 with radius 1 using triangle fans. 2. At
More informationCOMS 4160: Problems on Transformations and OpenGL
COMS 410: Problems on Transformations and OpenGL Ravi Ramamoorthi 1. Write the homogeneous 4x4 matrices for the following transforms: Translate by +5 units in the X direction Rotate by 30 degrees about
More informationComputer Graphics. Chapter 10 Three-Dimensional Viewing
Computer Graphics Chapter 10 Three-Dimensional Viewing Chapter 10 Three-Dimensional Viewing Part I. Overview of 3D Viewing Concept 3D Viewing Pipeline vs. OpenGL Pipeline 3D Viewing-Coordinate Parameters
More informationThree-Dimensional Graphics III. Guoying Zhao 1 / 67
Computer Graphics Three-Dimensional Graphics III Guoying Zhao 1 / 67 Classical Viewing Guoying Zhao 2 / 67 Objectives Introduce the classical views Compare and contrast image formation by computer with
More informationComputer Graphics. Basic 3D Programming. Contents
Computer Graphics Basic 3D Programming September 21, 2005 Sun-Jeong Kim 1 http://www.hallym.ac.kr/~sunkim/teach/2005/cga Contents Cameras and objects Perspective projections Orthographic projections Viewing
More informationSurface Graphics. 200 polys 1,000 polys 15,000 polys. an empty foot. - a mesh of spline patches:
Surface Graphics Objects are explicitely defined by a surface or boundary representation (explicit inside vs outside) This boundary representation can be given by: - a mesh of polygons: 200 polys 1,000
More informationCITSTUDENTS.IN VIEWING. Computer Graphics and Visualization. Classical and computer viewing. Viewing with a computer. Positioning of the camera
UNIT - 6 7 hrs VIEWING Classical and computer viewing Viewing with a computer Positioning of the camera Simple projections Projections in OpenGL Hiddensurface removal Interactive mesh displays Parallelprojection
More informationDrawing in 3D (viewing, projection, and the rest of the pipeline)
Drawing in 3D (viewing, projection, and the rest of the pipeline) CS559 Spring 2016 Lecture 6 February 11, 2016 The first 4 Key Ideas 1. Work in convenient coordinate systems. Use transformations to get
More information3D Graphics for Game Programming (J. Han) Chapter II Vertex Processing
Chapter II Vertex Processing Rendering Pipeline Main stages in the pipeline The vertex processing stage operates on every input vertex stored in the vertex buffer and performs various operations such as
More informationFachhochschule Regensburg, Germany, February 15, 2017
s Operations Fachhochschule Regensburg, Germany, February 15, 2017 s Motivating Example s Operations To take a photograph of a scene: Set up your tripod and point camera at the scene (Viewing ) Position
More informationGetting Started. Overview (1): Getting Started (1): Getting Started (2): Getting Started (3): COSC 4431/5331 Computer Graphics.
Overview (1): Getting Started Setting up OpenGL/GLUT on Windows/Visual Studio COSC 4431/5331 Computer Graphics Thursday January 22, 2004 Overview Introduction Camera analogy Matrix operations and OpenGL
More informationTransforms 1 Christian Miller CS Fall 2011
Transforms 1 Christian Miller CS 354 - Fall 2011 Transformations What happens if you multiply a square matrix and a vector together? You get a different vector with the same number of coordinates These
More informationOpenGL Transformations
OpenGL Transformations R. J. Renka Department of Computer Science & Engineering University of North Texas 02/18/2014 Introduction The most essential aspect of OpenGL is the vertex pipeline described in
More informationTransformations. Rotation and Scaling
Transformations In OpenGL, transformation are performed in the opposite order they are called 4 3 2 1 translate(1., 1.,.); rotatez(45.); scale(2., 2.,.); DrawSquare(.,., 1.); 4 3 2 1 scale(2., 2.,.); rotatez(45.);
More informationComputer Viewing. Prof. George Wolberg Dept. of Computer Science City College of New York
Computer Viewing Prof. George Wolberg Dept. of Computer Science City College of New York Objectives Introduce the mathematics of projection Introduce OpenGL viewing functions Look at alternate viewing
More informationOpenGL: Open Graphics Library. Introduction to OpenGL Part II. How do I render a geometric primitive? What is OpenGL
OpenGL: Open Graphics Library Introduction to OpenGL Part II CS 351-50 Graphics API ( Application Programming Interface) Software library Layer between programmer and graphics hardware (and other software
More information2D and 3D Viewing Basics
CS10101001 2D and 3D Viewing Basics Junqiao Zhao 赵君峤 Department of Computer Science and Technology College of Electronics and Information Engineering Tongji University Viewing Analog to the physical viewing
More informationComputer Graphics Hands-on
Computer Graphics Hands-on Two-Dimensional OpenGL Transformations Objectives To get hands-on experience manipulating the OpenGL current transformation (MODELVIEW) matrix to achieve desired effects To gain
More informationDrawing in 3D (viewing, projection, and the rest of the pipeline)
Drawing in 3D (viewing, projection, and the rest of the pipeline) CS559 Spring 2017 Lecture 6 February 2, 2017 The first 4 Key Ideas 1. Work in convenient coordinate systems. Use transformations to get
More informationDrawing in 3D (viewing, projection, and the rest of the pipeline)
Drawing in 3D (viewing, projection, and the rest of the pipeline) CS559 Fall 2016 Lecture 6/7 September 26-28 2016 The first 4 Key Ideas 1. Work in convenient coordinate systems. Use transformations to
More informationViewing with Computers (OpenGL)
We can now return to three-dimension?', graphics from a computer perspective. Because viewing in computer graphics is based on the synthetic-camera model, we should be able to construct any of the classical
More informationProf. Feng Liu. Fall /19/2016
Prof. Feng Liu Fall 26 http://www.cs.pdx.edu/~fliu/courses/cs447/ /9/26 Last time More 2D Transformations Homogeneous Coordinates 3D Transformations The Viewing Pipeline 2 Today Perspective projection
More informationFundamental Types of Viewing
Viewings Fundamental Types of Viewing Perspective views finite COP (center of projection) Parallel views COP at infinity DOP (direction of projection) perspective view parallel view Classical Viewing Specific
More information// double buffering and RGB glutinitdisplaymode(glut_double GLUT_RGBA); // your own initializations
#include int main(int argc, char** argv) { glutinit(&argc, argv); Typical OpenGL/GLUT Main Program // GLUT, GLU, and OpenGL defs // program arguments // initialize glut and gl // double buffering
More informationCS4202: Test. 1. Write the letter corresponding to the library name next to the statement or statements that describe library.
CS4202: Test Name: 1. Write the letter corresponding to the library name next to the statement or statements that describe library. (4 points) A. GLUT contains routines that use lower level OpenGL commands
More information3D Viewing Episode 2
3D Viewing Episode 2 1 Positioning and Orienting the Camera Recall that our projection calculations, whether orthographic or frustum/perspective, were made with the camera at (0, 0, 0) looking down the
More informationMouse Ray Picking Explained
Mouse Ray Picking Explained Brian Hook http://www.bookofhook.com April 5, 2005 1 Introduction There comes a time in every 3D game where the user needs to click on something in the scene. Maybe he needs
More informationReading. Hierarchical Modeling. Symbols and instances. Required: Angel, sections , 9.8. Optional:
Reading Required: Angel, sections 9.1 9.6, 9.8 Optional: Hierarchical Modeling OpenGL rogramming Guide, the Red Book, chapter 3 cse457-07-hierarchical 1 cse457-07-hierarchical 2 Symbols and instances Most
More informationTransformations (Rotations with Quaternions) October 24, 2005
Computer Graphics Transformations (Rotations with Quaternions) October 4, 5 Virtual Trackball (/3) Using the mouse position to control rotation about two axes Supporting continuous rotations of objects
More informationComputer Graphics. Bing-Yu Chen National Taiwan University
Computer Graphics Bing-Yu Chen National Taiwan University Introduction to OpenGL General OpenGL Introduction An Example OpenGL Program Drawing with OpenGL Transformations Animation and Depth Buffering
More informationCSC 470 Computer Graphics
CSC 470 Computer Graphics Transformations of Objects CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 1 Transformations of objects - 2D CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 2 Using
More informationComputer Viewing. CITS3003 Graphics & Animation. E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley
Computer Viewing CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 1 Objectives Introduce the mathematics of projection Introduce OpenGL viewing
More informationIntroduction to OpenGL Transformations, Viewing and Lighting. Ali Bigdelou
Introduction to OpenGL Transformations, Viewing and Lighting Ali Bigdelou Modeling From Points to Polygonal Objects Vertices (points) are positioned in the virtual 3D scene Connect points to form polygons
More informationHierarchical Modeling. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell
Hierarchical Modeling University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell Reading Angel, sections 9.1-9.6 [reader pp. 169-185] OpenGL Programming Guide, chapter 3 Focus especially
More informationCS 591B Lecture 9: The OpenGL Rendering Pipeline
CS 591B Lecture 9: The OpenGL Rendering Pipeline 3D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination Spring 2007 Rui Wang 3D Polygon Rendering Many applications
More information3D Graphics Pipeline II Clipping. Instructor Stephen J. Guy
3D Graphics Pipeline II Clipping Instructor Stephen J. Guy 3D Rendering Pipeline (for direct illumination) 3D Geometric Primitives 3D Model Primitives Modeling Transformation 3D World Coordinates Lighting
More informationOutline. Introduction Surface of Revolution Hierarchical Modeling Blinn-Phong Shader Custom Shader(s)
Modeler Help Outline Introduction Surface of Revolution Hierarchical Modeling Blinn-Phong Shader Custom Shader(s) Objects in the Scene Controls of the object selected in the Scene. Currently the Scene
More information1 (Practice 1) Introduction to OpenGL
1 (Practice 1) Introduction to OpenGL This first practical is intended to get you used to OpenGL command. It is mostly a copy/paste work. Try to do it smartly by tweaking and messing around with parameters,
More informationModeling with Transformations
Modeling with Transformations Prerequisites This module requires some understanding of 3D geometry, particularly a sense of how objects can be moved around in 3-space. The student should also have some
More information蔡侑庭 (Yu-Ting Tsai) National Chiao Tung University, Taiwan. Prof. Wen-Chieh Lin s CG Slides OpenGL 2.1 Specification
蔡侑庭 (Yu-Ting Tsai) Department of Computer Science National Chiao Tung University, Taiwan Prof. Wen-Chieh Lin s CG Slides OpenGL 2.1 Specification OpenGL Programming Guide, Chap. 3 & Appendix F 2 OpenGL
More informationCSC 470 Computer Graphics. Three Dimensional Viewing
CSC 470 Computer Graphics Three Dimensional Viewing 1 Today s Lecture Three Dimensional Viewing Developing a Camera Fly through a scene Mathematics of Projections Producing Stereo Views 2 Introduction
More informationComputer Graphics. Chapter 7 2D Geometric Transformations
Computer Graphics Chapter 7 2D Geometric Transformations Chapter 7 Two-Dimensional Geometric Transformations Part III. OpenGL Functions for Two-Dimensional Geometric Transformations OpenGL Geometric Transformation
More informationE.Order of Operations
Appendix E E.Order of Operations This book describes all the performed between initial specification of vertices and final writing of fragments into the framebuffer. The chapters of this book are arranged
More informationPrecept 2 Aleksey Boyko February 18, 2011
Precept 2 Aleksey Boyko February 18, 2011 Getting started Initialization Drawing Transformations Cameras Animation Input Keyboard Mouse Joystick? Textures Lights Programmable pipeline elements (shaders)
More informationComputer Graphics. Transformations. CSC 470 Computer Graphics 1
Computer Graphics Transformations CSC 47 Computer Graphics 1 Today s Lecture Transformations How to: Rotate Scale and Translate 2 Introduction An important concept in computer graphics is Affine Transformations.
More informationOverview. By end of the week:
Overview By end of the week: - Know the basics of git - Make sure we can all compile and run a C++/ OpenGL program - Understand the OpenGL rendering pipeline - Understand how matrices are used for geometric
More informationCSC 470 Computer Graphics
CSC 47 Computer Graphics Three Dimensional Viewing Today s Lecture Three Dimensional Viewing Developing a Camera Fly through a scene Mathematics of Producing Stereo Views 1 2 Introduction We have already
More informationOne or more objects A viewer with a projection surface Projectors that go from the object(s) to the projection surface
Classical Viewing Viewing requires three basic elements One or more objects A viewer with a projection surface Projectors that go from the object(s) to the projection surface Classical views are based
More informationViewing COMPSCI 464. Image Credits: Encarta and
Viewing COMPSCI 464 Image Credits: Encarta and http://www.sackville.ednet.ns.ca/art/grade/drawing/perspective4.html Graphics Pipeline Graphics hardware employs a sequence of coordinate systems The location
More informationTransforms 3: Projection Christian Miller CS Fall 2011
Transforms 3: Projection Christian Miller CS 354 - Fall 2011 Eye coordinates Eye space is the coordinate system at the camera: x right, y up, z out (i.e. looking down -z) [RTR] The setup Once we ve applied
More informationClassical and Computer Viewing. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico
Classical and Computer Viewing Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico Planar Geometric Projections Standard projections project onto a plane Projectors
More informationUsing GLU/GLUT Objects
Using GLU/GLUT Objects GLU/GLUT provides very simple object primitives glutwirecone glutwirecube glucylinder glutwireteapot GLU/GLUT Objects Each glu/glut object has its default size, position, and orientation
More informationHIERARCHICAL TRANSFORMATIONS A Practical Introduction
HIERARCHICAL TRANSFORMATIONS A Practical Introduction HPCViz, KTH Royal Institute of Technology, Sweden https://www.kth.se/profile/chpeters/ Transformations Many objects are composed of hierarchies Transformations
More informationComputer Graphics 7: Viewing in 3-D
Computer Graphics 7: Viewing in 3-D In today s lecture we are going to have a look at: Transformations in 3-D How do transformations in 3-D work? Contents 3-D homogeneous coordinates and matrix based transformations
More informationAndroid and OpenGL. Android Smartphone Programming. Matthias Keil. University of Freiburg
Android and OpenGL Android Smartphone Programming Matthias Keil Institute for Computer Science Faculty of Engineering 1. Februar 2016 Outline 1 OpenGL Introduction 2 Displaying Graphics 3 Interaction 4
More informationWire-Frame 3D Graphics Accelerator IP Core. C Library Specification
Wire-Frame 3D Graphics Accelerator IP Core C Library Specification Kenji Ishimaru 1 / 29 Revision History Rev. Date Author Description 1.0 2015/09/30 Kenji Ishimaru First release
More informationProjection: Mapping 3-D to 2-D. Orthographic Projection. The Canonical Camera Configuration. Perspective Projection
Projection: Mapping 3-D to 2-D Our scene models are in 3-D space and images are 2-D so we need some wa of projecting 3-D to 2-D The fundamental approach: planar projection first, we define a plane in 3-D
More informationHIERARCHICAL TRANSFORMATIONS A Practical Introduction
HIERARCHICAL TRANSFORMATIONS A Practical Introduction Christopher Peters HPCViz, KTH Royal Institute of Technology, Sweden chpeters@kth.se https://www.kth.se/profile/chpeters/ Transformations Many objects
More informationTransformation Pipeline
Transformation Pipeline Local (Object) Space Modeling World Space Clip Space Projection Eye Space Viewing Perspective divide NDC space Normalized l d Device Coordinatesd Viewport mapping Screen space Coordinate
More informationGEOMETRIC TRANSFORMATIONS AND VIEWING
GEOMETRIC TRANSFORMATIONS AND VIEWING 2D and 3D 1/44 2D TRANSFORMATIONS HOMOGENIZED Transformation Scaling Rotation Translation Matrix s x s y cosθ sinθ sinθ cosθ 1 dx 1 dy These 3 transformations are
More informationTwo possible ways to specify transformations. Each part of the object is transformed independently relative to the origin
Transformations Two possible ways to specify transformations Each part of the object is transformed independently relative to the origin - Not convenient! z y Translate the base by (5,0,0); Translate the
More informationOrder of Transformations
Order of Transformations Because the same transformation is applied to many vertices, the cost of forming a matrix M=ABCD is not significant compared to the cost of computing Mp for many vertices p Note
More informationIntroduction to OpenGL
OpenGL is an alternative to Direct3D for 3D graphics rendering Originally developed by Silicon Graphics Inc (SGI), turned over to multi-vendor group (OpenGL Architecture Review Board) in 1992 Unlike DirectX,
More informationEvening s Goals. Mathematical Transformations. Discuss the mathematical transformations that are utilized for computer graphics
Evening s Goals Discuss the mathematical transformations that are utilized for computer graphics projection viewing modeling Describe aspect ratio and its importance Provide a motivation for homogenous
More information3D Viewing. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller
3D Viewing CMPT 361 Introduction to Computer Graphics Torsten Möller Reading Chapter 4 of Angel Chapter 6 of Foley, van Dam, 2 Objectives What kind of camera we use? (pinhole) What projections make sense
More informationAnnouncements. Submitting Programs Upload source and executable(s) (Windows or Mac) to digital dropbox on Blackboard
Now Playing: Vertex Processing: Viewing Coulibaly Amadou & Mariam from Dimanche a Bamako Released August 2, 2005 Rick Skarbez, Instructor COMP 575 September 27, 2007 Announcements Programming Assignment
More informationNotes on Assignment. Notes on Assignment. Notes on Assignment. Notes on Assignment
Notes on Assignment Notes on Assignment Objects on screen - made of primitives Primitives are points, lines, polygons - watch vertex ordering The main object you need is a box When the MODELVIEW matrix
More informationIntroduction to Computer Graphics 4. Viewing in 3D
Introduction to Computer Graphics 4. Viewing in 3D National Chiao Tung Univ, Taiwan By: I-Chen Lin, Assistant Professor Textbook: E.Angel, Interactive Computer Graphics, 5 th Ed., Addison Wesley Ref: Hearn
More informationAffine Transformations in 3D
Affine Transformations in 3D 1 Affine Transformations in 3D 1 Affine Transformations in 3D General form 2 Translation Elementary 3D Affine Transformations 3 Scaling Around the Origin 4 Along x-axis Shear
More informationAPI for creating a display window and using keyboard/mouse interations. See RayWindow.cpp to see how these are used for Assignment3
OpenGL Introduction Introduction OpenGL OpenGL is an API for computer graphics. Hardware-independent Windowing or getting input is not included in the API Low-level Only knows about triangles (kind of,
More informationLecture 4. Viewing, Projection and Viewport Transformations
Notes on Assignment Notes on Assignment Hw2 is dependent on hw1 so hw1 and hw2 will be graded together i.e. You have time to finish both by next monday 11:59p Email list issues - please cc: elif@cs.nyu.edu
More informationCS 4204 Computer Graphics
CS 424 Computer Graphics 2D Transformations Yong Cao Virginia Tech References: Introduction to Computer Graphics course notes by Doug Bowman Interactive Computer Graphics, Fourth Edition, Ed Angle Transformations
More informationLecture 4 Advanced Computer Graphics (CS & SE )
Lecture 4 Advanced Computer Graphics (CS & SE 233.420) Topics Covered Animation Matrices Viewing Lighting Animating Interactive Programs Consider planet.c Want to animate rotating the Earth around the
More information12. Selection. - The objects selected are specified by hit records in the selection buffer. E.R. Bachmann & P.L. McDowell MV 4202 Page 1 of 13
12. Selection Picking is a method of capturing mouse clicks at some window position and determining what objects are beneath it. The basic idea is to enter the selection rendering mode with a small viewing
More information