CSE 167 [Win 17], Lecture 5: Viewing Ravi Ramamoorthi

Slides:



Advertisements
Similar presentations
Lecture 3: Transformations and Viewing. General Idea Object in model coordinates Transform into world coordinates Represent points on object as vectors.
Advertisements

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
Objectives Derive the perspective projection matrices used for standard OpenGL projections Derive the perspective projection matrices used for standard.
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.
Computer Graphics (Fall 2008) COMS 4160, Lecture 3: Transformations 1
Viewing Doug James’ CG Slides, Rich Riesenfeld’s CG Slides, Shirley, Fundamentals of Computer Graphics, Chap 7 Wen-Chieh (Steve) Lin Institute of Multimedia.
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.
OpenGL (II). How to Draw a 3-D object on Screen?
Computer Graphics (Fall 2004) COMS 4160, Lecture 3: Transformations 1
CS 4731: Computer Graphics Lecture 11: 3D Viewing Emmanuel Agu.
Introduction to OpenGL Pipeline From Programmer View Tong-Yee Lee.
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.
Viewing and Projections
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.
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.
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.
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 5: Viewing
Taxonomy of Projections FVFHP Figure Taxonomy of Projections.
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.
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
Perspective projection
Projection and Clipping
CSE 167 [Win 17], Lecture 3: Transformations 1 Ravi Ramamoorthi
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016
Rendering Pipeline Aaron Bloomfield CS 445: Introduction to Graphics
3D Computer Graphics (3080/GV10) Week 5-6 Tutorial 3
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
Viewing Transformations
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University View & Projection.
Computer Graphics Lecture 20
Computer Graphics (Spring 2003)
Projection in 3-D Glenn G. Chappell
Last Time Canonical view pipeline Projection Local Coordinate Space
Chap 3 Viewing Pipeline Reading:
Type of View Perspective View COP(Center of Plane) Diminution of size
Viewing (Projections)
Computer Graphics 3Practical Lesson
CSCE441: Computer Graphics 2D/3D Transformations
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016
CS5500 Computer Graphics April 24, 2006.
Presentation transcript:

CSE 167 [Win 17], Lecture 5: Viewing Ravi Ramamoorthi Computer Graphics CSE 167 [Win 17], Lecture 5: Viewing Ravi Ramamoorthi http://viscomp.ucsd.edu/classes/cse167/wi17

To Do Questions/concerns about assignment 1? Remember it is due Jan 30. 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 tutorial Download others

What we’ve seen so far Transforms (translation, rotation, scale) as 4x4 homogeneous matrices Last row always 0 0 0 1. 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) Brief discussion of nonlinear mapping in z

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

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) y l r t b n f y y Translate Scale x x x z z z

Orthographic Matrix First center cuboid by translating Then scale into unit cube y l r t b n f y y Translate Scale x x x z z z

Transformation Matrix Scale Translation (centering)

Caveats Looking down –z, f and n are negative (n > f) OpenGL convention: positive n, f, negate internally y l r t b n f y y Translate Scale x x x z z z

Final Result

Outline Orthographic projection (simpler) Perspective projection, basic idea Derivation of gluPerspective (handout: glFrustum) 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 A Plane of Projection A’ B B’ Center of projection (camera/eye location) Slides inspired by Greg Humphreys

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 0 0 0 1) w coord will no longer = 1. Must divide at end

Verify

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 Far plane Near plane

Screen (Projection Plane) width Field of view (fovy) 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

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 Eye coordinates Model coordinates Perspective Transformation (gluPerspective) Model transformation Screen coordinates World coordinates Viewport transformation Camera Transformation (gluLookAt) Window coordinates Raster transformation Device coordinates Slide courtesy Greg Humphreys