Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 5: Viewing

Slides:



Advertisements
Similar presentations
Computer Graphics - Viewing -
Advertisements

Lecture 3: Transformations and Viewing. General Idea Object in model coordinates Transform into world coordinates Represent points on object as vectors.
MAT 594CM S2010Fundamentals of Spatial ComputingAngus Forbes Overview Goals of the course: 1. to introduce real-time 3D graphics programming with openGL.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Projections II Week 4,
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Viewing/Projections III.
Viewing and Projections
Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 5: Viewing
1 of 19 New Lecture And Lab Information Lectures: –Thursday 13:00 – 14:00 (A322) Does anyone miss lunch? –Friday 15:00 – 16:00 (A28) Labs: –Wednesday 10:00.
Now Playing: Coulibaly Amadou & Mariam from Dimanche a Bamako Released August 2, 2005.
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.
Computer Vision : CISC4/689
Computer Graphics (Fall 2008) COMS 4160, Lecture 3: Transformations 1
CS223b, Jana Kosecka Rigid Body Motion and Image Formation.
Viewing Doug James’ CG Slides, Rich Riesenfeld’s CG Slides, Shirley, Fundamentals of Computer Graphics, Chap 7 Wen-Chieh (Steve) Lin Institute of Multimedia.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Viewing/Projections I.
4.1si31_2001 SI31 Advanced Computer Graphics AGR Lecture 4 Projection Clipping Viewport Transformation.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Viewing and Projections Mon 22 Sep 2003 project 1 solution demo recap: projections.
Computer Graphics (Fall 2004) COMS 4160, Lecture 3: Transformations 1
CS 4731: Computer Graphics Lecture 11: 3D Viewing Emmanuel Agu.
Cameras, lenses, and calibration
Projection Projection - the transformation of points from a coordinate system in n dimensions to a coordinate system in m dimensions where m
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.
Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 3: Transformations 1
Transformations Aaron Bloomfield CS 445: Introduction to Graphics
Viewing and Projections
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.
Week 2 - Wednesday CS361.
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.
CS-378: Game Technology Lecture #2.1: Projection Prof. Okan Arikan University of Texas, Austin Thanks to James O’Brien, Steve Chenney, Zoran Popovic, Jessica.
Computer Graphics Bing-Yu Chen National Taiwan University.
Foundations of Computer Graphics (Fall 2012) CS 184, Lectures 13,14: Reviews Transforms, OpenGL
CAP4730: Computational Structures in Computer Graphics 3D Transformations.
CS 4731: Computer Graphics Lecture 13: Projection Emmanuel Agu.
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.
OpenGL Viewing and Modeling Transformation Geb Thomas Adapted from the OpenGL Programming Guidethe OpenGL Programming Guide.
CS 445 / 645 Introduction to Computer Graphics Lecture 10 Camera Models Lecture 10 Camera Models.
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)
Jinxiang Chai CSCE 441 Computer Graphics 3-D Viewing 0.
Chapters 5 2 March Classical & Computer Viewing Same elements –objects –viewer –projectors –projection plane.
David Luebke1/10/2016 CS 551 / 645: Introductory Computer Graphics David Luebke
Taxonomy of Projections FVFHP Figure Taxonomy of Projections.
Transformations: Projection CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 3: Transformations 1
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.
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.
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.
Outline 3D Viewing Required readings: HB 10-1 to 10-10
Computer Graphics Projections.
Projection and Clipping
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016
CSE 167 [Win 17], Lecture 5: Viewing Ravi Ramamoorthi
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.
Lecture 9: Projection Li Zhang Spring 2008
CENG 477 Introduction to Computer Graphics
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University View & Projection.
Computer Graphics (Spring 2003)
Last Time Canonical view pipeline Projection Local Coordinate Space
Computer Graphics 3Practical Lesson
Presentation transcript:

Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 5: Viewing

To Do  Questions/concerns about assignment 1?  Remember it is due next Thu. Ask me or TAs re problems

Motivation  We have seen transforms (between coord systems)  But all that is in 3D  We still need to make a 2D picture  Project 3D to 2D. How do we do this?  This lecture is about viewing transformations

Demo (Projection Tutorial)  Nate Robbins OpenGL tutors  Projection.exe  Download others

What we’ve seen so far  Transforms (translation, rotation, scale) as 4x4 homogeneous matrices  Last row always Last w component always 1  For viewing (perspective), we will use that last row and w component no longer 1 (must divide by it)

Outline  Orthographic projection (simpler)  Perspective projection, basic idea  Derivation of gluPerspective (handout: glFrustum)  In new OpenGL, glm macro glm::lookAt glm::Perspective  Brief discussion of nonlinear mapping in z Not well covered in textbook chapter 7. We follow section 3.5 of real-time rendering most closely. Handouts on this will be given out.

Projections  To lower dimensional space (here 3D -> 2D)  Preserve straight lines  Trivial example: Drop one coordinate (Orthographic)

Orthographic Projection  Characteristic: Parallel lines remain parallel  Useful for technical drawings etc. Orthographic Perspective Fig 7.1 in text

Example  Simply project onto xy plane, drop z coordinate

In general  We have a cuboid that we want to map to the normalized or square cube from [-1, +1] in all axes  We have parameters of cuboid (l,r ; t,b; n,f)

Orthographic Matrix  First center cuboid by translating  Then scale into unit cube

Transformation Matrix ScaleTranslation (centering)

Caveats  Looking down –z, f and n are negative (n > f)  OpenGL convention: positive n, f, negate internally

Final Result

Outline  Orthographic projection (simpler)  Perspective projection, basic idea  Derivation of gluPerspective (handout: glFrustum)  In modern OpenGL, glm::perspective  Brief discussion of nonlinear mapping in z

Perspective Projection  Most common computer graphics, art, visual system  Further objects are smaller (size, inverse distance)  Parallel lines not parallel; converge to single point B A’ B’ Center of projection (camera/eye location) A Plane of Projection

Pinhole Camera  Center of Projection (one point)  Very common model in graphics (but real cameras use lenses; a bit more complicated)

Perspective Projection  Foreshortening: Distant objects appear smaller

Overhead View of Our Screen Looks like we’ve got some nice similar triangles here?

In Matrices  Note negation of z coord (focal plane –d)  (Only) last row affected (no longer )  w coord will no longer = 1. Must divide at end

Verify

Vanishing Points  Parallel lines “meet” at vanishing point  (x,y) ~ (d x, d y ) [directions]  Every pixel vanishing pt for some dirn (lines parallel to image plane vanish infinity)  Horizon

Perspective Distortions  Perspective can distort; artists often correct  Computers can too (Zorin and Barr 95)

Outline  Orthographic projection (simpler)  Perspective projection, basic idea  Derivation of gluPerspective (handout: glFrustum)  Brief discussion of nonlinear mapping in z

Remember projection tutorial

Viewing Frustum Near plane Far plane

Screen (Projection Plane) Field of view (fovy) width height Aspect ratio = width / height

gluPerspective  gluPerspective(fovy, aspect, zNear > 0, zFar > 0)  Fovy, aspect control fov in x, y directions  zNear, zFar control viewing frustum

Overhead View of Our Screen 1

In Matrices  Simplest form:  Aspect ratio taken into account  Homogeneous, simpler to multiply through by d  Must map z vals based on near, far planes (not yet)

In Matrices  A and B selected to map n and f to -1, +1 respectively

Z mapping derivation  Simultaneous equations?

Outline  Orthographic projection (simpler)  Perspective projection, basic idea  Derivation of gluPerspective (handout: glFrustum)  Brief discussion of nonlinear mapping in z

Mapping of Z is nonlinear  Many mappings proposed: all have nonlinearities  Advantage: handles range of depths (10cm – 100m)  Disadvantage: depth resolution not uniform  More close to near plane, less further away  Common mistake: set near = 0, far = infty. Don’t do this. Can’t set near = 0; lose depth resolution.  We discuss this more in review session

Summary: The Whole Viewing Pipeline Model transformation Camera Transformation (glm::lookAt) Perspective Transformation (glm::perspective) Viewport transformation Raster transformation Model coordinates World coordinates Eye coordinates Screen coordinates Window coordinates Device coordinates Slide courtesy Greg Humphreys