Unformatted text preview:

CSCE 441: Computer Graphics Hidden Surface Removal (Cont.)OutlineReview: Backface CullingReview: Painter’s ExampleReview: Painter’s AlgorithmReview: Building a BSP TreeRendering with a BSP TreeDifferent View Points?Slide 9Slide 10Slide 11Slide 12Slide 13Slide 14Slide 15Slide 16Slide 17Slide 18Slide 19Slide 20Slide 21Slide 22Slide 23Slide 24Slide 25Slide 26Slide 27Slide 28Slide 29Slide 30Slide 31Slide 32Slide 33Summary: BSP TreesSlide 35Slide 36Depth (“Z”) BufferZ-Buffering ExampleHow to Calculate “z”?Slide 40Slide 41Slide 42Slide 43Slide 44Slide 45Slide 46Slide 47Slide 48Scan Line AlgorithmSlide 50Slide 51Slide 52Slide 53Slide 54Slide 55Slide 56Slide 57Slide 58Slide 59Slide 60Ray CastingSlide 62Slide 63Slide 64Slide 65Hidden Surface removal: openglZ-buffer: openglSummary1CSCE 441: Computer Graphics Hidden Surface Removal (Cont.)Jinxiang Chai2OutlineBackface CullingPainter’s algorithmBSPZ-bufferScan lineRay castingReading: section 9-1 to 9-11, 9-14,9-153Review: Backface Cullingview directionnv0vn, draw polygon4Review: Painter’s Examplez = 0.7z = 0.3z = 0.1Sort by depth:Green rectRed circleBlue triz = 05Review: Painter’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 one65-227-2Review: Building a BSP Tree1 23465-137-14617-27-15-25-1bbbbb fff7Rendering with a BSP TreeHow to traverse the treeDraw “back” polygonsDraw “on” polygonsDraw “front” polygons17-1bf3f4f5-227-25-16bbbb85-227-21Different View Points?1 23465-137-14617-27-15-25-1bbbbb fffDo we need to build a new tree? V095-227-21Different View Points?1 23465-137-14617-27-15-25-1bbbbb fffDo we need to build a new tree? - No, we use the same tree if objects are static105-227-21Different View Points?1 23465-137-14617-27-15-25-1bbbbb fffDo we need to build a new tree? - No, we use the same tree if objects are staticHow can we traverse the tree? V011Rendering 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Draw “front” polygonsDraw “on” polygonsDraw “back” polygonsElse eye is on planeDraw “front” polygonsDraw “back” polygons1234 567+-6,75bf1,2,3,4V0Vnew12Rendering 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Draw “front” polygonsDraw “on” polygonsDraw “back” polygonsElse eye is on planeDraw “front” polygonsDraw “back” polygons1234 567+-6,75bf1,2,3,4V0Vnew13Rendering 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Draw “front” polygonsDraw “on” polygonsDraw “back” polygonsElse eye is on planeDraw “front” polygonsDraw “back” polygons1234 567+-6,75bf1,2,3,4VnewV0141Different View Points?1 23467-27-15-25-1Traversal order:7-1bf3f4f5-227-25-16bbbb+-V0Vnew1151Different View Points?1 23467-27-15-25-1Traversal order:17-1bf3f4f5-227-25-16bbbbV0Vnew1161Different View Points?1 23467-27-15-25-1Traversal order:17-1bf3f4f5-227-25-16bbbb+-V0Vnew1171Different View Points?1 23467-27-15-25-1Traversal order:17-1bf3f4f5-227-25-16bbbb+-V0Vnew1181Different View Points?1 23467-27-15-25-1Traversal order:1->27-1bf3f4f5-227-25-16bbbb+-V0Vnew1191Different View Points?1 23467-27-15-25-1Traversal order:1->2->(7-1)7-1bf3f4f5-227-25-16bbbb+-V0Vnew1201Different View Points?1 23467-27-15-25-1Traversal order:1->2->(7-1)->47-1bf3f4f5-227-25-16bbbb+-V0Vnew1211Different View Points?1 23467-27-15-25-1Traversal order:1->2->(7-1)->4->(5-1)7-1bf3f4f5-227-25-16bbbb+-V0Vnew1221Different View Points?1 23467-27-15-25-1Traversal order:1->2->(7-1)->4->(5-1)->37-1bf3f4f5-227-25-16bbbbV0Vnew1231Different View Points?1 23467-27-15-25-1Traversal order:1->2->(7-1)->4->(5-1)->3->(7-2)->(5-2)->67-1bf3f4f5-227-25-16bbbbV0Vnew1245-227-2Rendering with a BSP Tree1 23465-137-14617-27-15-25-1Traversal order?bbb fffbb255-227-2Rendering with a BSP Tree1 23465-137-14617-27-15-25-1Traversal order?bbb fffbb+-Traversal order?1265-227-2Rendering with a BSP Tree1 23465-137-14617-27-15-25-1Traversal order?bbb fffbb+-Traversal order?1->?275-227-2Rendering with a BSP Tree1 23465-137-14617-27-15-25-1Traversal order?bbb fffbbTraversal order?1->?+-285-227-2Rendering with a BSP Tree1 23465-137-14617-27-15-25-1Traversal order?bbb fffbbTraversal order?1->?+-295-227-2Rendering with a BSP Tree1 23465-137-14617-27-15-25-1Traversal order?bbb fffbbTraversal order?1->?+-305-227-2Rendering with a BSP Tree1 23465-137-14617-27-15-25-1Traversal order?bbb fffbbTraversal order?1->6+-315-227-2Rendering with a BSP Tree1 23465-137-14617-27-15-25-1Traversal order?bbb fffbbTraversal order?1->6->?325-227-2Rendering with a BSP Tree1 23465-137-14617-27-15-25-1Traversal order?1->6->5-2bbb fffbb335-227-2Rendering with a BSP Tree1 23465-137-14617-27-15-25-1Traversal order?1->6->(5-2)->(7-2)->3->4->(5-1)->(7-1)->2bbb fffbb34Summary: 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)35Summary: BSP TreesCons:Computationally intense preprocess stage restricts algorithm to static scenesSplitting increases polygon count Redraws same pixel many timesChoosing splitting plane not an exact scienceNot suitable for moving objects36OutlineBackface CullingPainter’s algorithmBSPZ-bufferScan lineRay castingReading: section 9-1 to 9-11, 9-14,9-1537Depth (“Z”) BufferSimple modification to scan-conversionMaintain a separate buffer storing the closest “z” value for each pixel—depth bufferOnly draw pixel if depth value is closer than stored “z” valueUpdate buffer with closest depth value38Z-Buffering Examplez = 0.7z = 0.3z = 0.1z = 1.0z = 1.0z = 0.3z = 1.0z = 0.3z = 0.1z = 1.0z = 0.7z = 0.3z = 0.1NOTE: Can draw these shapes in any orderNOTE: Can draw these shapes in any order39How to Calculate “z”?Update “z” values using scan line conversion algorithm),(11 


View Full Document

TAMU CSCE 441 - lecture10

Documents in this Course
Load more
Download lecture10
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view lecture10 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view lecture10 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?