Geometric transformations The Pipeline

Slides:



Advertisements
Similar presentations
Computer Graphics - Viewing -
Advertisements

Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
1 Computer Graphics Chapter 8 3D Transformations.
CHAPTER 4 Geometric Transformations: The Pipeline Vivian by Richard S. Wright Jr.
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,
OpenGL and Projections
OpenGL (II). How to Draw a 3-D object on Screen?
CS 4731: Computer Graphics Lecture 11: 3D Viewing Emmanuel Agu.
3D Rendering with JOGL Introduction to Java OpenGL Graphic Library By Ricardo Veguilla
Introduction to 3D viewing 3D is just like taking a photograph!
3D coordinate systems X Y Z Right-Hand Coordinate System X Y Z Left-Hand Coordinate System OpenGL uses this! Direct3D uses this!
1 OpenGL Basics A Graphics Standard ©Mel Slater, Anthony Steed
Computer Graphics, KKU. Lecture 131 Transformation and Viewing in OpenGL.
OpenGL Matrices and Transformations Angel, Chapter 3 slides from AW, Red Book, etc. CSCI 6360.
TWO DIMENSIONAL GEOMETRIC TRANSFORMATIONS CA 302 Computer Graphics and Visual Programming Aydın Öztürk
The Viewing Pipeline (Chapter 4) 5/26/ Overview OpenGL viewing pipeline: OpenGL viewing pipeline: – Modelview matrix – Projection matrix Parallel.
Viewing Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Homogeneous Form, Introduction to 3-D Graphics Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 20,
Introduction to OpenGL 1. 2 OpenGL A Graphics rendering API introduced in 1992 by Silicon Graphics Inc Provide the low-level functions to access graphics.
CAP 4703 Computer Graphic Methods Prof. Roy Levow Chapter 5.
Stages of Vertex Transformation To specify viewing, modeling, and projection transformations, you construct a 4 × 4 matrix M, which is then multiplied.
Computer Graphics Bing-Yu Chen National Taiwan University.
Computer Graphics I, Fall 2010 Computer Viewing.
OpenGL: Introduction Yanci Zhang Game Programming Practice.
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.
OpenGL Viewing and Modeling Transformation Geb Thomas Adapted from the OpenGL Programming Guidethe OpenGL Programming Guide.
2 COEN Computer Graphics I Evening’s Goals n Discuss viewing and modeling transformations n Describe matrix stacks and their uses n Show basic geometric.
Viewing and Transformation. Pixel pipeline Vertex pipeline Course Map Transformation & Lighting Primitive assembly Viewport culling & clipping Texture.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
The Camera Analogy ► Set up your tripod and point the camera at the scene (viewing transformation) ► Arrange the scene to be photographed into the desired.
Chapters 5 2 March Classical & Computer Viewing Same elements –objects –viewer –projectors –projection plane.
CGGM Lab. Tan-Chi Ho 2001 Viewing and Transformation.
Projections. Viewports Windows can have separate viewports void glViewport(GLint x, GLint y, GLsizei width, GLsizei height ) x, y - Specify the lower.
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
Learning Objectives Affine transformations Affine transformations Translation Translation Rotation Rotation Scaling Scaling Reflection Reflection Shear.
Homogeneous Coordinates and Matrix Representations Cartesian coordinate (x, y, z) Homogeneous coordinate (x h, y h, z h, h) Usually h = 1. But there are.
1 Geometric Transformations-II Modelling Transforms By Dr.Ureerat Suksawatchon.
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.
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
Implement of transformation,projection, viewing Hanyang University Jungsik Park.
OpenGL LAB III.
CS380 LAB II OpenGL Donghyuk Kim Reference1. [OpenGL course slides by Rasmus Stenholt] Reference2. [
Viewing. Classical Viewing Viewing requires three basic elements - One or more objects - A viewer with a projection surface - Projectors that go from.
OpenGL Matrices and Transformations Angel, Chapter 3 slides from AW, Red Book, etc. CSCI 6360/4360.
CSC Graphics Programming
Viewing.
Computer Viewing.
Camera Position (5.6) we specify the position and orientation of the camera to determine what will be seen. use gluLookAt (eye x, y, z, at x, y, z, up.
Reference1. [OpenGL course slides by Rasmus Stenholt]
Projection v VP u VPN n.
Geometric Transformations
Lecture 08 and 09 View & Projection
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University View & Projection.
Computer Graphics, KKU. Lecture 13
Geometric Transformations
Type of View Perspective View COP(Center of Plane) Diminution of size
The Modelview Matrix Lecture 8 Mon, Sep 10, 2007.
Geometric Objects and Transformations (II)
Computer Graphics 3Practical Lesson
Chapter 3 Viewing.
Projection v VP u VPN n.
Geometric Transformations
Presentation transcript:

Geometric transformations The Pipeline Computer Graphics Ben-Gurion University of the Negev Fall 2012 Some slides are based on Shay Shalom slides from TAU

How to … Establish your position in the scene Position objects within the scene Scale objects Establish a perspective transformation Moving around in OpenGL using a camera

Terminology Use Tnrasformation Specifies the location of the viewer or camera Viewing Moves objects around the scene Modeling Describes the duality of viewing and modeling transformations ModelView Clips and sizes the viewing volume Projection Scales the final output to the window Viewport

The Pipeline

Eye Coordinates Viewpoint of the observer They are a virtual fixed coordinate system Used as a common frame of reference

Viewing Transformations Like placing and pointing the camera at the scene To be specified before any other transformation By default, the point of observation is at the origin, looking down the negative Z-axis. What about objects drawn with positive Z values? Subsequent transformations occur based on the newly modified coordinate system

Modeling Transformation Manipulate the model and the particular objects within it Move objects into place, rotate them, and scale them These are the most common modeling transformations

Modeling Transformation - the ORDER matters Final appearance of an object depends greatly on the order of transformations

ModelView Duality In fact, viewing and modeling transformations are the same Induce the same effects on the final appearance of the scene The distinctions is made as a convenience for the programmer

Projection Transformations Applied after the modelview transformation Defines the viewing volume and the clipping planes Specifies how a finished scene is projected to the screen

Orthographic Vs. Perspective In an Orthographic projection: objects are mapped directly on the 2D screen using parallel lines No matter how far away something is In Perspective projection: Scenes are more realistic Distant objects appear smaller than nearby objects of the same size Parallel lines in 3D space do not always appear parallel See Code Example 3

The Pipeline - Recall

Slow but steady .. Current Matrix is part of the OpenGL state Options are: GL_MODELVIEW – changes, rotate, translate the model GL_PROJECTION – changes, translate, rotate the camera To specify which one is the “Current Matrix” : glMatrixMode(…) Subsequent matrix operations affect the specified matrix One of this matrices could be change in a given time

Translation void glTranslatef(GLfloat x, GLfloat y, GLfloat z ) This function takes as parameters the amount to translate along the x, y, and z directions

Translation – (cont’) glTranslate(0.0f, 10.0f, 0.0f) glutWireCube(10.0f) Construct a translation matrix for positive 10 Y Multiply it by the modelview matrix

Rotation void glRotatef(Glfloat angle,GLfloat x, GLfloat y, GLfloat z ) This function performs a rotation around the vector specified by the x, y, and z arguments. The angle of rotation is in the counterclockwise direction. A rotation around an arbitrary axis could be done.

Scaling void glScalef(GLfloat x, GLfloat y, GLfloat z ) Multiplies the x, y and z values by the scaling factors specified. Scaling does not have to be uniform.

The Identity Matrix Matrix operations are cumulative Erroneous artifacts may occur to the scene You reset the origin by loading the modelview matrix with the identity matrix glTranslate(0.0f, 10.0f, 0.0f); glutSolidSphere(1.0f); glTranslatef(10.0f, 0.0f, 0.0f); glutSolidSphere(1.0f)

The Identity Matrix – (cont’) glMatrixMode(GL_MODELVIEW) glLoadIdentity(); glTranslate(0.0f, 10.0f, 0.0f); glutSolidSphere(1.0f); glTranslatef(10.0f, 0.0f, 0.0f); glutSolidSphere(1.0f)

Matrix stack Resetting the modelview matrix to identity before placing the every object is not always desirable To save the current transformation state OpenGL maintains a matrix stack for both the modelview and projection matrices glPushMatrix() – push the current state matrix to the stack glPopMatrix() – pop the top matrix out of the stack, and replace the current state matrix with it

Matrix stack – (cont’) See Code Example 4

glOrtho(left, right, bottom, top, near, far) Viewing Volume glOrtho(left, right, bottom, top, near, far)

Viewing Volume – (cont’) glFrustum(left, right, bottom, top, near, far) gluPerspective(GLdouble fov ,GLdouble aspectRatio,GLdouble zNear,GLdouble zFar)

Camera Management gluLookAt(GLdouble eyex, GLdouble eyey, Gldouble eyez, GLdouble centerx, GLdouble centery, GLdouble centerz, GLdouble upx, GLdouble upy, GLdouble upz)

Buffers Important aspect of the current state of OpenGL Buffers dimensions are the same as the window’s dimension Color Buffer – stores the current color for each pixel Depth Buffer – stores the depth of each pixel of the scene (Z-Buffer) Accumulation buffer, stencil buffer, etc’ .. glEnable(GL_DEPTH_TEST) – enables the Z-Buffer in OpenGL. ….. Otherwise?