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.

Slides:



Advertisements
Similar presentations
Computer Graphics - Viewing -
Advertisements

MAT 594CM S2010Fundamentals of Spatial ComputingAngus Forbes Overview Goals of the course: 1. to introduce real-time 3D graphics programming with openGL.
1 Computer Graphics Chapter 8 3D Transformations.
The View Frustum and the Camera Lecture 19 Fri, Oct 10, 2003.
Computer Graphics using OpenGL, 3 rd Edition F. S. Hill, Jr. and S. Kelley Chapter 3 Additional Drawing Tools Ureerat Suksawatchon Department of Computer.
Based on slides created by Edward Angel
Viewing and Transformation
Viewing and Projections
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.
4.1si31_2001 SI31 Advanced Computer Graphics AGR Lecture 4 Projection Clipping Viewport Transformation.
OpenGL (II). How to Draw a 3-D object on Screen?
CS 4731: Computer Graphics Lecture 11: 3D Viewing Emmanuel Agu.
CHAPTER 7 Viewing and Transformations © 2008 Cengage Learning EMEA.
Introduction to 3D viewing 3D is just like taking a photograph!
12.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 12 – 3D Graphics Transformation Pipeline: Projection and Clipping.
Viewing and Projections
UniS CS297 Graphics with Java and OpenGL Viewing, the model view matrix.
UBI 516 Advanced Computer Graphics Three Dimensional Viewing
Advanced Computer Graphics Three Dimensional Viewing
Computer Graphics, KKU. Lecture 131 Transformation and Viewing in OpenGL.
The Viewing Pipeline (Chapter 4) 5/26/ Overview OpenGL viewing pipeline: OpenGL viewing pipeline: – Modelview matrix – Projection matrix Parallel.
Week 2 - Wednesday CS361.
Computer Graphics World, View and Projection Matrices CO2409 Computer Graphics Week 8.
Image Synthesis Rabie A. Ramadan, PhD 2. 2 Java OpenGL Using JOGL: Using JOGL: Wiki: You can download JOGL from.
Geometric transformations The Pipeline
CS559: Computer Graphics Lecture 9: Projection Li Zhang Spring 2008.
Viewing Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
CAP 4703 Computer Graphic Methods Prof. Roy Levow Chapter 5.
CAP4730: Computational Structures in Computer Graphics 3D Transformations.
Computer Graphics Bing-Yu Chen National Taiwan University.
Computer Graphics I, Fall 2010 Computer Viewing.
CS 450: COMPUTER GRAPHICS PROJECTIONS SPRING 2015 DR. MICHAEL J. REALE.
OpenGL Viewing and Modeling Transformation Geb Thomas Adapted from the OpenGL Programming Guidethe OpenGL Programming Guide.
Basic Perspective Projection Watt Section 5.2, some typos Define a focal distance, d, and shift the origin to be at that distance (note d is negative)
Viewing and Transformation. Pixel pipeline Vertex pipeline Course Map Transformation & Lighting Primitive assembly Viewport culling & clipping Texture.
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.
Chapters 5 2 March Classical & Computer Viewing Same elements –objects –viewer –projectors –projection plane.
CGGM Lab. Tan-Chi Ho 2001 Viewing and Transformation.
Three-Dimensional Viewing Hearn & Baker Chapter 7
Projections. Viewports Windows can have separate viewports void glViewport(GLint x, GLint y, GLsizei width, GLsizei height ) x, y - Specify the lower.
12/24/2015 A.Aruna/Assistant professor/IT/SNSCE 1.
©2005, Lee Iverson Lee Iverson UBC Dept. of ECE EECE 478 Viewing and Projection.
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.
Chap 3 Viewing and Transformation
A Photograph of two papers
Viewing and Projection
Coordinate Systems Lecture 1 Fri, Sep 2, The Coordinate Systems The points we create are transformed through a series of coordinate systems before.
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
Viewing and Projection. The topics Interior parameters Projection type Field of view Clipping Frustum… Exterior parameters Camera position Camera orientation.
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.
CS 490: Computer Graphics Chapter 5: Viewing. Interactive Computer GraphicsChapter Overview Specifying the viewpoint Specifying the projection Types.
A Photograph of two papers The Model: 2 papers – 8cm x 8cm and 5cm x 5cm The Camera – Simple pinhole – No focusing capability The Scene – Arrangements.
Three Dimensional Viewing
Viewing.
Computer Viewing.
Courtesy of Drs. Carol O’Sullivan / Yann Morvan Trinity College Dublin
CSCE 441 Computer Graphics 3-D Viewing
A Photograph of two papers
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University View & Projection.
Last Time Canonical view pipeline Projection Local Coordinate Space
Type of View Perspective View COP(Center of Plane) Diminution of size
Computer Graphics 3Practical Lesson
Chapter 3 Viewing.
Presentation transcript:

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 geometry. Processes can be broken up into four main areas: 1.The movement of the object is called a modeling transformation. 2.The movement of the camera is called a viewing transformation. 3.The conversion from 3D to 2D is called a projection transformation. 4.The 2D picture plane, which is mapped to the screen viewport, called a viewport transformation.

The Camera Analogy Modeling: position model Viewing: position camera position viewing volume Projection: choose lens choose vv shape Viewport: choose photo size choose portion of screen CameraOpenGL

Viewing Pipeline & OpenGL Can also be thought of as a production line. Matrix operations are foundation of pipeline. Pipeline transforms vertices (coordinates).

Viewing Pipeline & Coordinates Pipeline transforms vertices (coordinates) object eyeclip ndcwindow modelview matrix projection matrix perspective division viewport Coordinate systems are key to computer graphics!

The Model Coordinates and Transformations The coordinates we specify using the glVertex* commands are the model coordinates. The glRotate, glTranslate and glScale commands are used to transform the model into the desired orientation and size. These operations are applied to the modelview matrix. We did these matrix transformations as an exercise and in test 1. OpenGL does them for us using one-liners (thank goodness). After applying the modeling transformations to the model coordinates what we get are world coordinates.

The Model Coordinates and Transformations To begin transformation of this matrix, we need to specify it in the matrix mode function, then initialize the matrix to the Identity matrix, and perform your transformations thereafter:

Overview

The Camera Coordinates and Viewing Transformation The next step is to convert the world coordinates into camera coordinates. For this we use: gluLookAt(eyeX, eyeY, eyeZ, referX, referY, referZ, upX, upY, upZ); This performs translations and rotations to transform a point from world coordinates to camera coordinates. So the matrix generated is a combination of translation and rotation matrices. The default OpenGL viewpoint is located at the origin, looking down the negative Z axis. Two options: The geometry that we wish to view must either be moved to a position from which it can be seen from the default viewpoint, or the viewpoint must be moved so that it can see the geometry. eyeX, eyeY, eyeZ represents the viewpoint. referX, referY, referZ represents a point along the desired line of sight. upX, upY, upZ represents the view up vector.

The Camera Coordinates and Viewing Transformation Note that although the modeling and viewing transformations can be considered logically separate operations, OpenGL concatenates all of the modeling and viewing transformations into a single matrix (i.e. the ModelView Matrix) Panning or Tilting: move reference point horizontally or vertically.

Overview

Projection Transformation After applying the modelview matrix OpenGL must now take the camera coordinates to the image space. This is done using the projection transformation. Two types of projection: Orthographic and Perspective Each of these transformations defines a volume of space called a frustum. Only geometry that is inside of the frustum is displayed on the screen. Any portion of geometry that is outside of the frustum is clipped.

Projection Transformation Orthographic: Maps objects directly onto the screen without affecting their relative size. Given by: glOrtho(left, right, bottom, top, near, far); Defines a rectangular parallelepiped frustum (a box). Creates a matrix for an orthographic parallel viewing volume and multiplies the current matrix by it. (left, bottom, -near) and (right, top, -near) are points on the near plane that are mapped to the lower-left and upper-right corners of the viewport window, respectively. (left, bottom, -far) and (right, top, -far) are points on the far plane that are mapped to the same respective corners of the viewport. Both near and far can be positive or negative. The direction of projection is parallel to the z-axis, and the viewpoint faces toward the negative z-axis.

Projection Transformation Perspective: Makes objects that are farther away appear smaller. Given by: gluPerspective(fov, aspect, near, far); Creates a matrix for a symmetric perspective-view frustum and multiplies the current matrix by it. fovy is the angle of the field of view in the x-z plane; its value must be in the range [0.0,180.0]. aspect is the aspect ratio of the frustum, its width divided by its height. Near and far values are the distances between the viewpoint and the clipping planes, along the negative z-axis.

Overview

Clipping and Perspective Divison Steven’s section

Viewport Transformation Determines the size of the rendered image. By default the viewport is set to the entire pixel rectangle of the window. The glViewport(GLint x, GLint y, GLsizei width, GLsizei height); command can be used to choose a smaller drawing region. The viewport aspect ratio should be the same as that of the view frustum or the image appears distorted. The 2D picture plane from the previous transformation forms the world coordinate window, which can be mapped to the screen viewport, which ends up on our screen.

Code Execution Order Since the order of the transformations is significant, we want to invoke the OpenGL functions in the proper order, i.e. in the reverse order in which they will be applied: