CS-184: Computer Graphics Lecture #7: BSP and AABB Trees Prof. - - PowerPoint PPT Presentation

cs 184 computer graphics
SMART_READER_LITE
LIVE PREVIEW

CS-184: Computer Graphics Lecture #7: BSP and AABB Trees Prof. - - PowerPoint PPT Presentation

CS-184: Computer Graphics Lecture #7: BSP and AABB Trees Prof. James OBrien University of California, Berkeley V2011-F-07-1.0 Announcements Assignment 4: due October 10 by 11pm 2 BSP-Trees Binary Space Partition Trees Split space


slide-1
SLIDE 1

CS-184: Computer Graphics

Lecture #7: BSP and AABB Trees

  • Prof. James O’Brien

University of California, Berkeley

V2011-F-07-1.0

Announcements

Assignment 4: due October 10 by 11pm

2

slide-2
SLIDE 2

3

BSP-Trees

  • Binary Space Partition Trees
  • Split space along planes
  • Allows fast queries of some spatial relations
  • Simple construction algorithm
  • Select a plane as sub-tree root
  • Everything on one side to one child
  • Everything on the other side to other child
  • Use random polygon for splitting plane

4

a,b,c,d,e,f,g

BSP-Trees

a b c d e g f

slide-3
SLIDE 3

5

a b,c1,d c2,e,f,g

a b c1 d e g f c2

BSP-Trees

6

a b c2,e,f,g c1 d

a b c1 d e g f c2

BSP-Trees

slide-4
SLIDE 4

7

a b c2 c1 d e1 ,f e2 ,g

a b c1 d g f c2 e1 e2

BSP-Trees

8

a b c2 c1 d e1 e2 ,g f

a b c1 d g f c2 e1 e2

BSP-Trees

slide-5
SLIDE 5

9

a b c2 c1 d e1 e2 f g

a b c1 d g f c2 e1 e2

BSP-Trees

+

  • +
  • +
  • +

+ + + + +

10

BSP-Trees

  • Visibility Traversal
  • Variation of in-order-traversal
  • Child one
  • Sub-tree root
  • Child two
  • Select “child one” based on location of viewpoint
  • Child one on same side of sub-tree root as viewpoint
slide-6
SLIDE 6

11

a b c2 c1 d e1 e2 f g

a b c1 d g f c2 e1 e2

BSP-Trees

c1:b:d:a:f:e1:c2:g:e2

12

g:e2:c2:f:e1:a:c1:b:d

a b c2 c1 d e1 e2 f g

a b c1 d g f c2 e1 e2

BSP-Trees

slide-7
SLIDE 7

Bounding Shapes

  • Bounding shape completely encloses associated object
  • Rays cannot hit object w/o intersecting bounding shape
  • Two objects cannot collide if shapes don’t overlap
  • Simplicity -vs- tightness

13

Axis-Aligned Bounding Boxes

  • Axis-aligned bounding box defined by min and max x,y,z

14

Min x,y,z Max x,y,z

slide-8
SLIDE 8

Axis-Aligned Bounding Boxes

15

Transform box Not axis-aligned Min/max of new points Linear cost to compute

16

Axis-Aligned Bounding Boxes

Min/max of transformed BB points Constant time Adds slop Cumulative slop if multiple transforms occur sequentially

Why would we do this?

slide-9
SLIDE 9

17

AABB Trees

Robot L.Foot RFoot Head L.Arm R.Arm L.Leg R.Leg Torso Mouth L.Eye R.Eye Head Shape Leg Shape Leg Shape

Group node Geometry node Transformation stored at all nodes

One of many variations

Head Shape B.Box Geometry Scale 2x Transformation XF B.Box

18

AABB Trees

Robot L.Foot RFoot Head L.Arm R.Arm L.Leg R.Leg Torso Mouth L.Eye R.Eye Head Shape Leg Shape Leg Shape

One of many variations

Geometry node

slide-10
SLIDE 10

XF B.Box Children Rot -25 Transformation Head Union B.Box XF B.Box

19

AABB Trees

Robot L.Foot RFoot Head L.Arm R.Arm L.Leg R.Leg Torso Mouth L.Eye R.Eye Head Shape Leg Shape Leg Shape

One of many variations

Group node

20

AABB Trees

One of many variations

Robot L.Foot RFoot Head L.Arm R.Arm L.Leg R . L e g Torso Mouth L.Eye R.Eye Head Shape Leg Shape Leg Shape

Local Bounding Boxes

slide-11
SLIDE 11

Robot L.Foot RFoot Head L.Arm R.Arm L.Leg R . L e g Torso Mouth L.Eye R.Eye Head Shape Leg Shape Leg Shape

21

AABB Trees

One of many variations

Transformed Bounding Boxes

22

AABB Trees

One of many variations

Robot L.Foot RFoot Head L.Arm R.Arm L.Leg R . L e g Torso Mouth L.Eye R.Eye Head Shape Leg Shape Leg Shape

slide-12
SLIDE 12

Robot L.Foot RFoot Head L.Arm R.Arm L.Leg R . L e g Torso Mouth L.Eye R.Eye Head Shape Leg Shape Leg Shape

23

AABB Trees

One of many variations

24

AABB Trees

One of many variations

Robot L.Foot RFoot Head L.Arm R.Arm L.Leg R . L e g Torso Mouth L.Eye R.Eye Head Shape Leg Shape Leg Shape

slide-13
SLIDE 13

Robot L.Foot RFoot Head L.Arm R.Arm L.Leg R . L e g Torso Mouth L.Eye R.Eye Head Shape Leg Shape Leg Shape

25

AABB Trees

One of many variations

26

Ray Test Against Bound Tree

  • RayHitSubTree(&ray,node)
  • If RayHitsBB(ray,node.xfBB)
  • ixfRay = Inverse(node.xf)*ray
  • If RayHitsBB(ixfRay,node.BB)
  • If node is group
  • Foreach child in node.children
  • RayHitSubTree(ixfRay,child)
  • else // node not group
  • RayHitGeometry(ixfRay,node.geom)
  • ray.collisionInfo.update(ixfRay)