Computer Graphics Zhen Jiang West Chester University.

Slides:



Advertisements
Similar presentations
David Luebke5/11/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
Advertisements

Lecture Fall 2001 Visibility Back-Face Culling Painter’s Algorithm.
CS 551 / 645: Introductory Computer Graphics Visible Surface Determination.
CAP4730: Computational Structures in Computer Graphics Visible Surface Determination.
Visibility in Computer Graphics Toni Sellarès Unversitat de Girona
CS 445 / 645: Introductory Computer Graphics
UBI 516 Advanced Computer Graphics
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Clipping II, Hidden Surfaces.
Chapter 6: Vertices to Fragments Part 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
Viewing and Projections
Clipping & Scan Conversion
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Visibility II Week 7,
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Hidden Surfaces II Week.
Vertices and Fragments III Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
Spatial Data Structure: Quadtree, Octree,and BSP tree Mengxia Zhu Fall 2007.
1 Chapter 5 Viewing. 2 Perspective Projection 3 Parallel Projection.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Visibility Week 7, Wed.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Visibility: Z Buffering Week 10, Mon 3 Nov 2003.
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 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.
2/26/04© University of Wisconsin, CS559 Spring 2004 Last Time General Orthographic Viewing –Specifying cameras in world coordinates –Building world  view.
Hidden Surface Removal
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.
MIT EECS 6.837, Durand and Cutler Graphics Pipeline: Projective Transformations.
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.
Computer Graphics Bing-Yu Chen National Taiwan University.
Visible-Surface Detection Jehee Lee Seoul National University.
CAP 4703 Computer Graphic Methods Prof. Roy Levow Chapter 5.
CS-378: Game Technology Lecture #2.2: Clipping and Hidden Surfaces Prof. Okan Arikan University of Texas, Austin Thanks to James O’Brien, Steve Chenney,
Binary Space Partitioning Trees Ray Casting Depth Buffering
David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
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.
CS 445 / 645 Introduction to Computer Graphics Lecture 10 Camera Models Lecture 10 Camera Models.
Graphics Graphics Korea University kucg.korea.ac.kr Viewing 고려대학교 컴퓨터 그래픽스 연구실.
David Luebke 1 12/8/2015 Visibility CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
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)
Computer Graphics Lecture 08 Fasih ur Rehman. Last Class Ray Tracing.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Jinxiang Chai CSCE 441 Computer Graphics 3-D Viewing 0.
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © Visible Surface Determination (VSD) To render or not to render, that is the question… 1 of.
©2005, Lee Iverson Lee Iverson UBC Dept. of ECE EECE 478 Viewing and Projection.
Rendering Pipeline Fall, D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination.
Computer Graphics I, Fall 2010 Implementation II.
A Photograph of two papers
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
Computer Graphics Inf4/MSc 1 Computer Graphics Lecture 5 Hidden Surface Removal and Rasterization Taku Komura.
1 Computer Graphics Week11 : Hidden Surface Removal.
Viewing and Projection. The topics Interior parameters Projection type Field of view Clipping Frustum… Exterior parameters Camera position Camera orientation.
Visible-Surface Detection Methods. To identify those parts of a scene that are visible from a chosen viewing position. Surfaces which are obscured by.
OpenGL LAB III.
Outline 3D Viewing Required readings: HB 10-1 to 10-10
CS 445 / 645 Introduction to Computer Graphics Lecture 21 Visibility Visibility.
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.
Visible Surface Detection
Rendering Pipeline Fall, 2015.
CSC418 Computer Graphics Back Faces Visibility Algorithms.
Computer Graphics Shading in OpenGL
CSCE 441 Computer Graphics 3-D Viewing
Implementation I Ed Angel
CSCE 441: Computer Graphics Hidden Surface Removal
A Photograph of two papers
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016
Visibility: Z Buffering Week 10, Mon 3 Nov 2003
Chapter V Vertex Processing
Viewing (Projections)
Interactive Computer Graphics Viewing
Implementation I Ed Angel Professor Emeritus of Computer Science
Presentation transcript:

Computer Graphics Zhen Jiang West Chester University

Topics Projection Visibility

Projection Film Plane Pinhole Multiple rays of projection

Projection Film Plane Pinhole One ray of projection

Projection Field of View Film Plane Field of View Pinhole Focal Length

Projection Film Plane Field of View Pinhole Focal Length

Projection Varying distance to film plane What does this do? Varying distance to film plane What does this do? Film Plane d1d1 Field of View Pinhole d2d2

Projection We use –Center of Projection (COP) –Projection Plane We use –Center of Projection (COP) –Projection Plane COP Projection Plane

Projection Perspective vs. Orthographic Views Perspective When COP at infinity, Orthographic View

Projection One-point Perpective –One Vanishing Point Two-point Perspective –Two Vanishing Points One-point Perpective –One Vanishing Point Two-point Perspective –Two Vanishing Points

Projection Our camera must model perspective

Projection How tall should this bunny be? COP Projection Plane

Projection d P (x, y, z)X Z View plane (0,0,0)x’ = ?

Projection Desired result for a point [x, y, z, 1]T projected onto the view plane: What could a matrix look like to do this? Desired result for a point [x, y, z, 1]T projected onto the view plane: What could a matrix look like to do this?

Projection

Projection Example: Or, in 3-D coordinates: Example: Or, in 3-D coordinates:

Projection Orthographic Camera Projection Orthographic Camera Projection

Projection glFrustum – for perspective projections –xmin –xmax –ymin –ymax –near –far glFrustum – for perspective projections –xmin –xmax –ymin –ymax –near –far –Camera looks along –z –min/max need not be symmetric about any axis –near and far planes are parallel to plane z=0 –Camera looks along –z –min/max need not be symmetric about any axis –near and far planes are parallel to plane z=0

Projection gluPerspective – for perspective projections –fovy –aspect –near –far gluPerspective – for perspective projections –fovy –aspect –near –far –fovy is the angle between top and bottom of viewing volume –aspect is ratio of width over height –This volume is symmetrical –View plane is parallel to camera –fovy is the angle between top and bottom of viewing volume –aspect is ratio of width over height –This volume is symmetrical –View plane is parallel to camera

Projection glOrtho – for orthographic projections –left –right –bottom –top –near –far glOrtho – for orthographic projections –left –right –bottom –top –near –far –(left, bottom) and (right, top) define dimensions of projection plane –near and far used to clip –(left, bottom) and (right, top) define dimensions of projection plane –near and far used to clip

Visibility Why might a polygon be invisible? –Polygon outside the field of view –Polygon is backfacing –Polygon is occluded by object(s) nearer the viewpoint For efficiency reasons, we want to avoid spending work on polygons outside field of view or backfacing For efficiency and correctness reasons, we need to know when polygons are occluded Why might a polygon be invisible? –Polygon outside the field of view –Polygon is backfacing –Polygon is occluded by object(s) nearer the viewpoint For efficiency reasons, we want to avoid spending work on polygons outside field of view or backfacing For efficiency and correctness reasons, we need to know when polygons are occluded

Visibility Remove polygons entirely outside frustum –Note that this includes polygons “behind” eye (actually behind near plane) Pass through polygons entirely inside frustum Modify remaining polygons to include only portions intersecting view frustum Remove polygons entirely outside frustum –Note that this includes polygons “behind” eye (actually behind near plane) Pass through polygons entirely inside frustum Modify remaining polygons to include only portions intersecting view frustum

Visibility Most objects in scene are typically “solid” More rigorously: compact, orientable manifolds –Must not cut through itself –Must have two distinct sides A sphere is orientable since it has two sides, 'inside' and 'outside'. A Mobius strip or a Klein bottle is not orientable –Cannot “walk” from one side to the other A sphere is a closed manifold whereas a plane is not Most objects in scene are typically “solid” More rigorously: compact, orientable manifolds –Must not cut through itself –Must have two distinct sides A sphere is orientable since it has two sides, 'inside' and 'outside'. A Mobius strip or a Klein bottle is not orientable –Cannot “walk” from one side to the other A sphere is a closed manifold whereas a plane is not

Visibility For most interesting scenes, some polygons will overlap: To show the correct image, we need to determine which polygons occlude which For most interesting scenes, some polygons will overlap: To show the correct image, we need to determine which polygons occlude which

Visibility Simple approach: display the polygons from back to front, “painting over” previous polygons: –Draw blue, then green, then orange Will this work in the general case? Simple approach: display the polygons from back to front, “painting over” previous polygons: –Draw blue, then green, then orange Will this work in the general case?

Visibility Intersecting polygons present a problem Even non-intersecting polygons can form a cycle with no valid visibility order: Intersecting polygons present a problem Even non-intersecting polygons can form a cycle with no valid visibility order:

Visibility Early visibility algorithms computed the set of visible polygon fragments directly, then showed the fragments to a display:

Visibility So, for about a decade (late 60s to late 70s) there was intense interest in finding efficient algorithms for hidden surface removal Examples: –Binary Space-Partition (BSP) Trees –The Z-buffer Algorithm So, for about a decade (late 60s to late 70s) there was intense interest in finding efficient algorithms for hidden surface removal Examples: –Binary Space-Partition (BSP) Trees –The Z-buffer Algorithm

Visibility We know how to rasterize polygons into an image discretized into pixels:

Visibility What happens if multiple primitives occupy the same pixel on the screen? Which is allowed to paint the pixel?

Visibility Simple!!! Easy to implement in hardware Polygons can be processed in arbitrary order Easily handles polygon interpenetration Simple!!! Easy to implement in hardware Polygons can be processed in arbitrary order Easily handles polygon interpenetration

Visibility Lots of memory (e.g. 1280x1024x32 bits) –With 16 bits cannot discern millimeter differences in objects at 1 km distance Read-Modify-Write in inner loop requires fast memory Hard to do analysisi –We don’t know which polygon to map pixel back to Shared edges are handled inconsistently –Ordering dependent Hard to simulate translucent polygons –We throw away color of polygons behind closest one Lots of memory (e.g. 1280x1024x32 bits) –With 16 bits cannot discern millimeter differences in objects at 1 km distance Read-Modify-Write in inner loop requires fast memory Hard to do analysisi –We don’t know which polygon to map pixel back to Shared edges are handled inconsistently –Ordering dependent Hard to simulate translucent polygons –We throw away color of polygons behind closest one