1 / 40

Visibility Algorithms for Computer Graphics

Visibility Algorithms for Computer Graphics. CS 551/645 Introduction to Computer Graphics Guest lecture by David Luebke. But First…. CS 551/651: Advanced Computer Graphics I’m teaching next semester Follows and builds on 551/645. Topics: Photorealism: Ray tracing, path tracing, radiosity

asher-rose
Download Presentation

Visibility Algorithms for Computer Graphics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Visibility Algorithms for Computer Graphics CS 551/645 Introduction to Computer Graphics Guest lecture by David Luebke David Luebke 11-2-98

  2. But First… • CS 551/651: Advanced Computer Graphics • I’m teaching next semester • Follows and builds on 551/645. Topics: • Photorealism: Ray tracing, path tracing, radiosity • Speed: Occlusion culling, level-of-detail, texture tricks • Hardware: rendering pipeline, graphics architectures • Non-photorealism: pen-and-ink, painterly rendering • Image-based rendering: image warping, sprites, layered-depth images • Will also be taught in grad/undergrad formats David Luebke 11-2-98

  3. Overview • Recap: visible surfaces; Z-buffer • Other exact algorithms • BSP trees • Ray tracing • Conservative algorithms • View-frustum culling • Cells & portals • Occlusion culling David Luebke 11-2-98

  4. Recap: The Visible Surface Problem • Problem: Many polygons may map to same pixel on screen. • Goal: Correctly color pixels, using only unoccluded polygons • Formally, a occludes b if: • a and b are on the same projector • a is closer to the center of projection David Luebke 11-2-98

  5. Recap: Painter’s Algorithm • Idea: do what painters do • Sort objects by depth • Draw objects from distant to near • Just overwrite already-drawn objects as you go David Luebke 11-2-98

  6. Recap:Painter’s Algorithm • Pros: • Simple, fast rasterization • Cons: • Sorting is O(n lg n), and n can get big • Some objects can’t be sorted by depth: David Luebke 11-2-98

  7. Recap: Z-Buffer • Idea: resolve visibility at each pixel • Store depth of nearest polygon at pixel • Reset pixel color & depth only if nearer polygon is found • Embed this test in rasterization loop • Pros: simple, linear-time algorithm • Cons: Read-Modify-Write in inner loop demands large, fast, dedicated memory bank (the Z-buffer) David Luebke 11-2-98

  8. Overview • Recap: visible surfaces; Z-buffer • Other exact algorithms • BSP trees • Ray tracing • Conservative algorithms • View-frustum culling • Cells & portals • Occlusion culling David Luebke 11-2-98

  9. Binary Space Partition(BSP) Trees • Fuchs et al, 1980 • Assumptions: • Static scene • Moving camera • Commonly used in 3-D video games (e.g., Quake), but going out of style • Still a very powerful, general idea, used in many graphics algorithms David Luebke 11-2-98

  10. BSP Trees • Preprocess: overlay a binary (BSP) 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 • Notice: nodes are always convex David Luebke 11-2-98

  11. BSP Trees David Luebke 11-2-98

  12. BSP Trees David Luebke 11-2-98

  13. BSP Trees David Luebke 11-2-98

  14. BSP Trees David Luebke 11-2-98

  15. BSP Trees David Luebke 11-2-98

  16. BSP Trees: Rendering renderBSP(BSPtree *T) BSPtree *near, far; if (T is a leaf node) renderObject(T) if (eye on left side of T->plane) near = T->left; far = T->right; else near = T->right; far = T->left; renderBSP(far); renderBSP(near); David Luebke 11-2-98

  17. BSP Trees: Rendering David Luebke 11-2-98

  18. BSP Trees: Rendering David Luebke 11-2-98

  19. Ouch BSP Trees: The Catch • 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: • Worst case: can create up to O(n3) objects! David Luebke 11-2-98

  20. Overview • Recap: visible surfaces; Z-buffer • Other exact algorithms • BSP trees • Ray tracing • Conservative algorithms • View-frustum culling • Cells & portals • Occlusion culling David Luebke 11-2-98

  21. Ray Tracing • Idea: • trace a ray from the eyepoint through the center of each pixel • Color pixel according to the first object the ray hits • Simple! No need for: • Perspective projection matrices • Clipping • Scan conversion of polygons David Luebke 11-2-98

  22. Ray Tracing • An example: Eyepoint Screen Scene David Luebke 11-2-98

  23. Ray Tracing • An example: Eyepoint Screen Scene David Luebke 11-2-98

  24. Ray Tracing • Two flavors of the algorithm: • Ray casting just finds visible surfaces • Recursive ray tracing traces additional rays from those surfaces for sophisticated shading • Shadows • Reflection • Refraction David Luebke 11-2-98

  25. Ray Tracing: The Catch • Ray tracing is a simple, powerful way to determine visibility & shading • So why don’t we always use it? David Luebke 11-2-98

  26. Ray Tracing: The Catch • Ray tracing is a simple, powerful way to determine visibility & shading • So why don’t we always use it? • Too slow! • Complexity proportional to # of pixels • Typical screen: ~1,000,000 pixels • Typical scene:« 1,000,000 polygons David Luebke 11-2-98

  27. Overview • Recap: visible surfaces; Z-buffer • Other exact algorithms • BSP trees • Ray casting • Conservative algorithms • View-frustum culling • Cells & portals • Occlusion culling David Luebke 11-2-98

  28. Conservative Algorithms • Rendering with a Z-buffer finds exact visibility of n polygons in O(n) time • Conservative visibilityalgorithms quickly compute a potentially visible set of v polygons, v « n • v = all visible polygons + a few others • Z-buffer can then render this set in O(v) time David Luebke 11-2-98

  29. View-frustum culling • Simple way to quickly reject many polygons at once: • Associate simple bounding volumes (e.g., spheres) with each object • Before rendering object, test its bounding volume for visibility PotentiallyVisible Not Visible David Luebke 11-2-98

  30. Overview • Recap: visible surfaces; Z-buffer • Other exact algorithms • BSP trees • Ray casting • Conservative algorithms • View-frustum culling • Cells & portals • Occlusion culling David Luebke 11-2-98

  31. Cells & Portals • Goal: walk through architectural models (buildings, cities, catacombs…) • These divide naturally into cells • Rooms, alcoves, corridors… • Transparent portalsconnect cells • Doorways, entrances, windows… • Key observation: cells only see each other through portals! David Luebke 11-2-98

  32. Cells & Portals • Idea: • Create an adjacency graphof cells • Starting with cell containing eyepoint, traverse graph, rendering visible cells • A cell is only visible if it can be seen through a sequence of portals • Need a line of sight • So cell visibility reduces to testing portal sequences… David Luebke 11-2-98

  33. Cells & Portals A D E F B C G H A E B C D F G H David Luebke 11-2-98

  34. Cells & Portals A D E F B C G H A E B C D F G H David Luebke 11-2-98

  35. Cells & Portals A D E F B C G H A E B C D F G H David Luebke 11-2-98

  36. Cells & Portals A D E F B C G H A E B C D F G H David Luebke 11-2-98

  37. Cells & Portals A D E F B C G H A E B C D F G H David Luebke 11-2-98

  38. A D E F B C G H Cells & Portals • Can even figure out which cells a particular cell will never see: Ex: H will never see F; B can only see H • This can further speed up culling David Luebke 11-2-98

  39. Overview • Recap: visible surfaces; Z-buffer • Other exact algorithms • BSP trees • Ray casting • Conservative algorithms • View-frustum culling • Cells & portals • Occlusionculling David Luebke 11-2-98

  40. Occlusion Culling • When cells and portals don’t work… • Trees in a forest • A crowded train station • Need general occlusion culling algs: • Dynamic scenes, aggregate occluders • Open problem, little work so far: • Hierarchical Z-Buffer (Greene 93) • Hierarchical Occlusion Maps (Zhang 97) David Luebke 11-2-98

More Related