Visibility in Computer Graphics Toni Sellarès Unversitat de Girona

Slides:



Advertisements
Similar presentations
Computer Graphics - Rasterization -
Advertisements

CSC418 Computer Graphics n Polygon normals n Back Faces n Visibility Algorithms.
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Computer Graphics Inf4/MSc Computer Graphics Lecture 9 Visible Surface Determination.
David Luebke5/11/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
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.
Hidden Surface Removal Why make the effort?  Realistic models.  Wasted time drawing. OpenGL and HSR  OpenGL does handle HSR using the depth buffer.
CHAPTER 12 Height Maps, Hidden Surface Removal, Clipping and Level of Detail Algorithms © 2008 Cengage Learning EMEA.
Computer Graphics Visible Surface Determination. Goal of Visible Surface Determination To draw only the surfaces (triangles) that are visible, given a.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Hidden Surface Removal 고려대학교 컴퓨터 그래픽스 연구실.
Part I: Basics of Computer Graphics
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.
1 Dr. Scott Schaefer Hidden Surfaces. 2/62 Hidden Surfaces.
Tomas Mőller © 2000 Speeding up your game The scene graph Culling techniques Level-of-detail rendering (LODs) Collision detection Resources and pointers.
Hidden Surface Elimination Wen-Chieh (Steve) Lin Institute of Multimedia Engineering I-Chen Lin’ CG Slides, Rich Riesenfeld’s CG Slides, Shirley, Fundamentals.
1 CSCE 441: Computer Graphics Hidden Surface Removal (Cont.) Jinxiang Chai.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Visibility II Week 7,
Visible-surface Detection Computer Graphics Seminar MUM
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.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Visibility: Z Buffering Week 10, Mon 3 Nov 2003.
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.
Hidden Surface Removal
Visible Surface Determination
Graphics Pipeline Hidden Surfaces CMSC 435/634. Visibility We can convert simple primitives to pixels Which primitives (or parts of primitives) should.
Shadows Computer Graphics. Shadows Shadows Extended light sources produce penumbras In real-time, we only use point light sources –Extended light sources.
The Visibility Problem In many environments, most of the primitives (triangles) are not visible most of the time –Architectural walkthroughs, Urban environments.
Visible-Surface Detection Jehee Lee Seoul National University.
1 Advanced Scene Management. 2 This is a game-type-oriented issue Bounding Volume Hierarchies (BVHs) Binary space partition trees (BSP Trees) “Quake”
Hidden Surface Removal 1.  Suppose that we have the polyhedron which has 3 totally visible surfaces, 4 totally invisible/hidden surfaces, and 1 partially.
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,
1Computer Graphics Implementation II Lecture 16 John Shearer Culture Lab – space 2
Implementation II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Visible-Surface Detection Methods
CS 325 Introduction to Computer Graphics 03 / 22 / 2010 Instructor: Michael Eckmann.
Binary Space Partitioning Trees Ray Casting Depth Buffering
CS 376 Introduction to Computer Graphics 03 / 21 / 2007 Instructor: Michael Eckmann.
Implementation II.
David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
Computer Graphics Zhen Jiang West Chester University.
David Luebke 1 12/8/2015 Visibility CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © Visible Surface Determination (VSD) To render or not to render, that is the question… 1 of.
Where We Stand At this point we know how to: –Convert points from local to window coordinates –Clip polygons and lines to the view volume –Determine which.
Computer Graphics I, Fall 2010 Implementation II.
Honours Graphics 2008 Session 5. Today’s focus Rasterization Visibility determination Coarse / fine visibility determination.
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
CS559: Computer Graphics Lecture 12: Antialiasing & Visibility Li Zhang Spring 2008.
01/28/09Dinesh Manocha, COMP770 Visibility Computations Visible Surface Determination Visibility Culling.
Computer Graphics Inf4/MSc 1 Computer Graphics Lecture 5 Hidden Surface Removal and Rasterization Taku Komura.
Visible surface determination. Problem outline Given a set of 3D objects and a viewing specification, we wish to determine which lines or surfaces are.
Visible-Surface Detection Methods. To identify those parts of a scene that are visible from a chosen viewing position. Surfaces which are obscured by.
Hidden Surface Removal. 2 Goal: Determine which surfaces are visible and which are not. Z-Buffer is just one of many hidden surface removal algorithms.
Lecture 30: Visible Surface Detection
Visible Surface Detection
Computer Graphics Implementation II
Hidden Surfaces Dr. Scott Schaefer.
CSCE 441: Computer Graphics Hidden Surface Removal
Implementation II Ed Angel Professor Emeritus of Computer Science
CSCE 441: Computer Graphics Hidden Surface Removal (Cont.)
Introduction to Computer Graphics with WebGL
Lecture 31: Visible Surface Detection
Implementation II Ed Angel Professor Emeritus of Computer Science
Visible-Surface Determination
Presentation transcript:

Visibility in Computer Graphics Toni Sellarès Unversitat de Girona

Visibility Two points of a scene are mutually visible if the line segment connecting them is unoccluded.

Visibility Visibility problems can be classified based on the problem domain

Visibility taxonomy (*) 1. visibility along a line 2. visibility from a point 3. visibility from a line segment 4. visibility from a polygon 5. visibility from a region 6. global visibility (*) J. Bittner, P. Wonka, Visibility in Computer Graphics, Journal of Environment and Planning B: Planning and Design, vol. 30. no. 5, pp 729 – 725, 2003

Visibility along a single line All visual events restricted to a single line. The visibility along a line problems can be solved by computing intersections of the given line with the scene objects.

Visibility along a single line Point-to-point visibility determines whether the line segment between two points is unoccluded, i.e. the line segment has no intersection with an object in the scene. Ray shooting: given a ray, determine the first intersection of the ray with a scene object.

Visibility from a point Is the classical visible surface determination problem. Due to its importance for image synthesis, visible surface determination (hidden-surface removal) covers the majority of existing visibilty algorithms in computer graphics.

Visibility from a region Is a most general problem. Region-to-region visibility problem determines if the two given regions in the scene are mutually visible, invisible or partially visible. Other examples: potentially visible sets, aspect graph, 3D visibility complex

Hidden-surface removal When a 3-dimensional scene description is transformed to screen coordinates by a projection transformation, more than one object may overlap the same sample in the image. Some method is needed to determine which is the visible one, so that pixels can be shaded appropriately.

Object-Space Methods Use geometric tests on the object descriptions to determine which objects overlap and where. Object space algorithms are O(n2) where n is the number of objects in the scene. Complexity of algorithms is high, few primitives are supported, and special effects often are difficult to implement Examples: painter's algorithms, depth-sorting, BSP

Image-Space Methods Many approaches take advantage of the discretized nature of the output image, computing visibility only to the precision required to decide what is visible at a particular pixel. Image space algorithms are O(nN) where n is the number of objects in the scene and N is the number of pixels. Allow more advanced effects and complex models. Examples: z-buffer, Watkin's, ray-casting

Why might a polygon (face) be invisible ? Polygon outside the field of view Polygon is backfacing Polygon is occluded by object(s) nearer the viewpoint We want to avoid spending work on polygons outside field of view or backfacing We need to know when polygons are occluded

Frustun culling Quickly reject what is not visible Conservative: never classify a visible scene element as invisible Reduce unecessary processing

Hierarchical Frustum Culling bouding volume hierarchy scene elements

Hierarchical Frustum Culling bouding volume hierarchy A B D C view frustum

Backface Removal (Backface Culling) Removes entire polygons that face away from the viewer If we are dealing with a single convex object, culling completely solves the hidden surface problem   Geometric test for the visibility

Note: backface culling alone doesn’t solve the hidden-surface problem! On the surface of an object, polygons whose normals point away from the camera are always occluded: Note: backface culling alone doesn’t solve the hidden-surface problem!

Not rendering backfacing polygons improves performance Back-Face Culling Not rendering backfacing polygons improves performance Reduces by about half the number of polygons to be considered for each pixel

Occlusion For most scenes, some polygons will overlap: To render the correct image, we need to determine which polygons occlude which

Conservative occlusion testing If the box representing a node is not visible then nothing in it is either The faces of the box are projected onto the image plane and tested for occlusion occluder hierarchical representation

Testing a Node for Occlusion If the box representing a node is not visible then nothing in it is either The faces of the box are projected onto the image plane and tested for occlusion occluder hierarchical representation

Occlusion Removal Algorithms Painter’s Algorithm Hybrid BSP tree Algorithm Hybrid Z-Buffer Algorithm Image-space Ray-Casting Algorithm Object-space

Painter's Algorithm Sort all polygons according to the (farthest) z coordinates of each, When the polygon's z extents overlap, resolve the sorting ambiguities by splitting the polygons Draw (fill) the polygons in the sorted order back to front Also known as Depth-sort algorithm.

Painter's Algorithm Does polygon P obscures polygon Q? Do the polygons' x extents overlap? Do the polygons' y extents overlap? Is P entirely on the opposite side of Q's plane from the viewpoint? Is Q entirely on the same side of P's plane from the viewpoint? Do the projections of the polygons onto screen not overlap?

Painter’s Algorithm Some cases in which Z extents of polygons overlap

Binary Space Partitioning Tree Algorithm Very efficient for a static group of 3D polygons as seen from an arbitrary viewpoint Correct order for Painter’s algorithm is determined by a suitable traversal of the binary tree of polygons: BSP Tree

BSP Tree

BSP Tree A B C

BSP Tree Draw BSP Tree function draw(bsptree tree, point eye) if tree.empty then return if ftree.root(eye) < 0 draw (tree.right) rasterize(tree.root) draw(tree.left) else draw (tree.left) draw(tree.right) tree.root tree.left tree.right

BSP Tree rasterize(C) rasterize(B) rasterize(A) rasterize(A)

BSP Tree Code works for any view Tree can be pre-computed Requires evaluation of fplane of the triangle(eye)

BSP Tree Construction The binary tree is constructed using the following principle: For each polygon, we can divide the set of other polygons into two groups One group contains those lying in front of the plane of the given polygon The other group contains those in the back The polygons intersecting the plane of the given polygon are split by that plane

Summary: BSP Trees Pros: Cons: Simple, elegant scheme Only writes to framebuffer (i.e., painters algorithm) Thus very popular for video games (but getting less so) Cons: Computationally intense preprocess stage restricts algorithm to static scenes Worst-case time to construct tree: O(n3) Splitting increases polygon count Again, O(n3) worst case

Z-Buffer Algorithm Color values are stored in a frame buffer. We also need a z-buffer, of the same size as the frame buffer, to store z value of each image pixel. Frame-Buffer Z-Buffer

Z-Buffer Algorithm -far -far -far Key Observation: Each pixel displays color of only one polygon, ignores everything behind it. Don’t need to sort polygons, just find for each pixel the closest triangle. Z-buffer: one fixed or floating point value per pixel. -far -far -far -far -far -far -far -far -far zbuffer framebuffer 35

Z-Buffer Algorithm -far -.1 -.2 Key Observation: Each pixel displays color of only one polygon, ignores everything behind it. Don’t need to sort polygons, just find for each pixel the closest triangle. Z-buffer: one fixed or floating point value per pixel. -.3 -.4 -.5 -.6 -.7 -.8 -far -far -far zbuffer framebuffer 36

Z-Buffer Algorithm -far -.1 -.2 Key Observation: Each pixel displays color of only one polygon, ignores everything behind it. Don’t need to sort polygons, just find for each pixel the closest triangle. Z-buffer: one fixed or floating point value per pixel. -.3 -.4 -.3 -.1 -.7 -.8 -far -far -far zbuffer framebuffer 37

Z-Buffer Algorithm -far -.1 -.2 Key Observation: Each pixel displays color of only one polygon, ignores everything behind it. Don’t need to sort polygons, just find for each pixel the closest triangle. Z-buffer: one fixed or floating point value per pixel. -.3 -.4 -.3 -.1 -.7 -.8 -far -far -far zbuffer framebuffer 38

Z-Buffer Pseudo-code For each rasterized fragment (x,y) If z > zbuffer(x,y) then framebuffer(x,y) = fragment color zbuffer(x,y) = z

Ray Casting Find nearest surface along the view ray (ray shooting). eye for i = 0 to nRows-1 for j = 0 to nCols-1 ray = genRay(eye, pixel(i,j)) castRay(ray)

Ray Casting Cast ray(ray) for every polygon in the scene intersect ray with polygon store the color at point of intersection and the distance from ray origin sort the intersection points according to distance draw_pixel(color)

Ray Casting Find nearest surface along the view ray (ray shooting). eye for i = 0 to nRows-1 for j = 0 to nCols-1 ray = genRay(eye, pixel(i,j)) castRay(ray)

Ray Casting V eye W U

Ray Casting V U eye W