1 OpenGL - column vectors (column-major ordering)

Size: px
Start display at page:

Download "1 OpenGL - column vectors (column-major ordering)"

Transcription

1 OpenGL - column vectors (column-major ordering) OpenGL uses column vectors and matrices are written in a column-major order. As a result, matrices are concatenated in right-to-left order, with the first operation occuring on the right, the second operation to the left, the next operation to the left, and so on [ Pro ject View World ] x y z = x y z (). World (Model) Transformation Transformation matrices T GL = Translation Scale Rotation X (φ) t x t y t z S GL = s x s y s z Rx GL = cos(φ) sin(φ) sin(φ) cos(φ) Rz GL = Rotation Z (φ) cos(φ) sin(φ) sin(φ) cos(φ) Ry GL = Rotation Y (φ) cos(φ) sin(φ) sin(φ) cos(φ) Complex transformations, ordering of matrices The complex transformations can be decomposed into several basic ones: scalings, rotations, and translations. The basic transformation matrices are then assembled together by multiplicaton, and the order of multiplication matters (Figure ). a) b) Figure : The meaning of matrices order for transformations: a) first rotation, then translation; b) first translation, then rotation. the matrix ordering strongly depends on a way, in which matrices are stored. In OpenGL matrices are stored in columns (column-major order), in DirectX - in rows (row-major order).

2 OPENGL - COLUMN VECTORS (COLUMN-MAJOR ORDERING) The column ordered matrices are assembled from the right to the left (Equation ). Example. For Figure, transformation matrices are as follows: (a) M = T R, (b) M = R T, Example. For example from the lecture, where you were supposed to do at first scaling, then rotation about the X-axis, then about the Y-axis, then about the Z-axis, and at last do translation, transformation matrix is as follows M = T R Z R Y R X S. View Transform The purpose of the view transform is to place the camera at the origin and aim it, to make it look in the direction of the negative Z-axis, with the Y-axis pointing upwards and the X-axis pointing to the right (XYZ is a right-handed coordinate system). The actual position and direction after the view transform has been applied is dependent on the underlying (Application Program Interface) API. An example of the way in which the view transfrom affects the camera and the models are shown in Figure. Y Camera direction Camera direction Y View transform X View frustum X Camera position Z Z Camera position Figure : In the left illustration, the camera is located and oriented as the user wants it to be. The view transform relocates the camera at the origin looking along the negative Z-axis, as shown on the right. From the picture it should be more clear, that in order to relocate the camera we need to undo its previous transformations: first rotation around the origin then translation to desired position (viewer position). In OpenGL it means to apply the matrix M = (T R). These operations result in the following matrix: Mview GL = right x up x viewdir x viewpos x right y up y viewdir y viewpos y right z up z viewdir z viewpos z, () where viewpos is the viewer position, up is up camera vector, viewdir is the camera view direction, right is the right vector. Initial up camera vector can be non-perpendicular to the view direction, in this case we need recompute it. The enumarated vectors are calculated as follows: viewdir = viewpos lookatpos, right = Normalize(up viewdir), up = Normalize(viewDir right) where lookatpos, position at which the camera is looking. Due to the fact, that rotation matrix is orthonormal matrix, the inverse of this matrix is equal to transpose matrix. Translation matrix simply gets inversed signs in the forth column. Therefore view matrix is M view = (R T T ):

3 .3 Projection 3.3 Projection Mview GL = right x right y right z dot(viewpos,right) up x up y up z dot(viewpos,up ) viewdir x viewdir y viewdir z dot(viewpos,viewdir), (3) Before one can actually render a scene, all relevant objects in the scene must be projected onto some kind of plane or into some kind of simple volume. After that clipping and rendering are preformed. In the clipping step objects, which are further than far or closer than near planes are clipped off. Those objects are not rendered. Note, that changing of near parameter does not affect the position of objects in the scene, only objects appearance changes (the parts of the object which are further than far or closer than near planes are simply cut off). Orthographic projection With an orthographic projection, the viewing volume is a rectangular parallelepiped, or more informally, a box (see Figure 3a). The size of the viewing volume doesn t change from one end to the other, so distance from the camera doesn t affect how large an object appears. top toward the vewport left view direction left top w frustum a) bottom right near far b) fov near far near(=view) plane bottom h top Figure 3: Viewing volumes: a) orthographic viewing volume; b) perspective viewing volume. With no other transformations, the direction of projection is parallel to the z-axis, and the viewpoint faces toward the negative z-axis. Note that this means that the values passed in for far and near are used as negative z values if these planes are in front of the viewpoint, and positive if they re behind the viewpoint. The orthographic transform is shown in Equation 4: Port GL = right+le ft top+bottom f ar+near Perspective projection The most unmistakable characteristic of perspective projection (see Figure 3b) is foreshortening: the farther an object is from the camera, the smaller it appears in the final image. This occurs because the viewing volume for a perspective projection is a frustum of a pyramid (a truncated pyramid whose top has been cut off by a plane parallel to its base). Objects that fall within the viewing volume are projected toward the apex of the pyramid, where the camera or viewpoint is. Objects that are closer to the viewpoint appear larger because they occupy a proportionally larger amount of the viewing volume than those that are farther away, in the larger part of the frustum. The perspective transform is shown in Equation 5: Pperspec GL = near near right+le ft top+bottom ( f ar+near) where parameters right, left, top, and bottom are computed as follows: f arnear (4), (5) aspect = width viewport /height viewport top = tan( f ov/) near le ft = bottom aspect bottom = top right = top aspect

4 4 DIRECTX - ROW VECTORS (ROW-MAJOR ORDERING) Note, that usually you preffer to keep the fov-angle unchanged, whenever viewport is resized/reshaped or near/far is modified. In the case of viewport resizing/reshaping, aspect ratio is recomputed, left and right parameters and correspondingly persective transform matrix are recomputed. If near/far are modified, all the parameters excluding aspect ratio are recomputed. After the projection transformation coordinates are clipped: all the objects or parts of the objects with coordinates which do not fit into the viewing volume are cut off and do not proceed further into the pipeline..4 Last Transformations After model-view and projection transformations were applied, object coordinates are still 3D, must be translated into D and rasterized to get the image on the screen. Perspective division Just after the transformation projection we get all the objects projected into the viewing volume. Note, that received coordinates x, y, z, and w are not normalized. In order to provide normalization, we simply divide all coordinates by w: x d y d z d = x c/w c y c /w c z c /w c where x c, y c, z c and w c define the clipped coordinates. Viewport transformation At this step we need to map the normalized viewing volume to the viewport (see Figure 4). Note, that x and y are now normalized and we must translate them to viewport coordinates in pixels. viewing volume, h viewport screen Ox,Oy py, px w pixels Figure 4: Viewport transformation. Moreover, for some API, viewport coordinate system is different: origin is placed in the left upper corner and Y -axes is pointing down. The viewport transformation is determined by the viewport s width P x, height P y, and its center (O x, O y ) in pixels. The vertex s window coordinates are given by: x w y w z w = (p x/) x d + O x (p y /) y d + O y [( f ard neard)/] z d + (neard + f ard)/ (6) where fard, neard lie within [,] and specify the range of valid depth values in the depth buffer. After the viewport transformaion z w coordinate can be written into the depth buffer. Rasterization After all the transformations are done we have D-image. The viewport-coordinates (they are still floats) of the objects in this image pass as input to a rasterization algorithm. This algorithm produces discrete(pixel) version of all the objects in the image. DirectX - row vectors (row-major ordering) DirectX uses row vectors and matrices are written in a row-major order. As a result, matrices are concatenated in left-to-right order, with the first operation occuring on the left, the second operation to the right, the next operation to the right, and so on.

5 . World (Model) Transformation 5 [ x,y,z, World. World (Model) Transformation View Pro ject Model transformation matrices for DirectX are the same as for OpenGL, but transposed: Transformation matrices ] = [ x,y,z, ] (7) T DX = Translation Scale Rotation X (φ) t x t y t z Rz DX = Rotation Z (φ) S DX = cos(φ) sin(φ) sin(φ) cos(φ) s x s y s z Ry DX = Rx DX = Rotation Y (φ) cos(φ) sin(φ) sin(φ) cos(φ) cos(φ) sin(φ) sin(φ) cos(φ) Complex transformations, ordering of matrices The complex transformations for DirectX also can be split into several basic ones: scalings, rotations, and translations. The basic transformation matrices are assembled together by multiplicaton, and the order of multiplication matters (Figure ). But multiplication is now from the left to the right (Equation 7). Example. For Figure, transformation matrices are as follows: (a) M = R T, (b) M = T R, Example. For example from the lecture, where you were supposed to produce at first scaling, then rotation about the X-axis, then about the Y-axis, then about the Z-axis, and at last do translation, transformation matrix is as follows M = S R X R Y R Z T. View Transform The view transformation for DirectX is similar to OpenGL and there are several way to represent it. One way is to translate the viewer position and rotate the corresponding basis (right, up, view direction) around the world origin. Another way is to use DirectX function: D3DXMatrixLookAtLH, which computes the following view matrix: Mview DX = right x up x viewdir x right y up y viewdir y right z up z viewdir z dot(right,viewpos) dot(up,viewpos) dot(viewdir,viewpos), (8) where viewpos, up, viewdir, and right have the same meaning as for Equation and are computed as follows: viewdir = lookatpos viewpos, right = Normalize(up viewdir), up = Normalize(viewDir right)

6 6 REFERENCES.3 Projection DirectX projection matrices are also similar to OpenGL projection matrices. Orthographic projection The orthographic projection is presented as follows: Port DX = near near f ar Perspective projection The perspective transform is shown in Equation : right le ft top bottom Pperspec DX = f ar, () f arnear where parameters right, left, top, and bottom have the same meaning as for OpenGL perspective projection matrix (Equation 5)..4 Last Transformations The last transformations for DirectX are the same as for OpenGL, but viewport coordinate system is different: origin is in the left upper corner and Y -axis is pointing down. This only swaps the y -component in the viewport transformation: x w y w z w = (p x/) x d + O x (p y /) (. y d ) + O y [( f ard neard)/] z d + (neard + f ard)/ (9) () The meaning of parameters P x, P y, O x, O y, fard, and neard is the same as for the OpenGL viewport transformation matrix (Equation 6). References [] Moeller, T., Haines, E.: Real-Time Rendering, 999. AK Peters Ltd [] Segal, M., Akeley, K.: The OpenGL Graphics System: A Specification (Version.5), 3. Silicon Graphics [3] Neider, J., Davis, T.: OpenGL Programming Guide, nd edition, 997. Addison-Wesley Publishing Company [4] Gray, K.: Microsoft DirectX 9 Programmable Graphics Pipeline, 3. Microsoft Corporation [5] Microsoft Visual Studio Help 3

Lecture 3 Sections 2.2, 4.4. Mon, Aug 31, 2009

Lecture 3 Sections 2.2, 4.4. Mon, Aug 31, 2009 Model s Lecture 3 Sections 2.2, 4.4 World s Eye s Clip s s s Window s Hampden-Sydney College Mon, Aug 31, 2009 Outline Model s World s Eye s Clip s s s Window s 1 2 3 Model s World s Eye s Clip s s s Window

More information

Viewing with Computers (OpenGL)

Viewing 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 information

Notes on Assignment. Notes on Assignment. Notes on Assignment. Notes on Assignment

Notes 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 information

CSE528 Computer Graphics: Theory, Algorithms, and Applications

CSE528 Computer Graphics: Theory, Algorithms, and Applications CSE528 Computer Graphics: Theory, Algorithms, and Applications Hong Qin Stony Brook University (SUNY at Stony Brook) Stony Brook, New York 11794-2424 Tel: (631)632-845; Fax: (631)632-8334 qin@cs.stonybrook.edu

More information

CSE328 Fundamentals of Computer Graphics

CSE328 Fundamentals of Computer Graphics CSE328 Fundamentals of Computer Graphics Hong Qin State University of New York at Stony Brook (Stony Brook University) Stony Brook, New York 794--44 Tel: (63)632-845; Fax: (63)632-8334 qin@cs.sunysb.edu

More information

Lecture 4. Viewing, Projection and Viewport Transformations

Lecture 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 information

Rasterization Overview

Rasterization Overview Rendering Overview The process of generating an image given a virtual camera objects light sources Various techniques rasterization (topic of this course) raytracing (topic of the course Advanced Computer

More information

Three-Dimensional Viewing Hearn & Baker Chapter 7

Three-Dimensional Viewing Hearn & Baker Chapter 7 Three-Dimensional Viewing Hearn & Baker Chapter 7 Overview 3D viewing involves some tasks that are not present in 2D viewing: Projection, Visibility checks, Lighting effects, etc. Overview First, set up

More information

Models and The Viewing Pipeline. Jian Huang CS456

Models and The Viewing Pipeline. Jian Huang CS456 Models and The Viewing Pipeline Jian Huang CS456 Vertex coordinates list, polygon table and (maybe) edge table Auxiliary: Per vertex normal Neighborhood information, arranged with regard to vertices and

More information

Computer Graphics. P05 Viewing in 3D. Part 1. Aleksandra Pizurica Ghent University

Computer Graphics. P05 Viewing in 3D. Part 1. Aleksandra Pizurica Ghent University Computer Graphics P05 Viewing in 3D Part 1 Aleksandra Pizurica Ghent University Telecommunications and Information Processing Image Processing and Interpretation Group Viewing in 3D: context Create views

More information

Evening s Goals. Mathematical Transformations. Discuss the mathematical transformations that are utilized for computer graphics

Evening 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 information

INTRODUCTION TO COMPUTER GRAPHICS. It looks like a matrix Sort of. Viewing III. Projection in Practice. Bin Sheng 10/11/ / 52

INTRODUCTION TO COMPUTER GRAPHICS. It looks like a matrix Sort of. Viewing III. Projection in Practice. Bin Sheng 10/11/ / 52 cs337 It looks like a matrix Sort of Viewing III Projection in Practice / 52 cs337 Arbitrary 3D views Now that we have familiarity with terms we can say that these view volumes/frusta can be specified

More information

Announcements. Submitting Programs Upload source and executable(s) (Windows or Mac) to digital dropbox on Blackboard

Announcements. 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 information

CSE 167: Introduction to Computer Graphics Lecture #4: Vertex Transformation

CSE 167: Introduction to Computer Graphics Lecture #4: Vertex Transformation CSE 167: Introduction to Computer Graphics Lecture #4: Vertex Transformation Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013 Announcements Project 2 due Friday, October 11

More information

CS451Real-time Rendering Pipeline

CS451Real-time Rendering Pipeline 1 CS451Real-time Rendering Pipeline JYH-MING LIEN DEPARTMENT OF COMPUTER SCIENCE GEORGE MASON UNIVERSITY Based on Tomas Akenine-Möller s lecture note You say that you render a 3D 2 scene, but what does

More information

CSE 167: Lecture #4: Vertex Transformation. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

CSE 167: Lecture #4: Vertex Transformation. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012 CSE 167: Introduction to Computer Graphics Lecture #4: Vertex Transformation Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012 Announcements Project 2 due Friday, October 12

More information

The Viewing Pipeline adaptation of Paul Bunn & Kerryn Hugo s notes

The 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 information

Overview. By end of the week:

Overview. 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 information

Perspective matrix, OpenGL style

Perspective matrix, OpenGL style Perspective matrix, OpenGL style Stefan Gustavson May 7, 016 Gortler s book presents perspective transformation using a slightly different matrix than what is common in OpenGL applications. This document

More information

3D Graphics for Game Programming (J. Han) Chapter II Vertex Processing

3D 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 information

Computer Graphics 7: Viewing in 3-D

Computer 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 information

Today. Rendering pipeline. Rendering pipeline. Object vs. Image order. Rendering engine Rendering engine (jtrt) Computergrafik. Rendering pipeline

Today. Rendering pipeline. Rendering pipeline. Object vs. Image order. Rendering engine Rendering engine (jtrt) Computergrafik. Rendering pipeline Computergrafik Today Rendering pipeline s View volumes, clipping Viewport Matthias Zwicker Universität Bern Herbst 2008 Rendering pipeline Rendering pipeline Hardware & software that draws 3D scenes on

More information

INTRODUCTION TO COMPUTER GRAPHICS. cs123. It looks like a matrix Sort of. Viewing III. Projection in Practice 1 / 52

INTRODUCTION TO COMPUTER GRAPHICS. cs123. It looks like a matrix Sort of. Viewing III. Projection in Practice 1 / 52 It looks like a matrix Sort of Viewing III Projection in Practice 1 / 52 Arbitrary 3D views } view volumes/frusta spec d by placement and shape } Placement: } Position (a point) } look and up vectors }

More information

CS 4204 Computer Graphics

CS 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 information

Perspective transformations

Perspective transformations Perspective transformations Transformation pipeline Modelview: model (position objects) + view (position the camera) Projection: map viewing volume to a standard cube Perspective division: project D to

More information

Game Architecture. 2/19/16: Rasterization

Game Architecture. 2/19/16: Rasterization Game Architecture 2/19/16: Rasterization Viewing To render a scene, need to know Where am I and What am I looking at The view transform is the matrix that does this Maps a standard view space into world

More information

COMP3421. Introduction to 3D Graphics

COMP3421. 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 information

CSE452 Computer Graphics

CSE452 Computer Graphics CSE45 Computer Graphics Lecture 8: Computer Projection CSE45 Lecture 8: Computer Projection 1 Review In the last lecture We set up a Virtual Camera Position Orientation Clipping planes Viewing angles Orthographic/Perspective

More information

COMP3421. Introduction to 3D Graphics

COMP3421. 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 information

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S 3D Viewing: the Synthetic Camera Programmer s reference model for specifying 3D view projection parameters to the computer General synthetic camera (e.g., PHIGS Camera, Computer Graphics: Principles and

More information

COMP3421. Introduction to 3D Graphics

COMP3421. 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 information

Viewing. Reading: Angel Ch.5

Viewing. Reading: Angel Ch.5 Viewing Reading: Angel Ch.5 What is Viewing? Viewing transform projects the 3D model to a 2D image plane 3D Objects (world frame) Model-view (camera frame) View transform (projection frame) 2D image View

More information

Computer Science 426 Midterm 3/11/04, 1:30PM-2:50PM

Computer Science 426 Midterm 3/11/04, 1:30PM-2:50PM NAME: Login name: Computer Science 46 Midterm 3//4, :3PM-:5PM This test is 5 questions, of equal weight. Do all of your work on these pages (use the back for scratch space), giving the answer in the space

More information

Computer Graphics. Chapter 10 Three-Dimensional Viewing

Computer 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 information

The Graphics Pipeline and OpenGL I: Transformations!

The Graphics Pipeline and OpenGL I: Transformations! ! The Graphics Pipeline and OpenGL I: Transformations! Gordon Wetzstein! Stanford University! EE 267 Virtual Reality! Lecture 2! stanford.edu/class/ee267/!! Albrecht Dürer, Underweysung der Messung mit

More information

CMSC427 Transformations II: Viewing. Credit: some slides from Dr. Zwicker

CMSC427 Transformations II: Viewing. Credit: some slides from Dr. Zwicker CMSC427 Transformations II: Viewing Credit: some slides from Dr. Zwicker What next? GIVEN THE TOOLS OF The standard rigid and affine transformations Their representation with matrices and homogeneous coordinates

More information

Projection: Mapping 3-D to 2-D. Orthographic Projection. The Canonical Camera Configuration. Perspective Projection

Projection: 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 information

Virtual Cameras and The Transformation Pipeline

Virtual Cameras and The Transformation Pipeline Virtual Cameras and The Transformation Pipeline Anton Gerdelan gerdela@scss.tcd.ie with content from Rachel McDonnell 13 Oct 2014 Virtual Camera We want to navigate through our scene in 3d Solution = create

More information

Prof. Feng Liu. Fall /19/2016

Prof. 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 information

Announcement. Project 1 has been posted online and in dropbox. Due: 11:59:59 pm, Friday, October 14

Announcement. Project 1 has been posted online and in dropbox. Due: 11:59:59 pm, Friday, October 14 Announcement Project 1 has been posted online and in dropbox Due: 11:59:59 pm, Friday, October 14 Project 1: Interactive Viewing of Two Teapots How to create a teapot? Before OpenGL 3., glutsolidteapot

More information

CITSTUDENTS.IN VIEWING. Computer Graphics and Visualization. Classical and computer viewing. Viewing with a computer. Positioning of the camera

CITSTUDENTS.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 information

COMS 4160: Problems on Transformations and OpenGL

COMS 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 information

Getting Started. Overview (1): Getting Started (1): Getting Started (2): Getting Started (3): COSC 4431/5331 Computer Graphics.

Getting 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 information

Rendering Objects. Need to transform all geometry then

Rendering Objects. Need to transform all geometry then Intro to OpenGL Rendering Objects Object has internal geometry (Model) Object relative to other objects (World) Object relative to camera (View) Object relative to screen (Projection) Need to transform

More information

Viewing. Part II (The Synthetic Camera) CS123 INTRODUCTION TO COMPUTER GRAPHICS. Andries van Dam 10/10/2017 1/31

Viewing. Part II (The Synthetic Camera) CS123 INTRODUCTION TO COMPUTER GRAPHICS. Andries van Dam 10/10/2017 1/31 Viewing Part II (The Synthetic Camera) Brownie camera courtesy of http://www.geh.org/fm/brownie2/htmlsrc/me13000034_ful.html 1/31 The Camera and the Scene } What does a camera do? } Takes in a 3D scene

More information

THE CAMERA TRANSFORM

THE CAMERA TRANSFORM On-Line Computer Graphics Notes THE CAMERA TRANSFORM Kenneth I. Joy Visualization and Graphics Research Group Department of Computer Science University of California, Davis Overview To understanding the

More information

CS230 : Computer Graphics Lecture 6: Viewing Transformations. Tamar Shinar Computer Science & Engineering UC Riverside

CS230 : Computer Graphics Lecture 6: Viewing Transformations. Tamar Shinar Computer Science & Engineering UC Riverside CS230 : Computer Graphics Lecture 6: Viewing Transformations Tamar Shinar Computer Science & Engineering UC Riverside Rendering approaches 1. image-oriented foreach pixel... 2. object-oriented foreach

More information

Chapter 5. Projections and Rendering

Chapter 5. Projections and Rendering Chapter 5 Projections and Rendering Topics: Perspective Projections The rendering pipeline In order to view manipulate and view a graphics object we must find ways of storing it a computer-compatible way.

More information

Projection and viewing. Computer Graphics CSE 167 Lecture 4

Projection and viewing. Computer Graphics CSE 167 Lecture 4 Projection and viewing Computer Graphics CSE 167 Lecture 4 CSE 167: Computer Graphics Review: transformation from the object (or model) coordinate frame to the camera (or eye) coordinate frame Projection

More information

Lecture 4: Viewing. Topics:

Lecture 4: Viewing. Topics: Lecture 4: Viewing Topics: 1. Classical viewing 2. Positioning the camera 3. Perspective and orthogonal projections 4. Perspective and orthogonal projections in OpenGL 5. Perspective and orthogonal projection

More information

THE VIEWING TRANSFORMATION

THE VIEWING TRANSFORMATION ECS 178 Course Notes THE VIEWING TRANSFORMATION Kenneth I. Joy Institute for Data Analysis and Visualization Department of Computer Science University of California, Davis Overview One of the most important

More information

Graphics pipeline and transformations. Composition of transformations

Graphics pipeline and transformations. Composition of transformations Graphics pipeline and transformations Composition of transformations Order matters! ( rotation * translation translation * rotation) Composition of transformations = matrix multiplication: if T is a rotation

More information

Lecture 5: Transforms II. Computer Graphics and Imaging UC Berkeley CS184/284A

Lecture 5: Transforms II. Computer Graphics and Imaging UC Berkeley CS184/284A Lecture 5: Transforms II Computer Graphics and Imaging UC Berkeley 3D Transforms 3D Transformations Use homogeneous coordinates again: 3D point = (x, y, z, 1) T 3D vector = (x, y, z, 0) T Use 4 4 matrices

More information

CS 130 Final. Fall 2015

CS 130 Final. Fall 2015 CS 130 Final Fall 2015 Name Student ID Signature You may not ask any questions during the test. If you believe that there is something wrong with a question, write down what you think the question is trying

More information

Computer Viewing. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Computer Viewing. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science Computer Viewing CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science 1 Objectives Introduce the mathematics of projection Introduce OpenGL viewing functions Look at

More information

Computer Graphics with OpenGL ES (J. Han) Chapter VII Rasterizer

Computer Graphics with OpenGL ES (J. Han) Chapter VII Rasterizer Chapter VII Rasterizer Rasterizer The vertex shader passes the clip-space vertices to the rasterizer, which performs the following: Clipping Perspective division Back-face culling Viewport transform Scan

More information

GEOMETRIC TRANSFORMATIONS AND VIEWING

GEOMETRIC 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 information

Overview of Projections: From a 3D world to a 2D screen.

Overview 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 information

Motivation. What we ve seen so far. Demo (Projection Tutorial) Outline. Projections. Foundations of Computer Graphics

Motivation. What we ve seen so far. Demo (Projection Tutorial) Outline. Projections. Foundations of Computer Graphics Foundations of Computer Graphics Online Lecture 5: Viewing Orthographic Projection Ravi Ramamoorthi Motivation We have seen transforms (between coord sstems) But all that is in 3D We still need to make

More information

CSE 167: Introduction to Computer Graphics Lecture #5: Projection. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017

CSE 167: Introduction to Computer Graphics Lecture #5: Projection. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017 CSE 167: Introduction to Computer Graphics Lecture #5: Projection Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017 Announcements Friday: homework 1 due at 2pm Upload to TritonEd

More information

RASTERISED RENDERING

RASTERISED RENDERING DH2323 DGI16 INTRODUCTION TO COMPUTER GRAPHICS AND INTERACTION RASTERISED RENDERING Christopher Peters HPCViz, KTH Royal Institute of Technology, Sweden chpeters@kth.se http://kth.academia.edu/christopheredwardpeters

More information

Introduction to Computer Graphics 4. Viewing in 3D

Introduction 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 information

CS Exam 1 Review Problems Fall 2017

CS Exam 1 Review Problems Fall 2017 CS 45500 Exam 1 Review Problems Fall 2017 1. What is a FrameBuffer data structure? What does it contain? What does it represent? How is it used in a graphics rendering pipeline? 2. What is a Scene data

More information

Projection Lecture Series

Projection Lecture Series Projection 25.353 Lecture Series Prof. Gary Wang Department of Mechanical and Manufacturing Engineering The University of Manitoba Overview Coordinate Systems Local Coordinate System (LCS) World Coordinate

More information

To Do. Demo (Projection Tutorial) Motivation. What we ve seen so far. Outline. Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 5: Viewing

To Do. Demo (Projection Tutorial) Motivation. What we ve seen so far. Outline. Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 5: Viewing Foundations of Computer Graphics (Fall 0) CS 84, Lecture 5: Viewing http://inst.eecs.berkele.edu/~cs84 To Do Questions/concerns about assignment? Remember it is due Sep. Ask me or TAs re problems Motivation

More information

Advanced Lighting Techniques Due: Monday November 2 at 10pm

Advanced Lighting Techniques Due: Monday November 2 at 10pm CMSC 23700 Autumn 2015 Introduction to Computer Graphics Project 3 October 20, 2015 Advanced Lighting Techniques Due: Monday November 2 at 10pm 1 Introduction This assignment is the third and final part

More information

The Importance of Matrices in the DirectX API. by adding support in the programming language for frequently used calculations.

The Importance of Matrices in the DirectX API. by adding support in the programming language for frequently used calculations. Hermann Chong Dr. King Linear Algebra Applications 28 November 2001 The Importance of Matrices in the DirectX API In the world of 3D gaming, there are two APIs (Application Program Interface) that reign

More information

SUMMARY. CS380: Introduction to Computer Graphics Projection Chapter 10. Min H. Kim KAIST School of Computing 18/04/12. Smooth Interpolation

SUMMARY. CS380: Introduction to Computer Graphics Projection Chapter 10. Min H. Kim KAIST School of Computing 18/04/12. Smooth Interpolation CS38: Introduction to Computer Graphics Projection Chapter Min H. Kim KAIST School of Computing Smooth Interpolation SUMMARY 2 Cubic Bezier Spline To evaluate the function c(t) at any value of t, we perform

More information

3D Polygon Rendering. Many applications use rendering of 3D polygons with direct illumination

3D Polygon Rendering. Many applications use rendering of 3D polygons with direct illumination Rendering Pipeline 3D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination 3D Polygon Rendering What steps are necessary to utilize spatial coherence while drawing

More information

3D Viewing Episode 2

3D 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 information

Viewing COMPSCI 464. Image Credits: Encarta and

Viewing 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 information

COMP Computer Graphics and Image Processing. a6: Projections. In part 2 of our study of Viewing, we ll look at. COMP27112 Toby Howard

COMP Computer Graphics and Image Processing. a6: Projections. In part 2 of our study of Viewing, we ll look at. COMP27112 Toby Howard Computer Graphics and Image Processing a6: Projections Tob.Howard@manchester.ac.uk Introduction In part 2 of our stud of Viewing, we ll look at The theor of geometrical planar projections Classes of projections

More information

The Graphics Pipeline and OpenGL I: Transformations!

The Graphics Pipeline and OpenGL I: Transformations! ! The Graphics Pipeline and OpenGL I: Transformations! Gordon Wetzstein! Stanford University! EE 267 Virtual Reality! Lecture 2! stanford.edu/class/ee267/!! Logistics Update! all homework submissions:

More information

Fachhochschule Regensburg, Germany, February 15, 2017

Fachhochschule 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 information

3D 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. 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 information

Viewing transformations. 2004, Denis Zorin

Viewing transformations. 2004, Denis Zorin Viewing transformations OpenGL transformation pipeline Four main stages: Modelview: object coords to eye coords p eye = Mp obj (x obj,y obj,z obj,w obj ) (x eye,y eye,z eye,w eye ) in eye coordinates,

More information

Advanced Computer Graphics (CS & SE )

Advanced 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 information

CSE 167: Introduction to Computer Graphics Lecture #3: Projection. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

CSE 167: Introduction to Computer Graphics Lecture #3: Projection. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016 CSE 167: Introduction to Computer Graphics Lecture #3: Projection Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016 Announcements Next Monday: homework discussion Next Friday:

More information

To Do. Motivation. Demo (Projection Tutorial) What we ve seen so far. Computer Graphics. Summary: The Whole Viewing Pipeline

To Do. Motivation. Demo (Projection Tutorial) What we ve seen so far. Computer Graphics. Summary: The Whole Viewing Pipeline Computer Graphics CSE 67 [Win 9], Lecture 5: Viewing Ravi Ramamoorthi http://viscomp.ucsd.edu/classes/cse67/wi9 To Do Questions/concerns about assignment? Remember it is due tomorrow! (Jan 6). Ask me or

More information

Visualisation Pipeline : The Virtual Camera

Visualisation Pipeline : The Virtual Camera Visualisation Pipeline : The Virtual Camera The Graphics Pipeline 3D Pipeline The Virtual Camera The Camera is defined by using a parallelepiped as a view volume with two of the walls used as the near

More information

1 Transformations. Chapter 1. Transformations. Department of Computer Science and Engineering 1-1

1 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 information

Virtual Cameras & Their Matrices

Virtual Cameras & Their Matrices Virtual Cameras & Their Matrices J.Tumblin-Modified, highly edited SLIDES from: Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 What is Projection? Any operation that reduces

More information

OpenGL Transformations

OpenGL 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 information

Figure 1. Lecture 1: Three Dimensional graphics: Projections and Transformations

Figure 1. Lecture 1: Three Dimensional graphics: Projections and Transformations Lecture 1: Three Dimensional graphics: Projections and Transformations Device Independence We will start with a brief discussion of two dimensional drawing primitives. At the lowest level of an operating

More information

CS251 Spring 2014 Lecture 7

CS251 Spring 2014 Lecture 7 CS251 Spring 2014 Lecture 7 Stephanie R Taylor Feb 19, 2014 1 Moving on to 3D Today, we move on to 3D coordinates. But first, let s recap of what we did in 2D: 1. We represented a data point in 2D data

More information

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11 Pipeline Operations CS 4620 Lecture 11 1 Pipeline you are here APPLICATION COMMAND STREAM 3D transformations; shading VERTEX PROCESSING TRANSFORMED GEOMETRY conversion of primitives to pixels RASTERIZATION

More information

CS488. Implementation of projections. Luc RENAMBOT

CS488. Implementation of projections. Luc RENAMBOT CS488 Implementation of projections Luc RENAMBOT 1 3D Graphics Convert a set of polygons in a 3D world into an image on a 2D screen After theoretical view Implementation 2 Transformations P(X,Y,Z) Modeling

More information

Today. Today. Introduction. Matrices. Matrices. Computergrafik. Transformations & matrices Introduction Matrices

Today. Today. Introduction. Matrices. Matrices. Computergrafik. Transformations & matrices Introduction Matrices Computergrafik Matthias Zwicker Universität Bern Herbst 2008 Today Transformations & matrices Introduction Matrices Homogeneous Affine transformations Concatenating transformations Change of Common coordinate

More information

9. Visible-Surface Detection Methods

9. Visible-Surface Detection Methods 9. Visible-Surface Detection Methods More information about Modelling and Perspective Viewing: Before going to visible surface detection, we first review and discuss the followings: 1. Modelling Transformation:

More information

15. Clipping. Projection Transformation. Projection Matrix. Perspective Division

15. Clipping. Projection Transformation. Projection Matrix. Perspective Division 15. Clipping Procedures for eliminating all parts of primitives outside of the specified view volume are referred to as clipping algorithms or simply clipping This takes place as part of the Projection

More information

Computer Graphics. Shadows

Computer Graphics. Shadows Computer Graphics Lecture 10 Shadows Taku Komura Today Shadows Overview Projective shadows Shadow texture Shadow volume Shadow map Soft shadows Why Shadows? Shadows tell us about the relative locations

More information

For each question, indicate whether the statement is true or false by circling T or F, respectively.

For each question, indicate whether the statement is true or false by circling T or F, respectively. True/False For each question, indicate whether the statement is true or false by circling T or F, respectively. 1. (T/F) Rasterization occurs before vertex transformation in the graphics pipeline. 2. (T/F)

More information

Viewing Transformation

Viewing 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 information

CS 428: Fall Introduction to. Viewing and projective transformations. Andrew Nealen, Rutgers, /23/2009 1

CS 428: Fall Introduction to. Viewing and projective transformations. Andrew Nealen, Rutgers, /23/2009 1 CS 428: Fall 29 Introduction to Computer Graphics Viewing and projective transformations Andrew Nealen, Rutgers, 29 9/23/29 Modeling and viewing transformations Canonical viewing volume Viewport transformation

More information

Viewing and Projection

Viewing and Projection Viewing and Projection Sheelagh Carpendale Camera metaphor. choose camera position 2. set up and organie objects 3. choose a lens 4. take the picture View Volumes what gets into the scene perspective view

More information

Module 6: Pinhole camera model Lecture 32: Coordinate system conversion, Changing the image/world coordinate system

Module 6: Pinhole camera model Lecture 32: Coordinate system conversion, Changing the image/world coordinate system The Lecture Contains: Back-projection of a 2D point to 3D 6.3 Coordinate system conversion file:///d /...(Ganesh%20Rana)/MY%20COURSE_Ganesh%20Rana/Prof.%20Sumana%20Gupta/FINAL%20DVSP/lecture%2032/32_1.htm[12/31/2015

More information

CSE 167: Introduction to Computer Graphics Lecture #3: Coordinate Systems

CSE 167: Introduction to Computer Graphics Lecture #3: Coordinate Systems CSE 167: Introduction to Computer Graphics Lecture #3: Coordinate Systems Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2015 Announcements Project 2 due Friday at 1pm Homework

More information

Wire-Frame 3D Graphics Accelerator IP Core. C Library Specification

Wire-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 information

CSE 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 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 information

Pipeline Operations. CS 4620 Lecture 14

Pipeline Operations. CS 4620 Lecture 14 Pipeline Operations CS 4620 Lecture 14 2014 Steve Marschner 1 Pipeline you are here APPLICATION COMMAND STREAM 3D transformations; shading VERTEX PROCESSING TRANSFORMED GEOMETRY conversion of primitives

More information