BSP Tree Supplement - PowerPoint PPT Presentation

1 / 44
About This Presentation
Title:

BSP Tree Supplement

Description:

Subtree polygons are classified according to the coefficients stored at (internal) nodes ... Auto-partition: choose the partition plane from the input set of polygons ... – PowerPoint PPT presentation

Number of Views:34
Avg rating:3.0/5.0
Slides: 45
Provided by: melod6
Category:
Tags: bsp | supplement | tree

less

Transcript and Presenter's Notes

Title: BSP Tree Supplement


1
BSP Tree Supplement
  • Jyun-Ming Chen

2
Kd-Tree and BSP tree
  • kd-tree is a special kind of bsp tree

3
(No Transcript)
4
Equation at a Node
  • Defines the hyperplane axbyczd0
  • Subtree polygons are classified according to the
    coefficients stored at (internal) nodes

5
Elements of BSP Construction
  • Choosing the partition plane
  • Auto-partition choose the partition plane from
    the input set of polygons
  • It is desirable to have a balanced tree, where
    each leaf contains roughly the same number of
    polygons. However, there is some cost in
    achieving this.
  • deBerg et al. choose free splits if possible,
    else, random selection
  • Partitioning polygons
  • If a polygon happens to span the partition plane,
    it will be split into two or more pieces. A poor
    choice of the partition plane can result in many
    such splits, and a marked increase in the number
    of polygons.

6
Elements of BSP Construction (cont)
  • The decision to terminate tree construction can
    be
  • when the number of polygons in a leaf node is
    below a maximum value.
  • until every polygon is placed in an internal
    node.
  • maximum tree depth.

7
Different ordering generates different trees
S3
S3
S2
S2
S3
S1
SIZE3
S2
8
S3
S2b S3b
S2a S3a
S2
SIZE5
S1
9
Painters Algorithm Subtleties
  • What do we mean sort in z? That is for a
    triangle, what is its representative z value?
  • Minimum z
  • Maximum z
  • Polygons centroid
  • Work cost sort draw
  • We still use Painters Algorithms for blended
    objects (discussed in the Blending Lesson)
  • An object space visibility algorithm

10
Painters Algorithm (cont)
  • Pros
  • No extra memory
  • Relatively fast
  • Easy to understand and implement
  • Cons
  • Precision issues (and additional work to handle
    them)
  • Sort stage
  • Intersecting objects

11
Painters Algorithm (BSP Version)
S(v) need not be drawn!
12
Example Scene
13
A
C
B
D
E
F
G
14
A
D
B1
C1
D
A B1 C1
B2 C2 EFG
B2
C2
E
F
G
15
A
D
B1
C1
D
C1
F
B2
C2
E
F
A B1
C2
B2 EG
G
16
A
D
B1
C1
D
C1
F
B2
C2
E
F
B1
C2
E
G
G
B2
A
Tree completed!
17
Rendering BSP b-to-f
A
D
B1
C1
D
C1
F
C2
E
F
B2
B1
C2
E
G
G
eye
B2
A
18
V
A
D
B1
hv
C1
D
C1
F
C2
hv-
E
F
B2
B1
C2
E
G
G
eye
B2
A
19
A
D
B1
C1
hv-
V
D
C1
F
C2
hv
E
F
B2
B1
C2
E
G
G
eye
B2
A
C1
20
A
D
B1
C1
hv-
D
C1
F
C2
hv
E
F
V
B2
B1
C2
E
G
G
eye
B2
A
C1
B1
21
A
D
B1
C1
D
C1
F
C2
E
F
B2
B1
C2
E
G
V
G
eye
B2
A
A
C1
B1
22
V
A
D
B1
hv
C1
D
C1
F
C2
hv-
E
F
B2
B1
C2
E
G
G
eye
B2
A
A
C1
B1
D
23
A
D
B1
C1
D
V
C1
F
C2
hv-
hv
E
F
B2
B1
C2
E
G
G
eye
B2
A
A
C1
B1
D
24
A
D
B1
C1
D
C1
F
C2
hv-
hv
V
E
F
B2
B1
C2
E
G
G
eye
B2
A
A
C1
B1
D
25
A
D
B1
C1
D
C1
F
C2
E
F
B2
B1
C2
E
G
V
G
eye
B2
A
A
C1
B1
D
B2
26
A
D
B1
C1
D
C1
F
C2
hv-
hv
E
F
V
B2
B1
C2
E
G
G
eye
B2
A
A
C1
B1
D
B2
E
27
A
D
B1
C1
D
C1
F
C2
E
F
B2
B1
C2
E
G
V
G
eye
B2
A
A
C1
B1
D
B2
G
E
28
A
D
B1
C1
D
V
C1
F
C2
hv-
hv
E
F
B2
B1
C2
E
G
G
eye
B2
A
A
C1
B1
D
B2
G
E
F
29
A
D
B1
C1
D
C1
F
C2
hv-
hv
V
E
F
B2
B1
C2
E
G
G
eye
B2
A
A
C1
B1
D
C2
B2
G
E
F
30
Consider Viewing Direction
  • From FAQ It is possible to substantially
    improve the quality of this example by including
    the viewing direction vector in the computation.
    You can determine that entire subtrees are behind
    the viewer by comparing the view vector to the
    partition plane normal vector. This test can also
    make a better decision about tree drawing when
    the eye point lies on the partition plane.

Need not consider hv-
31
Details
v
hv
v
n
n
v
n
32
Overdraw Problems
  • Back-to-front severe overdraw problem
  • Front-to-back no overdraw problem (with
    z-buffer). Most practical bsp renderers use this
    ordering

Front-to-back 0.06 sec
back-to-front 0.4 sec
1000 rectangles
33
Other Topics
  • History of BSP (H. Fuchs et al. Siggraph80) see
    bspfaq
  • BSP ray tracing
  • collision detection
  • shadow (SVBSP)
  • motion planning
  • BSP for dynamic scene

34
BSP Ray Tracing
  • Speed up ray tracing by
  • Reaching leaf nodes
  • Determine face through which ray exits
  • Find region-binding faces collect all parental
    halfplanes
  • Compute exit points
  • Extending ray into next region
  • until the ray shoots into infinity

35
Shadow Volume BSP (2D) (ref)
Chin Feiner (1989)
  • For every occluder, we can construct an SVBSP as
    shown right
  • Two types of nodes
  • light-to-endpt
  • occluder

36
SVBSP (cont)
  • Incrementally, insert blockers into SVBSP
  • Split cd into ca and ab
  • Classify ad and find it is in shadow. No need to
    insert (does not create new shadow)
  • Insert ca into right child of a (shown left)

37
Query Against SVBSP
38
BSP in Games (ref)
Character-environment collision detection
  • To account for character size, use offset planes
    in BSP
  • Problems when angles between planes are large

39
Collision Resolution
  • Better to solve a collision by deflecting the
    motion rather than stopping at the impact point
  • Stepping and climbing

40
BSP Collision Detection (Ref)
Moving objects (as OBB)
Out of 12 faces, only check with 1, 3, 6, 7
41
Dynamic Scenes
  • Moving camera no problem
  • Moving objects
  • Fuchs et. al. was to specify a bounding polygon
    around the area that of the scene that would be
    changing.
  • Doom use z-buffer for for dynamic objects
    (missiles and bullets)
  • Adding objects no problem
  • Deleting objects BIG problem (ref)

42
Homework
  • Construct the bsp tree until every line segment
    is in a leaf node
  • From the given view point, list the ordering (1)
    back-to-front (2) front-to-back according to the
    bsp tree
  • Considering viewing direction, list the b-to-f
    order

43
Ans
1(i,d)
B-2-f 1 3 7-, 7, 7
3 3-
6-,6,6 1 1- 2-
4,4,4- 2
2 5,5,5-
2(c)
3(k)
4(a)
5(g)
7(l)
6(f)
b
h
e
j
44
Ans
1(i,d)
B-2-f 1 3 7-, 7, 7
3 3-
6-,6,6 1 1- 2-
4,4,4- 2
2 5,5,5-
2(c)
3(k)
4(a)
5(g)
7(l)
6(f)
b
h
e
j
Write a Comment
User Comments (0)
About PowerShow.com