CSCE 441: Computer Graphics Hidden Surface Removal

Slides:



Advertisements
Similar presentations
Visible-Surface Detection(identification)
Advertisements

Computer Graphics Inf4/MSc 28/10/08Lecture 91 Computer Graphics Lecture 9 Visible Surface Determination Taku Komura.
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.
David Luebke5/11/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
Lecture Fall 2001 Visibility Back-Face Culling Painter’s Algorithm.
Hidden Surface Removal CSE 581. Visibility Assumption: All polygons are opaque What polygons are visible with respect to your view frustum?  Outside:
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.
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.
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.
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.
Now Playing: Big Bird Eddie Floyd from The Complete Stax-Volt Singles Volume 1 ( ) Released April 30, 1991.
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.
Hidden Surface Removal
10/29/02 (c) 2002 University of Wisconsin, CS559 Today Hidden Surface Removal Exact Visibility.
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.
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.
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.
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
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 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.
Visible Surface Detection
Computer Graphics Implementation II
Visibility Week 9, Fri 31 Oct 2003
Solid Area Scan Conversion or Visible Surface Detection
Hidden Surface Removal
CSC418 Computer Graphics Back Faces Visibility Algorithms.
CSCE 441: Computer Graphics Hidden Surface Removal (Cont.)
Visible-Surface Detection Methods
© University of Wisconsin, CS559 Fall 2004
Hidden Surfaces Dr. Scott Schaefer.
Graphics Pipeline Hidden Surfaces
3D Rendering Pipeline Hidden Surface Removal 3D Primitives
Implementation II Ed Angel Professor Emeritus of Computer Science
Visibility: Z Buffering Week 10, Mon 3 Nov 2003
Hidden Surfaces II Week 9, Mon Mar 15
Visibility (hidden surface removal)
CSCE 441: Computer Graphics Hidden Surface Removal (Cont.)
Hidden Surface Removal
CSCE 441: Computer Graphics Hidden Surface Removal (Cont.)
Introduction to Computer Graphics with WebGL
The Framebuffer 1 Lecture 37 Fri, Nov 30, 2007.
Hidden Surface Removal
Implementation II Ed Angel Professor Emeritus of Computer Science
Visible-Surface Determination
Presentation transcript:

CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai

Review: 3D Geometry Pipeline Object space World space View space Normalized project space Image space 2

3D Rendering Pipeline Modeling transformation lighting Viewing transformation Project transformation Clipping Scan conversion Image

3D Rendering Pipeline Modeling transformation lighting Transform into 3D world system Illuminate according to lighting and reflectance lighting Transform into 3D camera coordinate system Viewing transformation Transform into 3D normalized project space Project transformation Clipping Clip primitives outside camera’s view Draw pixels (includes texturing, hidden surface, etc.) Scan conversion Image

Normalized project space 3D Geometry Pipeline Object space World space View space Normalized project space Image space 5

Hidden Surface Removal

Hidden Surfaces

Hidden Surfaces

Hidden Surfaces is the process used to determine which surfaces and parts of surfaces are not visible from a certain viewpoint

Polygon Mesh Representation

Hidden Surfaces Removal The goal is to determine which surfaces and parts of surfaces are not visible from a certain viewpoint A.K.A occlusion culling or visible surface determination

Outline Backface Culling Painter’s algorithm BSP Z-buffer Ray casting Required reading: section 16-1 to 16-11

Normalized project space Backface Culling Normalized project space

Normalized project space Backface Culling Normalized project space view direction

Normalized project space Backface Culling Normalized project space view direction

Backface Culling view direction

Backface Culling , draw polygon view direction

Backface Culling , cull polygon view direction

Backface Culling Is this all we have to do?

Backface Culling Is this all we have to do? No! Can still have 2 (or more) front faces that map to the same screen pixel

Backface Culling Is this all we have to do? No! Can still have 2 (or more) front faces that map to the same screen pixel Which actually gets drawn?

Backface Culling Advantages Improves rendering speed by removing roughly half of polygons from scan conversion Disadvantages Assumes closed surface with consistently oriented polygons NOT a true hidden surface algorithm!!!

Painter’s Algorithm Basic idea: similar to oil painting - draw background first - then most distant object - then nearer object - and so forth

Painter’s Algorithm Sort polygons according to distance from viewer Draw from back (farthest) to front (nearest) - the entire object Near objects will overwrite farther ones

Painter’s Example Sort by depth: Green rect Red circle Blue tri z = 0.7 z = 0.3 z = 0.1 Sort by depth: Green rect Red circle Blue tri z = 0

Painter’s Algorithm Does anyone see a problem with this?

Painter’s Algorithm Does anyone see a problem with this? - Objects can have a range of depth, not just a single value - Need to make sure they don’t overlap for this algorithm to work

Painter’s Algorithm Does anyone see a problem with this? - Objects can have a range of depth, not just a single value - Need to make sure they don’t overlap for this algorithm to work

Painter’s Algorithm Sort all objects’ zmin and zmax

Painter’s Algorithm Sort all objects’ zmin and zmax If an object is uninterrupted (its zmin and zmax are adjacent in the sorted list), it is fine

Painter’s Algorithm Sort all objects’ zmin and zmax If an object is uninterrupted (its zmin and zmax are adjacent in the sorted list), it is fine If 2 objects DO overlap 3.1 Check if they overlap in x - If not, they are fine 3.2 Check if they overlap in y - If yes, need to split one

Painter’s Algorithm The splitting step is the tough one - Need to find a plane to split one polygon so that each new polygon is entirely in front of or entirely behind the other - Polygons may actually intersect, so then need to split each polygon by the other

Painter’s Algorithm The splitting step is the tough one - Need to find a plane to split one polygon so that each new polygon is entirely in front of or entirely behind the other - Polygons may actually intersect, so then need to split each polygon by the other After splitting, you can resort the list and should be fine

Painter’s Algorithm-Summary Advantages - Simple algorithm for ordering polygons Disadvantages - Splitting is not an easy task - Sorting can also be expensive - Redraws same pixel many times

Binary Space Partitioning Trees Basic principle: Objects in the half space opposite of the viewpoint do not obscure objects in the half space containing the viewpoint; thus, one can safely render them without covering foreground objects 6 4 5 7 1 3 2

Binary Space Partitioning Trees Basic principle: Objects in the half space opposite of the viewpoint do not obscure objects in the half space containing the viewpoint; thus, one can safely render them without covering foreground objects - 6 + 4 5 7 1 3 2

Binary Space Partitioning Trees Basic principle: Objects in the half space opposite of the viewpoint do not obscure objects in the half space containing the viewpoint; thus, one can safely render them without covering foreground objects - 6 + 4 5 7 If we want to draw 5 correctly - we need draw 6 and 7 first, - then draw 5, - then draw 1,2,3,4 1 3 2

Binary Space Partitioning Trees Basic principle: Objects in the half space opposite of the viewpoint do not obscure objects in the half space containing the viewpoint; thus, one can safely render them without covering foreground objects - 6 + 4 5 7 If we want to draw 5 correctly - we need draw 6 and 7 first, - then draw 5, - then draw 1,2,3,4 1 3 2 We need to do this for every polygon Can we do this more efficiently?

Binary Space Partitioning Trees Basic principle: Objects in the half space opposite of the viewpoint do not obscure objects in the half space containing the viewpoint; thus, one can safely render them without covering foreground objects - 6 + 4 5 7 If we want to draw 5 correctly - we need draw 6 and 7 first, - then draw 5, - then draw 1,2,3,4 1 3 2 We need to do this for every polygon Can we do this more efficiently? BSP tree

Binary Space Partition Trees BSP tree: organize all of space (hence partition) into a binary tree - Preprocess: overlay a binary tree on objects in the scene - Runtime: correctly traversing this tree enumerates objects from back to front // similar to painter’s algorithm - Idea: divide space recursively into half-spaces by choosing splitting planes Splitting planes can be arbitrarily oriented

Binary Space Partition Trees (1979) BSP tree: organize all of space (hence partition) into a binary tree - Preprocess: overlay a binary tree on objects in the scene - Runtime: correctly traversing this tree enumerates objects from back to front - Idea: divide space recursively into half-spaces by choosing splitting planes Splitting planes can be arbitrarily oriented

BSP Trees: Objects 9 8 6 7 5 4 1 2 3

BSP Trees: Objects 9 - 8 6 7 + 5 4 1 2 3

BSP Trees: Objects + - - + Put front objects in the left branch 9 8 6 7 + 1 2 3 4 5 6 7 8 9 5 4 1 2 3

BSP Trees: Objects + - - + + - Put front objects in the left branch 9 8 6 7 + 1 2 3 4 5 6 7 8 9 + - 5 4 ? ? 1 2 3

BSP Trees: Objects + - - + + - Put front objects in the left branch 9 8 6 7 + 5 6 7 8 9 + - 5 4 1 2 3 4 4 1 2 3

BSP Trees: Objects + - - + + - + - Put front objects in the left branch + - 9 - 8 6 7 + 5 6 7 8 9 + - + - 5 4 1 2 3 4 4 ? ? 9 1 2 3

BSP Trees: Objects + - + - + - Put front objects in the left branch 9 8 6 7 + - + - 5 4 1 2 3 4 5 6 7 8 9 1 2 3

BSP Trees: Objects + - + - + - + - + - + - Put front objects in the left branch + - 9 8 6 7 + - + - 5 4 1 + - + - + - 1 2 3 2 4 3 5 6 7 9 8

BSP Trees: Objects + - + - + - + - + - + - + - + - Put front objects in the left branch + - 9 8 6 7 + - + - 5 4 1 + - + - + - 1 2 3 3 5 6 8 + 2 - 6 + - 2 4 7 9

BSP Trees: Objects + - + - + - + - + - + - + - + - Put front objects in the left branch + - 9 8 6 7 + - + - 5 4 1 + - + - + - 1 2 3 3 5 6 8 + 2 - 6 + - 2 4 7 9 When to stop the recursion?

Object Splitting No bunnies were harmed in my example But what if a splitting plane passes through an object?

Object Splitting No bunnies were harmed in my example But what if a splitting plane passes through an object? - Split the object; give half to each node: Ouch

Polygons: BSP Tree Construction Split along the plane containing any polygon Classify all polygons into positive or negative half-space of the plane If a polygon intersects plane, split it into two Recurse down the negative half-space Recurse down the positive half-space

Binary Space Partition Trees (1979) BSP tree: organize all of space (hence partition) into a binary tree - Preprocess: overlay a binary tree on objects in the scene - Runtime: correctly traversing this tree enumerates objects from back to front - Idea: divide space recursively into half-spaces by choosing splitting planes Splitting planes can be arbitrarily oriented

BSP Trees: Objects + - + - + - + - + - + - + - + - Correctly traversing this tree enumerates objects from back to front + - 9 8 6 7 + - + - 5 4 1 + - + - + - 1 2 3 3 5 6 8 + 2 - 6 + - 2 4 7 9 Traversal order?

BSP Trees: Objects + - + - + - + - + - + - + - + - Correctly traversing this tree enumerates objects from back to front + - 9 8 6 7 + - + - 5 4 1 + - + - + - 1 2 3 3 5 6 8 + 2 - 6 + - 2 4 7 9 Traversal order: 8

BSP Trees: Objects + - + - + - + - + - + - + - + - Correctly traversing this tree enumerates objects from back to front + - 9 8 6 7 + - + - 5 4 1 + - + - + - 1 2 3 3 5 6 8 + 2 - 6 + - 2 4 7 9 Traversal order: 8->9

BSP Trees: Objects + - + - + - + - + - + - + - + - Correctly traversing this tree enumerates objects from back to front + - 9 8 6 7 + - + - 5 4 1 + - + - + - 1 2 3 3 5 6 8 + 2 - 6 + - 2 4 7 9 Traversal order: 8->9->7

BSP Trees: Objects + - + - + - + - + - + - + - + - Correctly traversing this tree enumerates objects from back to front + - 9 8 6 7 + - + - 5 4 1 + - + - + - 1 2 3 3 5 6 8 + 2 - 6 + - 2 4 7 9 Traversal order: 8->9->7->6

BSP Trees: Objects + - + - + - + - + - + - + - + - Correctly traversing this tree enumerates objects from back to front + - 9 8 6 7 + - + - 5 4 1 + - + - + - 1 2 3 3 5 6 8 + 2 - 6 + - 2 4 7 9 Traversal order: 8->9->7->6->5

BSP Trees: Objects + - + - + - + - + - + - + - + - Correctly traversing this tree enumerates objects from back to front + - 9 8 6 7 + - + - 5 4 1 + - + - + - 1 2 3 3 5 6 8 + 2 - 6 + - 2 4 7 9 Traversal order: 8->9->7->6->5->3->4->2->1

Building a BSP Tree for Polygons Choose a splitting polygon Sort all other polygons as Front Behind Crossing On Add “front” polygons to front child, “behind” to back child Split “crossing” polygons with infinite plane Add “on” polygons to root/current node Recur

Building a BSP Tree 6 7 3 5 1 2 4

Building a BSP Tree 6 7 3 5 1 2 4 1 b 2,34,5,6,7

Building a BSP Tree 6 7 3 5 1 2 4 1 b 2,34,5,6,7 How to divide 2,3,4,5,6,7?

Building a BSP Tree 6 7-2 5-2 3 7-1 5-1 1 2 4 1 3 2,4,5-1,7-1 f b 2,4,5-1,7-1 7-2, 6,5-2

Building a BSP Tree 6 7-2 5-2 3 7-1 5-1 1 2 4 1 3 2,4,5-1,7-1 f b 2,4,5-1,7-1 7-2, 6,5-2

Building a BSP Tree 6 7-2 5-2 3 7-1 5-1 1 2 4 1 3 7-1 7-2, 6,5-2 2 f 7-1 b 7-2, 6,5-2 f b 2 4,5-1

Building a BSP Tree 6 7-2 5-2 3 7-1 5-1 1 2 4 1 3 7-2, 6,5-2 7-1 4 2 f b 7-2, 6,5-2 7-1 f b 4 2 b 5-1

Building a BSP Tree 6 7-2 5-2 3 7-1 5-1 1 2 4 1 3 7-1 7-2, 6,5-2 4 2 f b 7-2, 6,5-2 f b 4 2 b 5-1

Building a BSP Tree 6 7-2 5-2 3 7-1 5-1 1 2 4 1 3 7-1 7-2, 6,5-2 4 2 f b 7-2, 6,5-2 f b 4 2 b 5-1

Building a BSP Tree 6 7-2 5-2 3 7-1 5-1 1 2 4 1 3 7-1 7-2 4 6,5-2 2 f b 7-2 f b b 4 6,5-2 2 b 5-1

Building a BSP Tree 6 7-2 5-2 3 7-1 5-1 1 2 4 1 3 7-1 7-2 4 6 2 5-1 f b 7-2 f b b 4 6 2 b f 5-1 5-2

Building a BSP Tree 6 7-2 5-2 3 7-1 5-1 1 2 4 1 3 7-1 7-2 4 6 2 5-1 f b 7-2 f b b 4 6 2 b f 5-1 5-2

Building a BSP Tree 6 7-2 5-2 3 7-1 5-1 1 2 4 1 3 7-1 7-2 4 6 2 5-1 f b 7-2 f b b 4 6 2 b f 5-1 5-2

Rendering with a BSP Tree 6 7-2 5-2 3 7-1 5-1 1 2 4 1 b 3 7-1 f b How to traverse the tree? 7-2 f b b 4 6 2 b f 5-1 5-2

Rendering with a BSP Tree 6 7-2 5-2 3 7-1 5-1 1 2 4 1 b 3 7-1 f b How to traverse the tree? - draw “back” polygons - draw “on” polygons - draw “front” polygons 7-2 f b b 4 6 2 b f 5-1 5-2

Rendering with a BSP Tree 6 7-2 5-2 3 7-1 5-1 1 2 4 1 b 3 7-1 f b 7-2 f b b 4 6 2 b f Traversal order: 5-1 5-2

Rendering with a BSP Tree 6 7-2 5-2 3 7-1 5-1 1 2 4 1 b 3 7-1 f b 7-2 f b b 4 6 2 b f Traversal order: 6 5-1 5-2

Rendering with a BSP Tree 6 7-2 5-2 3 7-1 5-1 1 2 4 1 b 3 7-1 f b 7-2 f b b 4 6 2 b f Traversal order: 6->(5-2) 5-1 5-2

Rendering with a BSP Tree 6 7-2 5-2 3 7-1 5-1 1 2 4 1 b 3 7-1 f b 7-2 f b b 4 6 2 b f Traversal order: 6->(5-2)->(7-2) 5-1 5-2

Rendering with a BSP Tree 6 7-2 5-2 3 7-1 5-1 1 2 4 1 b 3 7-1 f b 7-2 f b b 4 6 2 b f Traversal order: 6->(5-2)->(7-2)->3 5-1 5-2

Rendering with a BSP Tree 6 7-2 5-2 3 7-1 5-1 1 2 4 1 b 3 7-1 f b 7-2 f b b 4 6 2 b f Traversal order: 6->(5-2)->(7-2)->3->(5-1) 5-1 5-2

Rendering with a BSP Tree 6 7-2 5-2 3 7-1 5-1 1 2 4 1 b 3 7-1 f b 7-2 f b b 4 6 2 b f Traversal order: 6->(5-2)->(7-2)->3->(5-1)->4->(7-1)->2->1 5-1 5-2

Rendering with a BSP Tree Interpret the tree relative the position of the viewpoint How to traverse the tree Draw “back” polygons Draw “on” polygons Draw “front” polygons 1 b 3 7-1 f b 7-2 f b b 4 6 2 b f 5-1 5-2

Different View Points? 6 7-2 5-2 3 7-1 5-1 1 2 4 1 1 3 7-1 b 3 7-1 f b Do we need to build a new tree? 7-2 f b b 4 6 2 b f 5-1 5-2

Different View Points? 6 7-2 5-2 3 7-1 5-1 1 2 4 1 1 3 7-1 b 3 7-1 f b Do we need to build a new tree? - No, we use the same tree if objects are static 7-2 f b b 4 6 2 b f 5-1 5-2

Different View Points? 6 7-2 5-2 3 7-1 5-1 1 2 4 1 1 3 7-1 b 3 7-1 f b Do we need to build a new tree? - No, we use the same tree if objects are static How can we traverse the tree? 7-2 f b b 4 6 2 b f 5-1 5-2

Rendering with a BSP Tree If eye is in front of plane Draw “back” polygons Draw “on” polygons Draw “front” polygons If eye is behind plane Else eye is on plane - 6 + 4 5 7 1 3 2 Stop here. 5 f b 1,2,3,4 6,7

Rendering with a BSP Tree If eye is in front of plane Draw “back” polygons Draw “on” polygons Draw “front” polygons If eye is behind plane Else eye is on plane - 6 + 4 5 7 1 3 2 5 f b 1,2,3,4 6,7

Rendering with a BSP Tree If eye is in front of plane Draw “back” polygons Draw “on” polygons Draw “front” polygons If eye is behind plane Else eye is on plane - 6 + 4 5 7 1 3 2 5 f b 1,2,3,4 6,7

Different View Points? - + 6 7-2 5-2 3 7-1 5-1 1 2 4 1 3 7-1 7-2 4 6 b 3 + 7-1 f b 7-2 f b b 4 6 Traversal order: 2 b f 5-1 5-2

Different View Points? 6 7-2 5-2 3 7-1 5-1 1 2 4 1 3 7-1 7-2 4 6 b 3 7-1 f b 7-2 f b b 4 6 Traversal order: 1 2 b f 5-1 5-2

Different View Points? - + 6 7-2 5-2 3 7-1 5-1 1 2 4 1 3 7-1 7-2 4 6 b 3 7-1 f b 7-2 f b b 4 6 Traversal order: 1 2 b f 5-1 5-2

Different View Points? - + 6 7-2 5-2 3 7-1 5-1 1 2 4 1 3 7-1 7-2 4 6 b 3 7-1 f b 7-2 f b b 4 6 Traversal order: 1 2 b f 5-1 5-2

Different View Points? - + 6 7-2 5-2 3 7-1 5-1 1 2 4 1 3 7-1 7-2 4 6 b 3 7-1 f b 7-2 f b b 4 6 Traversal order: 1->2 2 b f 5-1 5-2

Different View Points? - + 6 7-2 5-2 3 7-1 5-1 1 2 4 1 3 7-1 7-2 4 6 b 3 7-1 f b 7-2 f b b 4 6 Traversal order: 1->2->(7-1) 2 b f 5-1 5-2

Different View Points? - + 6 7-2 5-2 3 7-1 5-1 1 2 4 1 3 7-1 7-2 4 6 b 3 7-1 f b 7-2 f b b 4 6 Traversal order: 1->2->(7-1)->4 2 b f 5-1 5-2

Different View Points? - + 6 7-2 5-2 3 7-1 5-1 1 2 4 1 3 7-1 7-2 4 6 b 3 7-1 f b 7-2 f b b 4 6 Traversal order: 1->2->(7-1)->4->(5-1) 2 b f 5-1 5-2

Different View Points? 6 7-2 5-2 3 7-1 5-1 1 2 4 1 3 7-1 7-2 4 6 b 3 7-1 f b 7-2 f b b 4 6 Traversal order: 1->2->(7-1)->4->(5-1)->3 2 b f 5-1 5-2

Different View Points? 6 7-2 5-2 3 7-1 5-1 1 2 4 1 3 7-1 7-2 4 6 b 3 7-1 f b 7-2 f b b 4 6 Traversal order: 1->2->(7-1)->4->(5-1)->3->(7-2)->(5-2)->6 2 b f 5-1 5-2

Rendering with a BSP Tree 6 7-2 5-2 3 7-1 5-1 1 2 4 1 1 b f 3 7-1 b 7-2 f b 4 b 6 2 b f Traversal order? 5-1 5-2

Rendering with a BSP Tree 6 7-2 5-2 3 7-1 5-1 1 2 4 1 - 1 b f 3 + 7-1 b 7-2 f b 4 b 6 2 b f Traversal order? Traversal order? 1 5-1 5-2

Rendering with a BSP Tree 6 7-2 5-2 3 7-1 5-1 1 2 4 1 - 1 b f 3 + 7-1 b 7-2 f b 4 b 6 2 b f Traversal order? Traversal order? 1->? 5-1 5-2

Rendering with a BSP Tree 6 - 7-2 5-2 3 7-1 5-1 + 1 2 4 1 1 b f 3 7-1 b 7-2 f b 4 b 6 2 b f Traversal order? 1->? Traversal order? 5-1 5-2

Rendering with a BSP Tree + - 6 7-2 5-2 3 7-1 5-1 1 2 4 1 1 b f 3 7-1 b 7-2 f b 4 b 6 2 b f Traversal order? 1->? Traversal order? 5-1 5-2

Rendering with a BSP Tree - 6 + 7-2 5-2 3 7-1 5-1 1 2 4 1 1 b f 3 7-1 b 7-2 f b 4 b 6 2 b f Traversal order? 1->? Traversal order? 5-1 5-2

Rendering with a BSP Tree - 6 + 7-2 5-2 3 7-1 5-1 1 2 4 1 1 b f 3 7-1 b 7-2 f b 4 b 6 2 b f Traversal order? 1->6 Traversal order? 5-1 5-2

Rendering with a BSP Tree 6 7-2 5-2 3 7-1 5-1 1 2 4 1 1 b f 3 7-1 b 7-2 f b 4 b 6 2 b f Traversal order? Traversal order? 1->6->? 5-1 5-2

Rendering with a BSP Tree 6 7-2 5-2 3 7-1 5-1 1 2 4 1 1 b f 3 7-1 b 7-2 f b 4 b 6 2 b f Traversal order? 1->6->5-2 5-1 5-2

Rendering with a BSP Tree 6 7-2 5-2 3 7-1 5-1 1 2 4 1 1 b f 3 7-1 b 7-2 f b 4 b 6 2 b f Traversal order? 1->6->(5-2)->(7-2)->3->4->(5-1)->(7-1)->2 5-1 5-2

Improved BSP Rendering Take advantage of view direction to cull away polygons behind viewer

Improved BSP Rendering Take advantage of view direction to cull away polygons behind viewer View frustum

Improved BSP Rendering Take advantage of view direction to cull away polygons behind viewer

Summary: BSP Trees Pros: Simple, elegant scheme No depth comparisons needed Polygons split and ordered automatically Works for moving cameras Only writes to framebuffer (i.e., painters algorithm)

Summary: BSP Trees 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 Redraws same pixel many times Choosing splitting plane not an exact science Not suitable for moving objects

Outline Backface Culling Painter’s algorithm BSP Z-buffer Ray casting Reading: section 16-1 to 16-11