Slides:



Advertisements
Similar presentations
Computer Graphics - Viewing -
Advertisements

Three Dimensional Viewing
1 Computer Graphics Chapter 8 3D Transformations.
CS 4363/6353 INTRODUCTION TO COMPUTER GRAPHICS. WHAT YOU’LL SEE Interactive 3D computer graphics Real-time 2D, but mostly 3D OpenGL C/C++ (if you don’t.
Viewing and Transformation
CS485/685 Computer Vision Prof. George Bebis
Now Playing: Coulibaly Amadou & Mariam from Dimanche a Bamako Released August 2, 2005.
Viewing & Perspective CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2006.
Viewing Doug James’ CG Slides, Rich Riesenfeld’s CG Slides, Shirley, Fundamentals of Computer Graphics, Chap 7 Wen-Chieh (Steve) Lin Institute of Multimedia.
OpenGL (II). How to Draw a 3-D object on Screen?
CHAPTER 7 Viewing and Transformations © 2008 Cengage Learning EMEA.
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
Viewing & Perspective CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2005.
Computer Graphics (fall 2009)
Advanced Computer Graphics Three Dimensional Viewing
The Viewing Pipeline (Chapter 4) 5/26/ Overview OpenGL viewing pipeline: OpenGL viewing pipeline: – Modelview matrix – Projection matrix Parallel.
Week 2 - Wednesday CS361.
Transformation & Projection Feng Yu Proseminar Computer Graphics :
Geometric transformations The Pipeline
CS559: Computer Graphics Lecture 9: Projection Li Zhang Spring 2008.
Viewing Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 67 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 67 Computer Graphics Three-Dimensional Graphics III.
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.
CAP 4703 Computer Graphic Methods Prof. Roy Levow Chapter 5.
Demetriou/Loizidou – ACSC330 – Chapter 5 Viewing Dr. Giorgos A. Demetriou Computer Science Frederick Institute of Technology.
Programming 3D Applications CE Displaying Computer Graphics Week 3 Lecture 5 Bob Hobbs Faculty of Computing, Engineering and Technology Staffordshire.
CS559: Computer Graphics Lecture 9: Rasterization Li Zhang Spring 2008.
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.
University of North Carolina at Greensboro
2003CS Hons RW778 Graphics1 Chapter 7: Three-Dimensional Viewing Chapter 5: Camera with parallel projection Chapter 5: Camera with parallel projection.
Graphics Graphics Korea University kucg.korea.ac.kr Viewing 고려대학교 컴퓨터 그래픽스 연구실.
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)
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.
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 5: Viewing
12/24/2015 A.Aruna/Assistant professor/IT/SNSCE 1.
Viewpoints and Transformations CSIS 5838: Graphics and Animation for Gaming.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Classical Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Rendering Pipeline Fall, D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination.
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.
A Photograph of two papers
Coordinate Systems Lecture 1 Fri, Sep 2, The Coordinate Systems The points we create are transformed through a series of coordinate systems before.
Viewing and Projection. The topics Interior parameters Projection type Field of view Clipping Frustum… Exterior parameters Camera position Camera orientation.
Classical Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
CS 551 / 645: Introductory Computer Graphics Viewing Transforms.
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.
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
Viewing in 3D Lecture 11. Viewing in 3D2 u The 3D viewing process is inherently more complex than is the 2D viewing process. F In 2D, we simply specify.
CS552: Computer Graphics Lecture 9: Perspective Projection.
A Photograph of two papers The Model: 2 papers – 8cm x 8cm and 5cm x 5cm The Camera – Simple pinhole – No focusing capability The Scene – Arrangements.
Viewing 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.
Rendering Pipeline Fall, 2015.
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.
Unit 4 3D Viewing Pipeline Part - 2
A Photograph of two papers
Three Dimensional Viewing
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016
Last Time Canonical view pipeline Projection Local Coordinate Space
Viewing (Projections)
Viewing (Projections)
Computer Graphics 3Practical Lesson
Presentation transcript:

COMPUTER GRAPHICS SEPTEMBER 22, 2015 CS 482 – FALL 2015 VIRTUAL CAMERAS CLIPPING PERSPECTIVE PROJECTION ORTHOGRAPHIC PROJECTION

SEPTEMBER 22, 2015: VIRTUAL CAMERAS CLIPPING VIEW FRUSTUM The actual “view volume” of a scene is limited by near and far clipping planes, as well as limitations on the horizontal and vertical viewing angles. All objects (or partial objects) that fall outside of the “truncated pyramid” of the view frustum should not be rendered, if it’s possible to inexpensively “clip” them from the scene. CS 482 – FALL 2015 SEPTEMBER 22, 2015: VIRTUAL CAMERAS PAGE 91

CLIPPING NEAR AND FAR CLIPPING Near and far clip planes must be chosen carefully. Far clip planes are extremely useful in reducing the number of polygons that must be processed during rendering... Near clip planes eliminate objects that might obstruct the viewer’s desired view... …But the image may be damaged if the far clip plane is too close. …but unwanted views of a graphical object’s internal geometry may result if the near clip plane is pushed back too far. CS 482 – FALL 2015 SEPTEMBER 22, 2015: VIRTUAL CAMERAS PAGE 92

PERSPECTIVE PROJECTION CONVERTING 3D TO 2D When 3-D objects are rendered in a 2-D environment, some form of projection is used to eliminate the “extra” dimension. The two primary types of projections are: Orthographic (or parallel), in which one dimension is merely deleted Perspective, in which a formal mapping is performed to provide some degree of foreshortening to the rendered image. While parallel projections are computationally inexpensive and provide a good notion of actual distances (at least with respect to the remaining dimensions), perspective projections provide better realism. With either type of projection, we require a 4x4 matrix that will map 3-D points (in homogeneous coordinates) to 2-D points on the viewscreen. CS 482 – FALL 2015 SEPTEMBER 22, 2015: VIRTUAL CAMERAS PAGE 93

PERSPECTIVE PROJECTION VANISHING POINTS To make distant objects appear smaller, perspective projections are used. Now there are vanishing points in the distant left and right, as well as far overhead. One vanishing point, straight ahead of the viewer. A second vanishing point is added, at far left. Perspective Projection Matrix for one vanishing point on the z-axis, with a center of projection at (xc, yc, zc) (Additional vanishing points may be produced by then applying rotations around the appropriate axes.) CS 482 – FALL 2015 SEPTEMBER 22, 2015: VIRTUAL CAMERAS PAGE 94

PERSPECTIVE PROJECTION LOCATING VANISHING POINTS Where are the vanishing points in this scene from “BioShock Infinite”? CS 482 – FALL 2015 SEPTEMBER 22, 2015: VIRTUAL CAMERAS PAGE 95

PERSPECTIVE PROJECTION PROJECTION SHADOWS When casting shadows from a directional light source onto planar surfaces, a simplistic implementation combines translations and perspective projections. And finally, translate back by the light’s position Second, project to the shadow plane (in this case, the x-z plane) First, translate by the negative of the light’s position For every vertex on the 3d object being “shadowed” 1 0 0 1 0 𝑥 𝑙 0 𝑦 𝑙 0 0 0 0 1 𝑧 𝑙 0 1 1 0 0 1 0 0 0 0 0 0 0 −1 𝑦 𝑙 1 0 0 0 1 0 0 1 0 − 𝑥 𝑙 0 − 𝑦 𝑙 0 0 0 0 1 − 𝑧 𝑙 0 1 𝑥 𝑦 𝑧 1 CS 482 – FALL 2015 SEPTEMBER 22, 2015: VIRTUAL CAMERAS PAGE 96

PERSPECTIVE PROJECTION ASPECT RATIO In order to preserve the relative shapes and sizes of objects when the viewing window is resized, the perspective projection is adjusted to ensure a constant aspect ratio. void ResizeWindow(GLsizei w, GLsizei h) { currWindowSize[0] = w; currWindowSize[1] = h; if ( h == 0 ) h = 1; if ( ASPECT_RATIO > w/h ) currViewportSize[0] = w; currViewportSize[1] = int(w / ASPECT_RATIO); } else currViewportSize[0] = int(h * ASPECT_RATIO); currViewportSize[1] = h; // Center the image within the resized window. glViewport((w - currViewportSize[0]) / 2, 0, currViewportSize[0], currViewportSize[1]); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(FIELD_OF_VIEW_ANGLE, ASPECT_RATIO, NEAR_CLIP_DISTANCE, FAR_CLIP_DISTANCE); glMatrixMode(GL_MODELVIEW); return; CS 482 – FALL 2015 SEPTEMBER 22, 2015: VIRTUAL CAMERAS PAGE 97

ORTHOGRAPHIC PROJECTION PARALLEL PROJECTION Useful for drafting and design specifications, parallel projections do not tend to provide realistic views of 3-D objects. Orthographic Projection Matrix (to x-y plane) CS 482 – FALL 2015 SEPTEMBER 22, 2015: VIRTUAL CAMERAS PAGE 98