Visibility algorithms for computer graphics
This presentation is the property of its rightful owner.
Sponsored Links
1 / 40

Visibility Algorithms for Computer Graphics PowerPoint PPT Presentation


  • 134 Views
  • Uploaded on
  • Presentation posted in: General

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

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Visibility algorithms for computer graphics

Visibility Algorithms for Computer Graphics

CS 551/645 Introduction to Computer Graphics

Guest lecture by David Luebke

David Luebke11-2-98


But first

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 Luebke11-2-98


Overview

Overview

  • Recap: visible surfaces; Z-buffer

  • Other exact algorithms

    • BSP trees

    • Ray tracing

  • Conservative algorithms

    • View-frustum culling

    • Cells & portals

    • Occlusion culling

David Luebke11-2-98


Recap the visible surface problem

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 Luebke11-2-98


Recap painter s algorithm

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 Luebke11-2-98


Recap painter s algorithm1

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 Luebke11-2-98


Recap z buffer

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 Luebke11-2-98


Overview1

Overview

  • Recap: visible surfaces; Z-buffer

  • Other exact algorithms

    • BSP trees

    • Ray tracing

  • Conservative algorithms

    • View-frustum culling

    • Cells & portals

    • Occlusion culling

David Luebke11-2-98


Binary space partition bsp trees

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 Luebke11-2-98


Bsp trees

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 Luebke11-2-98


Bsp trees1

BSP Trees

David Luebke11-2-98


Bsp trees2

BSP Trees

David Luebke11-2-98


Bsp trees3

BSP Trees

David Luebke11-2-98


Bsp trees4

BSP Trees

David Luebke11-2-98


Bsp trees5

BSP Trees

David Luebke11-2-98


Bsp trees rendering

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 Luebke11-2-98


Bsp trees rendering1

BSP Trees: Rendering

David Luebke11-2-98


Bsp trees rendering2

BSP Trees: Rendering

David Luebke11-2-98


Bsp trees the catch

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 Luebke11-2-98


Overview2

Overview

  • Recap: visible surfaces; Z-buffer

  • Other exact algorithms

    • BSP trees

    • Ray tracing

  • Conservative algorithms

    • View-frustum culling

    • Cells & portals

    • Occlusion culling

David Luebke11-2-98


Ray tracing

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 Luebke11-2-98


Ray tracing1

Ray Tracing

  • An example:

Eyepoint

Screen

Scene

David Luebke11-2-98


Ray tracing2

Ray Tracing

  • An example:

Eyepoint

Screen

Scene

David Luebke11-2-98


Ray tracing3

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 Luebke11-2-98


Ray tracing the catch

Ray Tracing: The Catch

  • Ray tracing is a simple, powerful way to determine visibility & shading

  • So why don’t we always use it?

David Luebke11-2-98


Ray tracing the catch1

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 Luebke11-2-98


Overview3

Overview

  • Recap: visible surfaces; Z-buffer

  • Other exact algorithms

    • BSP trees

    • Ray casting

  • Conservative algorithms

    • View-frustum culling

    • Cells & portals

    • Occlusion culling

David Luebke11-2-98


Conservative algorithms

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 Luebke11-2-98


View frustum culling

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 Luebke11-2-98


Overview4

Overview

  • Recap: visible surfaces; Z-buffer

  • Other exact algorithms

    • BSP trees

    • Ray casting

  • Conservative algorithms

    • View-frustum culling

    • Cells & portals

    • Occlusion culling

David Luebke11-2-98


Cells portals

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 Luebke11-2-98


Cells portals1

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 Luebke11-2-98


Cells portals2

Cells & Portals

A

D

E

F

B

C

G

H

A

E

B

C

D

F

G

H

David Luebke11-2-98


Cells portals3

Cells & Portals

A

D

E

F

B

C

G

H

A

E

B

C

D

F

G

H

David Luebke11-2-98


Cells portals4

Cells & Portals

A

D

E

F

B

C

G

H

A

E

B

C

D

F

G

H

David Luebke11-2-98


Cells portals5

Cells & Portals

A

D

E

F

B

C

G

H

A

E

B

C

D

F

G

H

David Luebke11-2-98


Cells portals6

Cells & Portals

A

D

E

F

B

C

G

H

A

E

B

C

D

F

G

H

David Luebke11-2-98


Cells portals7

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 Luebke11-2-98


Overview5

Overview

  • Recap: visible surfaces; Z-buffer

  • Other exact algorithms

    • BSP trees

    • Ray casting

  • Conservative algorithms

    • View-frustum culling

    • Cells & portals

    • Occlusionculling

David Luebke11-2-98


Occlusion culling

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 Luebke11-2-98


  • Login