Hidden Surface Removal Why make the effort?  Realistic models.  Wasted time drawing. OpenGL and HSR  OpenGL does handle HSR using the depth buffer.

Slides:



Advertisements
Similar presentations
Computer Graphics - Rasterization -
Advertisements

Visible-Surface Detection(identification)
Computer Graphics Inf4/MSc 28/10/08Lecture 91 Computer Graphics Lecture 9 Visible Surface Determination Taku Komura.
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Computer Graphics Inf4/MSc Computer Graphics Lecture 9 Visible Surface Determination.
03/12/02 (c) 2002 University of Wisconsin, CS559 Last Time Some Visibility (Hidden Surface Removal) algorithms –Painter’s Draw in some order Things drawn.
CAP4730: Computational Structures in Computer Graphics Visible Surface Determination.
Visibility in Computer Graphics Toni Sellarès Unversitat de Girona
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
Computer Graphics Viewing.
UBI 516 Advanced Computer Graphics
Course Website: Computer Graphics 15: More Surface Detection Methods.
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.
Computer Graphics 14: Surface Detection Methods
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.
1 Clipping and Hidden Surfaces CS-184: Computer Graphics Prof. James O’Brien.
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.
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.
Graphics Pipeline Hidden Surface CMSC 435/634. Visibility We can convert simple primitives to pixels/fragments How do we know which primitives (or which.
10/29/02 (c) 2002 University of Wisconsin, CS559 Today Hidden Surface Removal Exact Visibility.
CSC418 Computer Graphics n BSP tree n Z-Buffer n A-buffer n Scanline.
Computer Graphics 2 Lecture 8: Visibility Benjamin Mora 1 University of Wales Swansea Pr. Min Chen Dr. Benjamin Mora.
Visible-Surface Detection Jehee Lee Seoul National University.
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.
Chris Mayer & Nic Shulver Hidden Surface Wire frame drawings Wire frame drawings are quick to produce but are often confusing It is difficult to determine.
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.
Hidden Surface Removal
Implementation II.
1 3D Hidden Surface Removal 김 성 남. 2 Contents Goal Motivation Approaches - back face detection - depth buffer - A-buffer - Scan line - Depth.
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.
Presented by: Bhavna Agarwal. Given a bunch of 3D objects predefined in x,y,z; order them in geometry.
Computer Graphics I, Fall 2010 Implementation II.
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.
1 Computer Graphics Week11 : Hidden Surface Removal.
Learning Objectives Classification of Visible Surface Detection Algorithms Classification of Visible Surface Detection Algorithms Back-Face Detection Back-Face.
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
(c) 2002 University of Wisconsin, CS559
Hidden Surfaces Dr. Scott Schaefer.
© University of Wisconsin, CS559 Spring 2004
CSCE 441: Computer Graphics Hidden Surface Removal
3D Rendering Pipeline Hidden Surface Removal 3D Primitives
Implementation II Ed Angel Professor Emeritus of Computer Science
Hidden Surface Removal
CSCE 441: Computer Graphics Hidden Surface Removal (Cont.)
Introduction to Computer Graphics with WebGL
Implementation II Ed Angel Professor Emeritus of Computer Science
Presentation transcript:

Hidden Surface Removal Why make the effort?  Realistic models.  Wasted time drawing. OpenGL and HSR  OpenGL does handle HSR using the depth buffer. Why find other methods?  Time and space.  Efficiency in specific cases. So what is hidden line removal?

Object versus Image Object Precision  Uses machine precision to compute the coordinates of the visible faces.  Allows for enlargement with accurate results. Image Precision  Per Pixel approach.  Precision is only to the screen coordinate system.

Suggested Code class Face { int Verts; Point* pt; float* depth; Plane plane; Cuboid extent; }

Hidden Line Removal HLR as HSR  Device must allow “Painting over”. Essential considerations  Only need to clip lines against “front” faces.  If the edge belongs to two back faces it is not visible. The rest of HLR is the same as HSR  Except one clips an edge instead of a face.

Finally! Techniques!

Depth-Buffer Pros:  No Sorting  Makes use of depth coherence  Works with many classes of objects  File saving for another session Cons:  Re-draw pixels having to re-do expensive shading calculations  Large memory usage (Precision dependant)

Area Subdivision Method makes use of Area coherence. How does it work?  Divide and conquer.  Terminates on “simple” or too small regions.  Geometry of division is important. Some definitions of “Simple”  Only one face is involved  Empty  Dominating face Vertex Division Geometry  Select a vertex in the region and divide along it.

More HSR Algorithms Algorithms Already Covered  Depth-Buffer  Area Sub-Division Algorithms To Follow  A Scan Line Algorithm = good for static scenes (per pixel tests)  3 List-Priority Algorithms: 1. Heedless Painter = simple but wrong 1. Heedless Painter = simple but wrong 2. Depth-Sort = improvement on painter 2. Depth-Sort = improvement on painter 3. BSP Trees = elegant (dynamic) 3. BSP Trees = elegant (dynamic)

Scan-Line Algorithm 1 Brute Force Algorithm Overview: 1. depth on a per pixel basis. 2. convention – a horizontal scan lines, scanned top to bottom. Brute Force Algorithm Pseudocode: For( each scan line, y){ For( each pixel, x, on scan line y){ For( each pixel, x, on scan line y){ Find the closest face for the pixel at (x,y) Find the closest face for the pixel at (x,y) Set the pixel at (x,y) to the colour of the closest face at (x,y) Set the pixel at (x,y) to the colour of the closest face at (x,y) }}

Scan-Line Algorithm 2 A Faster Algorithm Overview 1. Same as brute force (scan left to right & per pixel basis) 2. But it exploits edge-coherence along the scan-line. 3. An Active-Edge List (AEL) Is constructed AEL stores all the x values at which a given scan-line intersects an edge.

For( each scan line, y){ For( each new AEL x-range){ For( each new AEL x-range){ Find the closest face for the pixel at (x,y) at AEL( i ) Find the closest face for the pixel at (x,y) at AEL( i ) For( x > AEL( i ) and x AEL( i ) and x < AEL( i+1 ) ){ Set the pixel at (x,y) to the colour of the closest face at (x,y) Set the pixel at (x,y) to the colour of the closest face at (x,y) If( at AEL (i+1) closest face != closest face at AEL(i)){ If( at AEL (i+1) closest face != closest face at AEL(i)){ find the x value at which the intersection occurred find the x value at which the intersection occurred Correct the pixels between this and AEL (i+1) Correct the pixels between this and AEL (i+1) } } }} Faster Scan-Line Algorithm Pseudocode:

Heedless Painter Heedless Painter Algorithm Overview 1. Simple but Incorrect. 2. Sorts the array of faces by the depth of its bounding box. 3. Draws from the greatest depth to the closest depth Heedless Painter Algorithm Pseudocode: Sort_By_Descending_Depth( FACES[] ) While( i < number of faces) Draw FACES[ i ]

Problems with the Heedless Painter Algorithm 1. Cant deal with polygon intersections. 2. In general it cant deal with case where the z extent of the bounding boxes intersect. The algorithm draws Polygon 1 first then Polygon 2.

Depth-Sort Algorithm Depth-Sort Algorithm Overview: 1. Similar to Heedless painter but it works. 2. Sorts the array of faces by the depth of its bounding box. 3. Deals with problematic faces, and re-sorts the faces. 4. Draws from the greatest depth to the closest depth It splits the faces until for any pair of faces, one lies either behind or in front of the other (removes intersections).

Sort_By_Descending_Depth( FACES[] ) /* split faces if required and resort FACES[] */ While( i < number of faces){ For( every other FACES[j]){ For( every other FACES[j]){ if(FACES[j] trivially does not obscure FACES[i]) continue //try next face if(FACES[j] trivially does not obscure FACES[i]) continue //try next face /*face either intersects or face is incorrectly hidden by another face*/ /*face either intersects or face is incorrectly hidden by another face*/ if(face j is hidden by face i) { if(face j is hidden by face i) { move face j to the start of the list move face j to the start of the list }else{ }else{ split face j by the plane of face i split face j by the plane of face i insert pieces of j in list } insert pieces of j in list } }} While( i < number of faces) Draw FACES[ i ] Depth-Sort Algorithm Pseudocode:

BSP Tree Algorithm BSP Tree Algorithm Overview: 1. BSP Tree (Binary-Space Partition Tree) 2. Elegant and efficient, especially in dynamic situations. 3. The faces are preprocessed into a binary-tree (each node has 2 children) (each node has 2 children) 4. Some faces are split, and placed in the tree 5. Each node contains a single face 6. The tree is traversed in a particular order, such that HSR is accomplished.