Download presentation
Presentation is loading. Please wait.
Published byAmberlynn Stokes Modified over 9 years ago
1
Using BSP for CD Ref: BSP in deBerg et al ’ s book (url)url
2
Fall 20102 Introduction BSP: binary space partition CD: collision detection Especially useful for indoor scenes
3
Fall 20103 Kd-Tree and BSP tree kd-tree is a special kind of bsp tree + –
4
Fall 20104 BSP Tree Construction
5
Fall 20105 Equation at a Node Defines the hyperplane, : ax+by+cz+d=0 Subtree polygons are classified according to the coefficients stored at (internal) nodes Coefficients are often “ normalized ” for distance computation between point and plane
6
Fall 20106 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. 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.
7
Fall 20107 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.
8
Fall 20108 S3 S2 S3 S1 SIZE=3 Different ordering generates different trees
9
Fall 20109 S3 S2 S2b S2a S2 S3 S3a S3b S1 S2b S3bS2a S3a S1 S2b S3b S2a S3a S2bS2a S3b S3a S3b S3a S3bS3a SIZE=5
10
Fall 201010 Painter ’ s Algorithm What do we mean “sort in z”? That is for a triangle, what is its representative z value? Minimum z Maximum z Polygon ’ s centroid Work cost = sort + draw An object space visibility algorithm
11
Fall 201011 Painter ’ s 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
12
Fall 201012 Painter ’ s Algorithm (BSP Version) S(v) need not be drawn!
13
Fall 201013 Example Scene
14
Fall 201014 A B E C F D G
15
Fall 201015 A E C1C1 F D G C2C2 B2B2 B1B1 D A B 1 C 1 B 2 C 2 EFG + –
16
Fall 201016 A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F A B 1 C 2 B 2 EG
17
Fall 201017 A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A Tree completed!
18
Fall 201018 A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A eye Rendering BSP [b-to-f]
19
Fall 201019 A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A eye V hv-hv- hv+hv+
20
Fall 201020 A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A eye V C1 hv-hv- hv+hv+
21
Fall 201021 A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A eye V B1 C1 hv-hv- hv+hv+
22
Fall 201022 A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A eye V B1 C1 A
23
Fall 201023 A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A eye V B1 C1 A D hv-hv- hv+hv+
24
Fall 201024 A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A eye V B1 C1 A D hv-hv- hv+hv+
25
Fall 201025 A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A eye V B1 C1 A D hv-hv- hv+hv+
26
Fall 201026 A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A eye V B1 C1 A D B2
27
Fall 201027 A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A eye V B1 C1 A B2 E D hv-hv- hv+hv+
28
Fall 201028 A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A eye V B1 C1 A B2 E D G
29
Fall 201029 A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A eye V B1 C1 A B2 E D F G hv-hv- hv+hv+
30
Fall 201030 A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A eye V B1 C1 A B2 E D F G hv-hv- hv+hv+ C2
31
Line Equation P 1 (x 1,y 1 ) P 2 (x 2,y 2 ) L = 0 L > 0 (left side) P(x,y) (1,0) (0,1) Check: origin on + (left) side ! Left side correspond to positive side n
32
Fall 201032 BSP in Games (ref)ref To account for character size, use offset planes in BSP Problems when angles between planes are large Character-environment collision detection
33
Fall 201033 Collision Resolution Better to solve a collision by deflecting the motion rather than stopping at the impact point Stepping and climbing
34
Fall 201034 Example L1 L2 L3 L1 L2 L3 (0,4) (6,0) (6,4) L1: (0,4) (6,0) L2: (6,0) (6,4) L3: (6,4) (0,4) + – solid free
35
Fall 201035 Point-Scene Test
36
Fall 201036 Example L1 L2 L3 L1 L2 L3 00 <0 d0d0 d -r r
37
Fall 201037 Example L1 L2 L3 L1 L2 L3 00 <0 d -r r
38
Fall 201038 Example L1 L2 L3 L1 L2 L3 00 <0 d -r solid free
39
Fall 201039 Example L1 L2 L3 L4 L5 L6 L1 L2 L5 L4 L3 L6 + – solid free
40
Fall 201040 Ex: Tree Building 1/4 L1 + – L2 L3 L7 L5 L6 L4 L2,L3,L4,L5,L6L5,L6,L7
41
Fall 201041 Tree Building 2/4 L1 + – L2 L3 L7 L5 L6 L4 L2,L3,L4,L5,L6L5,L6,L7 L4 L2,L3 L5,L6 L7 L5,L6
42
Fall 201042 Tree Building 3/4 L1 + – L2 L3 L7 L5 L6 L4 L2,L3 L5,L6 L7 L6 L5 L2 L3 L5 L6
43
Fall 201043 Tree Building 4/4 L1 + – L2 L3 L7 L5 L6 L4 L7 L6 L5 L2 L3 L5 L6 solid
44
Fall 201044 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)ref
45
Fall 201045 [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 reference
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.