Introduction to Computer Graphics: Viewing Transformations Rama C

Slides:



Advertisements
Similar presentations
Computer Graphics - Viewing -
Advertisements

Computer Graphics 2D & 3D Transformation.
Graphics Pipeline.
Based on slides created by Edward Angel
Viewing and Transformation
2/7/2001Hofstra University – CSC290B1 Review: Math (Ch 4)
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Computer Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 5: Viewing
Viewing Doug James’ CG Slides, Rich Riesenfeld’s CG Slides, Shirley, Fundamentals of Computer Graphics, Chap 7 Wen-Chieh (Steve) Lin Institute of Multimedia.
Transformations and Projections (Some slides adapted from Amitabh Varshney)
OpenGL (II). How to Draw a 3-D object on Screen?
CS 4731: Computer Graphics Lecture 11: 3D Viewing Emmanuel Agu.
Introduction to OpenGL Pipeline From Programmer View Tong-Yee Lee.
CHAPTER 7 Viewing and Transformations © 2008 Cengage Learning EMEA.
Computer Graphics 3D Transformations. 3D Translation Remembering 2D transformations -> 3x3 matrices, take a wild guess what happens to 3D transformations.
Introduction to 3D viewing 3D is just like taking a photograph!
Computer Graphics (fall 2009)
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.
Week 2 - Wednesday CS361.
Geometric transformations The Pipeline
Foundations of Computer Graphics (Fall 2012) CS 184, Lectures 13,14: Reviews Transforms, OpenGL
Homogeneous Form, Introduction to 3-D Graphics Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 20,
CAP4730: Computational Structures in Computer Graphics 3D Transformations.
1 Computer Graphics Week9 -3D Geometric Transformation.
Computer Graphics Bing-Yu Chen National Taiwan University.
Computer Graphics I, Fall 2010 Computer Viewing.
OpenGL: Introduction Yanci Zhang Game Programming Practice.
Viewing CS418 Computer Graphics John C. Hart. Graphics Pipeline Homogeneous Divide Model Coords Model Xform World Coords Viewing Xform Still Clip Coords.
10/7/04© University of Wisconsin, CS559 Fall 2004 Last Time Transformations Homogeneous coordinates Directions Rotation Geometry 101 – Points, edges, triangles/polygons.
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.
Affine Transformation. Affine Transformations In this lecture, we will continue with the discussion of the remaining affine transformations and composite.
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.
©2005, Lee Iverson Lee Iverson UBC Dept. of ECE EECE 478 Viewing and Projection.
Taxonomy of Projections FVFHP Figure Taxonomy of Projections.
Chap 3 Viewing and Transformation
Viewing and Projection
CS5500 Computer Graphics April 23, Today’s Topic Details of the front-end of the 3D pipeline: –How to construct the viewing matrix? –How to construct.
Learning Objectives Affine transformations Affine transformations Translation Translation Rotation Rotation Scaling Scaling Reflection Reflection Shear.
Viewing and Projection. The topics Interior parameters Projection type Field of view Clipping Frustum… Exterior parameters Camera position Camera orientation.
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.
Coordinate Systems Lecture 20 Wed, Oct 15, Object Coordinates Each object has its own “local” coordinate system, called object coordinates. Normally.
OpenGL LAB III.
Computer Graphics Lecture 41 Viewing Using OpenGL Taqdees A. Siddiqi
Outline 3D Viewing Required readings: HB 10-1 to 10-10
COMPUTER GRAPHICS AND LINEAR ALGEBRA AN INTRODUCTION.
Introduction to 3-D Viewing Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 27, 2003.
Viewing.
Computer Viewing.
CSE 167 [Win 17], Lecture 5: Viewing Ravi Ramamoorthi
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.
Isaac Gang University of Mary Hardin-Baylor
Rendering Pipeline Aaron Bloomfield CS 445: Introduction to Graphics
CSCE 441 Computer Graphics 3-D Viewing
Modeling 101 For the moment assume that all geometry consists of points, lines and faces Line: A segment between two endpoints Face: A planar area bounded.
CS451Real-time Rendering Pipeline
CSC461: Lecture 19 Computer Viewing
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University View & Projection.
Computer Graphics (Spring 2003)
Projection in 3-D Glenn G. Chappell
Geometric Objects and Transformations (II)
University of New Mexico
CS5500 Computer Graphics April 24, 2006.
Presentation transcript:

Introduction to Computer Graphics: Viewing Transformations Rama C Introduction to Computer Graphics: Viewing Transformations Rama C. Hoetzlein, 2011 Cornell University Lecture Notes

Topics Covered 1. Vector & Matrix Algebra 2. Affine Transformations 3. Homogeneous Coordinates 4. Perspective Projection 5. Projection Pipeline

Complete Perspective Matrix Lets us specify all characteristics of the projective volume. glMatrixMode ( GL_PROJECTION ) glFrustum ( l, r, b, t, near, far); gluPerspective ( fov, asp, near, far); gluOrtho2D ( l, r, b, t ); OpenGL Red Book

Viewing Pipeline What does the world look like through the camera?

scene with camera camera image Goal: Create a projected image of the scene from viewpoint of camera.

Model Space Local objects coordinates centered on the origin X+ Z+ drawCylinder () p

World Space { Objects in their place in the world How do we look through this camera? camera glTranslatef ( .. ) { M glRotatef ( .. ) drawCylinder () p = M p world

Camera Transforms Step 1. Translate everything to camera origin

Camera Transforms Step 2. Rotate around Y-axis by camera angle

Camera Transforms Step 3. Rotate around X-axis by camera tilt

{ View Space Objects oriented with the camera along the Z-axis glMatrixMode ( MODELVIEW ) V { gluLookAt (..) glTranslatef ( .. ) M { glRotatef ( .. ) drawCylinder () V { p = Rcz Rcy Tcam M p p = V M p view view

Normalized Projection Space Objects multiplied by perspective matrix, to fit in unit cube. glMatrixMode ( PROJECTION ) P { gluPerspective(..) glMatrixMode ( MODELVIEW ) V { gluLookAt (..) glTranslatef ( .. ) M { glRotatef ( .. ) drawCylinder () p = P V M p eye

Clipping Objects clipped to unit cube for rasterization. glMatrixMode ( PROJECTION ) P { gluPerspective(..) glMatrixMode ( MODELVIEW ) V { gluLookAt (..) Look here! glTranslatef ( .. ) M { glRotatef ( .. ) drawCylinder () p = clip ( P V M p ) clip

Screen Space Objects as they appear (flattened) on the screen. Divide by w to get 2D coordinates. glMatrixMode ( PROJECTION ) P { gluPerspective(..) glMatrixMode ( MODELVIEW ) V { gluLookAt (..) glTranslatef ( .. ) M { glRotatef ( .. ) drawCylinder () p = divw ( clip ( P V M p ) ) screen

Summary…

VIEWING PIPELINE Model Space World Space View Space M V P Screen Space Clipping persp. div clip Normalized Dev. Coordinates Depth Sorting p = divw ( clip ( P V M p ) ) screen Rasterization

VIEWING PIPELINE – in OpenGL OpenGL has two stored matricies, one for the projection, and one for the combined model-view. glMatrixMode ( GL_PROJECTION ); gluPerspective ( .. ); glMatrixMode ( GL_MODELVIEW ); gluLookAt ( fx, fy, fz, tx, ty, tz ); glRotatef ( 10, 0, 0, 1 ); drawCylinder ( .. ); tell OpenGL to setup projection creates a perspective matrix (P) tell OpenGL to setup model-view creates a view matrix (V) assigns rotation as model matrix (M) requests polygons to be drawn The clipping and divide by w happen automatically in hardware.

MULTIPLE OBJECTS Whats wrong with this? The scene has one view matrix (V) for the camera, but.. each object has its own MODELVIEW matrix, VM. glMatrixMode ( GL_PROJECTION ); gluPerspective ( .. ); glMatrixMode ( GL_MODELVIEW ); gluLookAt ( fx, fy, fz, tx, ty, tz ); glRotatef ( 10, 0, 0, 1 ); drawCylinder ( .. ); glRotatef ( 20, 1, 0, 0 ); P V M1 M2 Whats wrong with this?

MULTIPLE OBJECTS Right! (I hope).. Each object needs to set up the proper VM matrix. glMatrixMode ( GL_PROJECTION ); gluPerspective ( .. ); glMatrixMode ( GL_MODELVIEW ); gluLookAt ( fx, fy, fz, tx, ty, tz ); glGetMatrixfv ( view_matrix ); glLoadMatrixf ( view_matrix ); glRotatef ( 10, 0, 0, 1 ); drawCylinder ( .. ); glRotatef ( 20, 1, 0, 0 ); P V M1 V M2 obj1 = P V M1 obj2 = P V M2 save V