CSCE 441: Computer Graphics Hidden Surface RemovalReview: 3D Geometry Pipeline3D Rendering PipelineSlide 43D Geometry PipelineHidden SurfacesSlide 7Slide 8Polygon Mesh RepresentationHidden Surfaces RemovalOutlineBackface CullingSlide 13Slide 14Slide 15Slide 16Slide 17Slide 18Slide 19Slide 20Slide 21Painter’s AlgorithmSlide 23Painter’s ExampleSlide 25Slide 26Slide 27Slide 28Slide 29Slide 30Slide 31Slide 32Painter’s Algorithm-SummaryBinary Space Partitioning TreesSlide 35Slide 36Slide 37Slide 38Binary Space Partition TreesBinary Space Partition Trees (1979)BSP Trees: ObjectsSlide 42Slide 43Slide 44Slide 45Slide 46Slide 47Slide 48Slide 49Slide 50Object SplittingSlide 52Polygons: BSP Tree ConstructionSlide 54Slide 55Slide 56Slide 57Slide 58Slide 59Slide 60Slide 61Building a BSP Tree for PolygonsBuilding a BSP TreeSlide 64Slide 65Slide 66Slide 67Slide 68Slide 69Slide 70Slide 71Slide 72Slide 73Slide 74Slide 75Rendering with a BSP TreeSlide 77Slide 78Slide 79Slide 80Slide 81Slide 82Slide 83Slide 84Slide 85Different View Points?Slide 87Slide 88Slide 89Slide 90Slide 91Slide 92Slide 93Slide 94Slide 95Slide 96Slide 97Slide 98Slide 99Slide 100Slide 101Slide 102Slide 103Slide 104Slide 105Slide 106Slide 107Slide 108Slide 109Slide 110Slide 111Improved BSP RenderingSlide 113Slide 114Summary: BSP TreesSlide 116Slide 1171CSCE 441: Computer Graphics Hidden Surface RemovalJinxiang Chai2Image spaceReview: 3D Geometry Pipeline2Normalized project spaceView spaceWorld spaceObject space33D Rendering PipelineModeling transformationlightingViewing transformationProject transformationClippingScan conversionImage4Scan conversion3D Rendering PipelineModeling transformationlightingViewing transformationProject transformationClippingImageTransform into 3D world systemIlluminate according to lighting and reflectanceTransform into 3D camera coordinate systemTransform into 3D normalized project spaceClip primitives outside camera’s viewDraw pixels (includes texturing, hidden surface, etc.)5Image space3D Geometry Pipeline5Normalized project spaceView spaceWorld spaceObject space6Hidden Surfaces7Hidden Surfaces8Hidden Surfaces9Polygon Mesh Representation10Hidden Surfaces RemovalThe 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 determination11OutlineBackface CullingPainter’s algorithmBSPScanlineZ-bufferRay castingRequired reading: section 9-1 to 9-1112Backface CullingNormalized project space13Backface Cullingview directionvNormalized project space14Backface Cullingview directionvNormalized project space15Backface Cullingview directionnv16Backface Cullingview directionnv0vn, draw polygon17Backface Cullingview directionnv0vn, cull polygon18Backface CullingIs this all we have to do?19Backface CullingIs this all we have to do? No!-Can still have 2 (or more) front faces that map to the same screen pixel20Backface CullingIs 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?21Backface CullingAdvantagesImproves rendering speed by removing roughly half of polygons from scan conversionDisadvantagesAssumes closed surface with consistently oriented polygonsNOT a true hidden surface algorithm!!!22Painter’s AlgorithmBasic idea: similar to oil painting - draw background first - then most distant object - then nearer object - and so forth23Painter’s AlgorithmSort polygons according to distance from viewerDraw from back (farthest) to front (nearest) - the entire objectNear objects will overwrite farther ones24Painter’s Examplez = 0.7z = 0.3z = 0.1Sort by depth:Green rectRed circleBlue triz = 025Painter’s AlgorithmDoes anyone see a problem with this?26Painter’s AlgorithmDoes 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 work27Painter’s AlgorithmDoes 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 work28Painter’s Algorithm1. Sort all objects’ zmin and zmax29Painter’s Algorithm1. Sort all objects’ zmin and zmax2. If an object is uninterrupted (its zmin and zmax are adjacent in the sorted list), it is fine30Painter’s Algorithm1. Sort all objects’ zmin and zmax2. If an object is uninterrupted (its zmin and zmax are adjacent in the sorted list), it is fine3. 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 not, they are fine - If yes, need to split one31Painter’s AlgorithmThe 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 other32Painter’s AlgorithmThe 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 otherAfter splitting, you can resort the list and should be fine33Painter’s Algorithm-SummaryAdvantages- Simple algorithm for ordering polygonsDisadvantages- Splitting is not an easy task- Sorting can also be expensive- Redraws same pixel many times34Binary Space Partitioning TreesBasic 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 objects1234 56735Binary Space Partitioning TreesBasic 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 objects1234 567+-36Binary Space Partitioning TreesBasic 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 objects1234 567If we want to draw 5 correctly - we need draw 6 and 7 first, - then draw 5, - then draw 1,2,3,4+-37Binary Space Partitioning TreesBasic principle: Objects in the half space opposite of the viewpoint
View Full Document