Projection in 3-D Glenn G. Chappell

Slides:



Advertisements
Similar presentations
Computer Graphics - Viewing -
Advertisements

Graphics Pipeline.
Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
Projection Matrices CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Based on slides created by Edward Angel
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Computer Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Projection Matrices Ed Angel
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.
2/26/04© University of Wisconsin, CS559 Spring 2004 Last Time General Orthographic Viewing –Specifying cameras in world coordinates –Building world  view.
Course Overview, Introduction to CG Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, September 5, 2003.
Transformations Aaron Bloomfield CS 445: Introduction to Graphics
Computer Graphics (fall 2009)
02/26/02 (c) 2002 University of Wisconsin, CS 559 Last Time Canonical view pipeline Orthographic projection –There was an error in the matrix for taking.
The Viewing Pipeline (Chapter 4) 5/26/ Overview OpenGL viewing pipeline: OpenGL viewing pipeline: – Modelview matrix – Projection matrix Parallel.
1 Projection Matrices. 2 Objectives Derive the projection matrices used for standard OpenGL projections Introduce oblique projections Introduce projection.
Image Synthesis Rabie A. Ramadan, PhD 2. 2 Java OpenGL Using JOGL: Using JOGL: Wiki: You can download JOGL from.
2 COEN Computer Graphics I Evening’s Goals n Discuss the mathematical transformations that are utilized for computer graphics projection viewing.
CS559: Computer Graphics Lecture 9: Projection Li Zhang Spring 2008.
2/24/04© University of Wisconsin, CS559 Spring 2004 Last Time 3D Transformations –Most are natural extensions of 2D transforms –Rotations can be represented.
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,
Shadows via Projection Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, November 5, 2003.
Computer Graphics I, Fall 2010 Computer Viewing.
OpenGL: Introduction Yanci Zhang Game Programming Practice.
Games Development 1 Camera Projection / Picking CO3301 Week 8.
CS 450: COMPUTER GRAPHICS PROJECTIONS SPRING 2015 DR. MICHAEL J. REALE.
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.
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)
Advanced Viewing Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, October 31, 2003.
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.
Introduction to Computer Graphics: Viewing Transformations Rama C
Taxonomy of Projections FVFHP Figure Taxonomy of Projections.
Computer Graphics Matrices
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.
OpenGL and You I Cast, Therefore I Am. Ray Casting Idea is simple, implementation takes some work –Cast rays as if you were the camera –Determine intersection.
Viewing and Projection. The topics Interior parameters Projection type Field of view Clipping Frustum… Exterior parameters Camera position Camera orientation.
Some Notes on 3-D Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, October 24, 2003.
CS 551 / 645: Introductory Computer Graphics Viewing Transforms.
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.
Viewing. Classical Viewing Viewing requires three basic elements - One or more objects - A viewer with a projection surface - Projectors that go from.
Introduction to 3-D Viewing Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 27, 2003.
Three Dimensional Viewing
Viewing.
Computer Viewing.
CSE 167 [Win 17], Lecture 5: Viewing Ravi Ramamoorthi
Isaac Gang University of Mary Hardin-Baylor
and an introduction to matrices
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.
Projections and Normalization
Advanced Menuing, Introduction to Picking
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University View & Projection.
Computer Graphics (Spring 2003)
Lecture 13 Clipping & Scan Conversion
Last Time Canonical view pipeline Projection Local Coordinate Space
University of New Mexico
Computer Graphics Computer Viewing
Computer Viewing Ed Angel Professor Emeritus of Computer Science
CS5500 Computer Graphics April 24, 2006.
Presentation transcript:

Projection in 3-D Glenn G. Chappell CHAPPELLG@member.ams.org U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, October 29, 2003

Review: OpenGL Geometry Pipeline Model/view Transformation Lighting Projection Transformation Clipping (view-frustum) Viewport Transformation Object Coordinates Window Coordinates World Coordinates Eye Coordinates Vertex Operations Rasterization Fragment Operations Vertex enters here To framebuffer Vertices (object coord’s) Vertices (window coord’s) Fragments Fragments Convert vertex data to fragment data Depth test, etc. 29 Oct 2003 CS 381

Review: Introduction to 3-D Viewing [1/3] The model/view matrix can store a sequence of transformations. Two kinds of transformations go into model/view: modeling and viewing. The math and the code for these are identical. But conceptually they are different. Modeling transformations move objects or the scene. Viewing transformations can be thought of as moving the camera. Issues such as wide- vs. narrow-angle and perspective vs. parallel projection are not handled via model/view. With model/view we place objects & the camera in the world. Camera properties, such as those mentioned above, are set with the projection transformation. Model/view transformation Transformation #1 Transformation #2 Transformation #3 Transformation #4 29 Oct 2003 CS 381

Review: Introduction to 3-D Viewing [2/3] To move an object, put in a new transformation just before the object is drawn. To move the entire scene, put in a new transformation at the beginning of the modeling transformations. Where this is depends on how you think about things. To move the camera, put in a new transformation at the very beginning of the transformation-setting code. Moving the camera is backwards from moving objects Object forward = camera backward. Camera positioning using glTranslate*, glRotate* is often tricky. Using gluLookAt is sometimes more convenient. With gluLookAt, we specify where we look (“at point”). We can also easily use gluLookAt to set up what direction we look (“view-plane normal”). Push-pop pairs go around everything! You can never have too many of these. 29 Oct 2003 CS 381

Review: Introduction to 3-D Viewing [3/3] When we do lighting (soon!), doing things “wrong” can more easily lead to poor results. So get in the habit of doing things “right” now. Use model/view & projection properly. Draw your polygons front-side-out. If you do both lighting and scaling: glEnable(GL_NORMALIZE); Drawing an Object Conveniently Write a function that draws the object in “standard” position. In particular, the point you want to rotate about (the center of the object?) goes at the origin. To position the object, set up a transformation, then call this function. Don’t forget the push-pop pair! The same function can be used to draw multiple copies of the object. 29 Oct 2003 CS 381

Projection in 3-D: Introduction We use the projection transformation to handle camera properties. Perspective or parallel (orthogonal) projection. Wide or narrow angle. But not camera position & orientation. Using 44 matrices with the 4th-coordinate division, we can create any such projection we want. Both perspective and parallel. Including all of the classical views. Plan, elevation, isometric. 1-, 2-, and 3-point perspective. We do it all based on the synthetic camera model. Now we look at some of the mathematics. 29 Oct 2003 CS 381

Projection in 3-D: Projecting a Point [1/2] We have discussed the synthetic-camera model. Now we apply it, to determine the coordinates of a projected point. Screen Center of Projection (“eye”) (0, 0, 0) (x, y, z) –z (?, ?, ?) z = –near View Frustum z = –far 29 Oct 2003 CS 381

Projection in 3-D: Projecting a Point [2/2] Let b be the y-coordinate of the projection. Using similar triangles (outlined in red), we see that b/near = y/(–z), and so b is the value given below. We handle the x-coordinate similarly. Screen Center of Projection (“eye”) (0, 0, 0) (x, y, z) –z (x/[–z/near], y/[–z/near], –near) z = –near View Frustum z = –far 29 Oct 2003 CS 381

Projection in 3-D: A Matrix for Perspective What happens if we use the following matrix in the pipeline? Result: perspective! Is this matrix what glFrustum produces? Not quite; it deals with right, left, top, bottom, far, too. 29 Oct 2003 CS 381

Projection in 3-D: Wide vs. Narrow Angles How do we determine wide & narrow angle using glFrustum or gluPerspective? Example time … 29 Oct 2003 CS 381

More on OpenGL Matrices: Saving & Restoring Next time we will look at more advanced viewing interfaces. Zoom & pan. Flying. In order to implement these conveniently, we must be able to save and restore the value of a transformation matrix. See printmatrix.cpp. 29 Oct 2003 CS 381