Spatial Data Structures and Culling Techniques - PowerPoint PPT Presentation

1 / 37
About This Presentation
Title:

Spatial Data Structures and Culling Techniques

Description:

For accelerating queries culling, ray tracing intersection tests, collision detection ... similar geometric shape for quick tests (frustum culling for example) ... – PowerPoint PPT presentation

Number of Views:52
Avg rating:3.0/5.0
Slides: 38
Provided by: hanw157
Category:

less

Transcript and Presenter's Notes

Title: Spatial Data Structures and Culling Techniques


1
Spatial Data Structures and Culling Techniques
CIS 781 winter 2005
Han-Wei Shen
2
Spatial Data Structures
  • Used to organize geometry in n-dimensional space
    (2 and 3D are of this courses interest)
  • For accelerating queries culling, ray tracing
    intersection tests, collision detection
  • They are mostly hierarchy by nature
  • Topics
  • Bounding Volume Hierarchies (BVH)
  • Binary Space Partitioning Trees (BSP trees)
  • Octrees

3
Bounding Volume Hierarchies
  • Bounding Volume (BV) a volume that encloses a
    set of objects
  • The idea is to use a much similar geometric shape
    for quick tests (frustum culling for example)
  • Easy to compute, as tight as possible
  • AABB, Sphere easy to compute, but poor fit

(read section 13.3)
4
Bounding Volume Hierarchies
  • Each node has a bounding volume that encloses the
    geometry in the entire subtree
  • The actual geometry is contained in the leaf node
  • Three types of methods bottom-up, insertion, and
    top-down

root
leaves
(read section 14.3.1)
5
Binary Space Partitioning (BSP) Trees
  • Main purpose depth sorting
  • Consisting of a dividing plane, and a BSP tree on
    each side of the dividing plane (note the
    recursive definition)
  • The back to front traversal order can be decided
    right away according to where the eye is

back to front A-gtP-gtB
P
BSP A
BSP B
back to front A-gtP-gtB
6
BSP Trees (contd)
  • Two possible implementations

Axis-Aligned BSP
Polygon-Aligned BSP
Intersecting?
7
Axis-Aligned BSP Trees
  • Starting with an AABB
  • Recursively subdivide into small boxes
  • One possible strategy cycle through the axes
    (also called k-d trees)

D
E
B
2
1b
1a
A
C
0
Q objects intersect the boundaries?
8
Polygon-Aligned BSP Trees
  • The original BSP idea
  • Choose one divider at a time any polygon
    intersect with the plane has to be split
  • Done recursively until all polygons are in the
    BSP trees
  • The back to front traversal can be done exact
  • The dividers need to be chosen carefully so that
    a balanced BSP tree is created

F
B
C
A
D
E
result of split
9
Octrees
  • Similar to Axis-Aligned BSP trees
  • Each node has eight children
  • A parent has 8 (2x2x2) children
  • Subdivide the space until the
  • number of primitives within
  • each leaf node is less than a
  • threshold
  • Objects are stored in the leaf
  • nodes

10
Visibility Culling
  • Back face culling
  • View-frustrum culling
  • Detail culling
  • Occlusion culling

11
View-Frustum Culling
  • Done in the application stage
  • Remove objects that are outside the viewing
    frustum
  • Can use BVH, BSP, Octrees

12
View-Frustum Culling
  • Often done hierarchically to save time

In-order, top-down traversal and test
13
Detail Culling
  • A technique that sacrifices quality for speed
  • Base on the size of projected BV if it is too
    small, discard it.
  • Also often done
  • hierarchically

Always helps to create a hierarchical structure,
or scene graph.
14
Occlusion Culling
  • Discard objects that are occluded
  • Z-buffer is not the smartest algorithm in the
    world (particularly for high depth-
  • complexity scenes)
  • We want to avoid processing invisible objects

15
Occlusion Culling (2)
  • G input graphics data
  • Or occlusion hint
  • Things needed
  • Algorithms for isOccluded()
  • Or?
  • Fast update Or

OcclusionCulling (G) Or empty For each object
g in G if (isOccluded(g, Or)) skip g
else render (g) update (Or) end
End
16
Hierarchical Visibility
  • One example of occlusion culling techniques
  • Object-space octree
  • Primitives in an octree node are hidden if the
    octree node (cube) is hidden
  • A octree cube is hidden if its 6 faces are hidden
    polygons
  • Hierarchical visibility test

17
Hierarchical Visibility
  • From the root of octree
  • View-frustum culling
  • Scan conversion each of the 6 faces and perform
    z-buffering
  • If all 6 faces are hidden, discard the entire
    node and sub-branches
  • Otherwise, render the primitives inside and
    traverse the front-to-back children recursively

A conservative algorithm why?
18
Hierarchical Visibility
  • Scan conversion the octree faces can be expensive
    cover a large number of pixels (overhead)
  • How can we reduce the overhead?
  • Goal quickly conclude that a large polygon is
    hidden
  • Method use hierarchical z-buffer !

19
Hierarchical Z-buffer
  • An image-space approach
  • Create a Z-pyramid

1 value
¼ resolutin
½ resolution
Original Z-buffer
20
Hierarchical Z-buffer (2)
?
21
Hierarchical Z-buffer (3)
Isoccluded(g, Zp) near z nearZ(BV(g))
if (near Z behind Zp_root.z) return true
else return ( Isoccluded(g,Zp.c0)
Isoccluded(g,Zp.c1)
Isoccluded(g,Zp.c2)
Isoccluded(g,Zp.c3) ) end
22
Hierarchical Z-buffer (4)
update
Cull_or_Render (OctreeNode N) if (isOccluded
(N, Zp) then return for each primitive p in
N render and update Zp end for
each child node C of N in front-to-back order
Cull_or_Render( C ) end
23
Portal Culling
  • The following slides are taken from Prof. David
    Luebkes class web site at U. of Virginia

24
Portal Culling
  • Goal walk through architectural models
    (buildings, cities, catacombs)
  • These divide naturally into cells
  • Rooms, alcoves, corridors
  • Transparent portals connect cells
  • Doorways, entrances, windows
  • Notice cells only see other cells through portals

25
Cells Portals
  • An example

26
Cells Portals
  • Idea
  • Create an adjacency graph of 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
  • So cell visibility reduces to testing portal
    sequences for a line of sight

27
Cells Portals
A
D
E
F
C
B
G
H
E
A
B
C
D
F
G
H
28
Cells Portals
A
D
E
F
C
B
G
H
E
A
B
C
D
F
G
H
29
Cells Portals
A
D
E
F
C
B
G
H
E
A
B
C
D
F
G
H
30
Cells Portals
A
D
E
F
C
B
G
H
E
A
B
C
D
F
G
H
31
Cells Portals
A
D
E
F
C
B
G
H
E
A
B
C
D
F
G
H
32
Cells Portals
A
D
E
?
F
C
B
G
H
E
A
B
C
D
F
G
?
H
33
Cells Portals
A
D
E
X
F
C
B
G
H
E
A
B
C
D
F
G
X
H
34
Cells Portals
  • View-independent solution find all cells a
    particular cell could possibly see
  • C can only see A, D, E, and H

A
D
E
H
35
Cells Portals
  • View-independent solution find all cells a
    particular cell could possibly see
  • H will never see F

A
D
E
C
B
G
36
Cells and Portals
  • Question How can we detect the cells that are
    visible from a given viewpoint?
  • Idea (textbook pp 366)
  • Set the view box (P) as the entire screen
  • Compare the portal (B) to the neighbor cell (C)
    against the current view box P
  • If B outside P the neighbor cell C cannot be
    seen
  • Otherwise the neighbor cell C is visible
  • New view box P intersection of P and the portal
    B
  • For each neighbor of C, depth first traverse the
    adjacency graph of C and recurse

37
Example
  • Text pp 367
Write a Comment
User Comments (0)
About PowerShow.com