Visibility Culling Markus Hadwiger & Andreas Varga.

61
Visibility Culling Markus Hadwiger & Andreas Varga
  • date post

    22-Dec-2015
  • Category

    Documents

  • view

    225
  • download

    3

Transcript of Visibility Culling Markus Hadwiger & Andreas Varga.

Page 1: Visibility Culling Markus Hadwiger & Andreas Varga.

Visibility CullingMarkus Hadwiger & Andreas Varga

Page 2: Visibility Culling Markus Hadwiger & Andreas Varga.

Basics

• Hierarchical Subdivision– Hierarchical Bounding Boxes– Octrees– K-D Trees ( K-Dimensional Space)– BSP Trees ( Binary Space Partition )

• Potentially Visible Sets (PVS)

Page 3: Visibility Culling Markus Hadwiger & Andreas Varga.

Hierarchical Bounding Box (HS)

• Construct a bounding box for each object• Merge nearby bounding box into bigger ones• Not very structured and systematic• Perform well for certain viewpoint• Shortcomings:

– Highly dependent on the given scene(worse: on the actual viewpoint)

– Unpredictable not very useful !

Page 4: Visibility Culling Markus Hadwiger & Andreas Varga.

Hierarchical Bounding Box Example (HS)

WORLD

ROLLERCOASTER

CAR #2 CAR #1

GUY_BAD GUY_BAD

GUN GUY_BAD

Page 5: Visibility Culling Markus Hadwiger & Andreas Varga.

Octrees (HS)

• Each node of and octree has form one to eight children if it is an internal node; otherwise it is a leaf node

• Culling against the viewing frustum• Shortcomings of regular subdivision

– Efficiently problem (inflexible)– Depend on the location of each polygon

• The two dimensional version of an octree is called quadtree

Page 6: Visibility Culling Markus Hadwiger & Andreas Varga.

Octrees Example (HS)

Page 7: Visibility Culling Markus Hadwiger & Andreas Varga.

K-D Trees2/2 (HS)

• Hierarchically subdivide n-dimensional space• A binary tree

– partitioning space into two halfspaces at each level

– two equal-sized partitions is not necessary (Octrees)

• Always done axial• A separating hyperplane can depend on actual data• Balance of binary tree

– One halfspace contains the same number of objects as the other halfspace

Page 8: Visibility Culling Markus Hadwiger & Andreas Varga.

K-D Trees Example 1/2 (HS)

1

1

2 3

2

3

4 5 6 7

4

5

6

7

8 9 10 11 12 13

8

9

10

11

12

13

Page 9: Visibility Culling Markus Hadwiger & Andreas Varga.

K-D Trees Example 2/2 (HS)

Page 10: Visibility Culling Markus Hadwiger & Andreas Varga.

BSP Trees6 (HS)

• Generalization of k-D trees – Space is subdivided along arbitrarily oriented hyperlpanes

– Subdivision of space into two halfspace at each step• Produces a binary tree

• Internal node corresponds to the partitioning hyperplane

• Leaf nodes are empty halfspaces

• Exact visibility determination for arbitrary viewpoint– For entirely static polygonal scenes

• Can be precalculated once and traversal at run time witharbitrary viewpoint

Page 11: Visibility Culling Markus Hadwiger & Andreas Varga.

BSP Trees Example 1 (HS)

1

23

45

6

1

Page 12: Visibility Culling Markus Hadwiger & Andreas Varga.

BSP Trees Example 2 (HS)

1

23

4a5

6

4b

front1

2

Page 13: Visibility Culling Markus Hadwiger & Andreas Varga.

BSP Trees Example 3 (HS)

1

23

4a5

6

4b

1

32

front back

Page 14: Visibility Culling Markus Hadwiger & Andreas Varga.

BSP Trees Example 4 (HS)

1

23

4a5

6

4b

1

32

4a

front back

front

4b

back

Page 15: Visibility Culling Markus Hadwiger & Andreas Varga.

BSP Trees Example 5 (HS)

1

32

4a 4b

6

5

1

23

4a5

6

4b

front back

front back front

front

Page 16: Visibility Culling Markus Hadwiger & Andreas Varga.

BSP Trees Example 6 (HS)

1

23

45

6

V1

V2

1

32

4a 4b

6

5

front back

front back front

front

The painting order from V1: 3, 5, 1, 4b, 2, 6, 4aThe painting order from V2: 3, 5, 1, 4b, 2, 4a, 6

We got correct picture of who is behind whom no matter where we were looking from.

Page 17: Visibility Culling Markus Hadwiger & Andreas Varga.

BSP Trees Example 6 (HS)

Page 18: Visibility Culling Markus Hadwiger & Andreas Varga.

Cell-Portals

• Assume the world can be broken into cells– Simple shapes– Rooms in a building, for instance

• Define portals to be the transparent boundaries between cells– Doorways between rooms, windows, etc

• In a world like this, can determine exactly which parts of which rooms are visible– Then render visible rooms plus contents

Page 19: Visibility Culling Markus Hadwiger & Andreas Varga.

Cell-Portals Example

A B

C D

E F

A B

C D

E F

- Node are cells, edges are portals- K-D trees and BSP trees are used to generate the cell structure and find neighbors and portals

- Portals can be one way (directed edges)- Graph is normally stored in adjacency list format

- Each cell stores the edges (portals) out of it

Page 20: Visibility Culling Markus Hadwiger & Andreas Varga.

Cell and Portal Visibility• Keep track of which cell the viewer is in• Somehow walk the graph to enumerate all the visible

regions– Can be done as a preprocess to identify the potentially

visible set (PVS) for each cell• Cell-to-region visibility, or cell-to-object visibility

– Can be done at run-time for a more accurate visible set• Start at the known viewer location• Eye-to-region or Eye-to-cell visibility

– Trade-off is between time spent rendering more than is necessary vs. time spent computing a smaller set

• Depends on the environment, such as the size of cells, density of objects, …

Page 21: Visibility Culling Markus Hadwiger & Andreas Varga.

Potentially Visible Sets (PVS)

• PVS: The set of cells/regions/objects/polygons that can be seen from a particular cell– Generally, choose to identify objects that can be seen– Trade-off is memory consumption vs. accurate visibility

• Computed as a pre-process– Have to have a strategy to manage dynamic objects

• Used in various ways:– As the only visibility computation - render everything in

the PVS for the viewer’s current cell– As a first step - identify regions that are of interest for

more accurate run-time algorithms

Page 22: Visibility Culling Markus Hadwiger & Andreas Varga.

Cell-to-Cell PVS

• Cell A is in cell B’s PVS if there exist a stabbing line that originates on a portal of B and reaches a portal of A– A stabbing line is a line segment intersecting only portals– Neighbor cells are trivially in the PVS

I J

H

GA

CB E

F

D

PVS for I contains:B, C, E, F, H, J

Page 23: Visibility Culling Markus Hadwiger & Andreas Varga.

Finding Stabbing Lines

• In 2D, have to find a line that separates the left edges of the portals from the right edges

• In 3D, more complex because portals are now a sequence of arbitrarily aligned polygons– Put rectangular bounding boxes

around each portal and stab those

L L

LLR

R

R

R

Page 24: Visibility Culling Markus Hadwiger & Andreas Varga.

Stab Trees

• A stab tree indicates:– The PVS for a cell

– The portal sequences to get from one to the other

• Used in further visibility processing– Restricts number of

cells/portals that must be looked at

A

C

DE

A/C

C/D1

C/D2C/E

A B

C D

E F

D

F

D/F

Page 25: Visibility Culling Markus Hadwiger & Andreas Varga.

Run-Time Visibility

• PVS approaches are entirely pre-processing– At run time, just render PVS

• Better results can be obtained with a little run-time processing– Sometimes guided by PVS

– It appears that most games don’t bother, the trade-off favors pre-processed visibility and over-rendering

• At run time the viewer’s location is known, hence Eye-to-Region visibility

Page 26: Visibility Culling Markus Hadwiger & Andreas Varga.

Eye-to-Cell

• Recall that finding stabbing lines involved finding a line that passed through all the portals

• The viewer adds some constraints:– The stabbing line must pass through the eye– It must be inside the view frustum

• The resulting problem is still reasonably fast to solve– Results in knowledge of which cells are visible from the

eye– Use the stab tree from the PVS computation to avoid

wasting effort– Further optimization is to keep reducing the view frustum

as it passes through each portal, which leads us to…

Page 27: Visibility Culling Markus Hadwiger & Andreas Varga.

Eye-to-Region Visibility• Define a procedure :

– Takes a view frustum and a cell• Viewer not necessarily in the cell

– Draws the contents of the cell that are in the frustum

– For each portal out of the cell, clips the frustum to that portal and recurs with the new frustum and the cell beyond the portal

• Make sure not to go to the cell you entered

• Start in the cell containing the viewer, with the full viewing frustum

• Stop when no more portals intersect the view frustum

Page 28: Visibility Culling Markus Hadwiger & Andreas Varga.

Eye-to-Region Example

View

Page 29: Visibility Culling Markus Hadwiger & Andreas Varga.

Eye-to-Region Example

View

Page 30: Visibility Culling Markus Hadwiger & Andreas Varga.

Eye-to-Region Example

View

Page 31: Visibility Culling Markus Hadwiger & Andreas Varga.

Eye-to-Region Example

View

Page 32: Visibility Culling Markus Hadwiger & Andreas Varga.

Eye-to-Region Example

View

Page 33: Visibility Culling Markus Hadwiger & Andreas Varga.

Eye-to-Region Example

ViewView

Page 34: Visibility Culling Markus Hadwiger & Andreas Varga.

Eye-to-Region Example

View

Page 35: Visibility Culling Markus Hadwiger & Andreas Varga.

Non-Invasive Interactive Visualization of Architectural

Environments

Christopher Niederauer U.C. Santa Barbara

Mike Houston Stanford University

Maneesh Agrawala Microsoft Research

Greg Humphreys University of Virginia

Page 36: Visibility Culling Markus Hadwiger & Andreas Varga.

Problem

• Environments of video game are vast and tend to be densely occluded.

• Most 3D model viewing application lack the ability to simultaneously display the interior spaces and the external structure of the environment.

Page 37: Visibility Culling Markus Hadwiger & Andreas Varga.

Motivation

Arcball style manipulator Walkthrough

Can’t see overall interior/exterior structure!

ArcBall [Shoemake 1992] [Teller 1992]

Page 38: Visibility Culling Markus Hadwiger & Andreas Varga.

Motivation

The occlusions make it impossible to see all the action at once!

Quake III[Id Software c. 2002]

Page 39: Visibility Culling Markus Hadwiger & Andreas Varga.

The Idea

• Exploded view– just below the ceilings

• Non-Invasive [Mohr 2001]

– without modification– use Chromium

[Humphreys et al. 2002]

Overall structure is visible!

Page 40: Visibility Culling Markus Hadwiger & Andreas Varga.

How It’s Done

• Example Architecture: Soda Hall

– Geometric Analysis (once)

– Rendering (every frame)

OpenGLStream

Geometric Analysis

GatherData

FindSplits

Rendering

…Floor

FloorComposite

Page 41: Visibility Culling Markus Hadwiger & Andreas Varga.

Gather Architectural Data• Intercept the OpenGL stream

– Find downward facing polygons• Requires up-vector

up

1

2 3

– Compute the height of downward facing polygon

1

height = v1‧upVector

polygon normal = (v2-v1) x (v3-v2)

Page 42: Visibility Culling Markus Hadwiger & Andreas Varga.

446

Gather Architectural Data• Create Histogram

286126

Height Ceiling Area

Geometric Analysis Rendering

OpenGLStream

…Floor

FloorComposite

Soda Hall Side Profile

606766942

FindSplits

GatherData

Page 43: Visibility Culling Markus Hadwiger & Andreas Varga.

FindSplits

Find Splitting Heights

Geometric Analysis Rendering

GatherData

OpenGLStream

…Floor

FloorComposite

Page 44: Visibility Culling Markus Hadwiger & Andreas Varga.

Offset Ceiling Heights

Page 45: Visibility Culling Markus Hadwiger & Andreas Varga.

Offset Ceiling Heights

Page 46: Visibility Culling Markus Hadwiger & Andreas Varga.

Geometric Analysis

FindSplits

Geometric Analysis Rendering

GatherData

OpenGLStream

…Floor

Floor

Composite

Find Downward Facing Polygons

Up Vector

Find SplitHeights

Player Height

NumSplits

Table MappingHeight to

Surface Area

List of Split Height

Page 47: Visibility Culling Markus Hadwiger & Andreas Varga.

Rendering

• Multiple Playback (Once per Floor)– Viewpoint Control– Clipping Planes – Translate along Up Vector

Geometric Analysis Rendering

GatherData

FindSplits

OpenGLStream

…Floor

FloorComposite

Page 48: Visibility Culling Markus Hadwiger & Andreas Varga.

Rendering

MultiplePlayback

Set ViewpointClip Plans &Translation

Viewpoint

NumSplits

MultipassComposite

Set ViewpointClip Plans &Translation

Num

Spli

ts P

asse

s of

Ori

gina

l Ope

nGL

Num

Spli

ts P

asse

s of

M

odif

ied

Ope

nGL

SeparationDistance

Exploded viewvisualization

GeometricAnalysis

List of SplitHeights

OriginalApplication

OpenGL

Page 49: Visibility Culling Markus Hadwiger & Andreas Varga.

Cluster Speedup

Composite

Floor 1 Floor 2 Floor 3Complete Model

800 MHz Pentium III Xeon processorNVIDIA GeForce4 graphics accelerator

Page 50: Visibility Culling Markus Hadwiger & Andreas Varga.

Soda Hall

TrackballWalkthrough

Page 51: Visibility Culling Markus Hadwiger & Andreas Varga.

Results with Soda Hall

(Single Floor)

Page 52: Visibility Culling Markus Hadwiger & Andreas Varga.

Quake III: Arena

TrackballWalkthrough

Page 53: Visibility Culling Markus Hadwiger & Andreas Varga.

Results with Quake III: Arena

(Single Floor)

Item

Page 54: Visibility Culling Markus Hadwiger & Andreas Varga.

Video

Page 55: Visibility Culling Markus Hadwiger & Andreas Varga.

Transparent Back-Faces

Page 56: Visibility Culling Markus Hadwiger & Andreas Varga.

Future Directions

• Make fully automated:– Semantic inputs

• Up vector

• Number of stories to split into

Page 57: Visibility Culling Markus Hadwiger & Andreas Varga.

Future Directions

[Salomon et al, 2003]

Page 58: Visibility Culling Markus Hadwiger & Andreas Varga.

Future Directions

(Hand Designed Mock-up)

Page 59: Visibility Culling Markus Hadwiger & Andreas Varga.

Summary and Conclusions

• Can improve viewer comprehension

Page 60: Visibility Culling Markus Hadwiger & Andreas Varga.

Resource

• Visibility Cullinghttp://www.cg.tuwien.ac.at/~msh/

• Stephen Chenney http://www.cs.wisc.edu/~schenney/

• Non-Invasive Interactive Visualization of Dynamic Architectural Environments http://graphics.stanford.edu/papers/archsplit/

• Chromium Homepagehttp://chromium.sourceforge.net/

Page 61: Visibility Culling Markus Hadwiger & Andreas Varga.