Download presentation

Presentation is loading. Please wait.

Published byTristan Akin Modified over 3 years ago

1
2.6. B OUNDING V OLUME H IERARCHIES Overview of different forms of bounding volume hierarchy

2
Exploration of different types of bounding volume hierarchy

3
Given a total of n objects, a simple brute force approach towards producing a list of intersecting objects is to consider all object pairings (i.e. n 2 /2 comparisons). Assuming each object can be described in terms of one of more bounding volumes, by arranging the objects bounding volumes into a tree-based hierarchy (known as a bounding volume hierarchy), a logarithmic order time complexity can be obtained.

4
Desirable characteristics of a game-oriented BVH are likely to include: The nodes contained in any given sub-tree should be spatially close to each other. Each node in the hierarchy should be of minimal volume. Aside: BVH differ from spatial partitioning schemes (explored next lecture) in that two BVH volumes can cover the same space and objects are typically only found in a single volume. Spatial partitioning schemes typically require non- overlapping regions but permit objects to be in two or more partitions. Pruning a node near the root of the tree should remove more objects from further consideration than removal of a deeper node. The volume of overlap between sibling nodes should be minimal. The hierarchy should be balanced with respect to both its node structure and its content. The worst-case time for queries should not be much worse than the average-case query time.

5
As the number of possible BVH trees grows exponentially as the number of objects increase it is not possible to use an exhaustive (optimal) search. Instead, heuristic rules are used to direct the BVH construction (selecting the best option from a small number of hopefully near optimal options at each step). There are three main categories of tree construction methods: top-down bottom-up insertion

6
Top-down: partitioning input set into two (or more) subsets, introduce bounds, and recursing over bounded subsets (typically does not produce best trees, but is easy to implement and hence popular). Bottom-up: start with leaves of the tree, group two (or more) to form a bounding node, progressively grouping bounded volumes until a single node is reached (typically produces best quality BVH, but more difficult to implement). Insertion: incrementally insert an object into the tree so as to minimize some insertion cost measurement Top-down and bottom- up are off-line methods as they require all primitives to be available before construction starts. Insertion construction is considered on-line as it can be used at game run-time.

7
Consult the recommended course text for full details of the following approaches: Top-down Construction Bottom-up Construction Incremental (Insertion) Construction Top-down construction is explored next by way of an example.

8
Top-down construction of a bounding volume hierarchy

9
The process of top-down construction can be algorithmically described as: void BuildTopDownBVH(BVHNode treeNode, ArrayList objects) { Node newNode = new Node(); treeNode.add(newNode); newNode.BoundingVolume = ComputeBoundingVolume(objects); if( objects.Count <= MIN_OBJECTS_PER_LEAF ) { newNode.Type = LEAF; newNode. Objects = objects; } else { newNode.Type = NODE; int splitIdx = RearrangeAndPartitionObjects(objects); BuildTopDownBVH( newNode.LeftTree, objects.Subset(0,splitIdx)); BuildTopDownBVH( newNode.RightTree, objects.Subset(splitIdx,objects.Count); } } Create an empty node and add to the tree Build a suitable bounding volume around the specified object list If needed, simply store the object list within this node Sort and split the objects into two partitions Recursively build the BVH along the defined left and right sub-trees

10
Other than selecting which bounding volume to use, the top-down strategy need only define how an input set of objects can be partitioned into two subsets. Typically the input set is divided using a splitting hyperplane. Any primitives intersected by the splitting plane are commonly assigned to the subset within which its centroid belongs, alongside extending subset bounding volume by half the width of the primitive (thereby fully enclosing the primitive and minimising overlap between sibling bounding volumes).

11
A number of different partitioning strategies might be adopted (depending upon the performance/memory needs, etc. of the application), including: Minimize the sum of the volumes (or surface areas) of the child volumes. Minimize the volume (surface area) of the intersection of the child volumes. Maximize the separation of child volumes. Divide primitives equally between the child volumes (known as a median-cut algorithm, and tends to produced balanced trees) Combinations of above strategies. Assuming spherical bounding volumes Minimal child volume, but high overlap volume Larger child volume, but smaller overlap volume

12
The recursive partitioning stops (thereby forming a leaf node) when some termination condition is reached. This can include: The node contains less than some k primitives. The volume of the bounding volume falls below a cut-off limit. The depth of the node has reached a predefined cut-off depth. Partitioning might also fail because: All primitives fall on one side of the split plane. One or both child volumes end up with as many (or nearly as many) primitives as the parent volume. Both child volumes are (almost) as large as the parent volume. In these cases, it is reasonable to try other partitioning criteria before terminating the recursion.

13
The choice of which separating axis to use is often restricted to the following: Local x, y, and z coordinate axes (easy to use, also form orthogonal set, i.e. good coverage). Axes from some aligned bounding volume (e.g. from a reference k-DOP). Axes of the parent bounding volume Axis along which variance is greatest (using the dimension with largest spread serves to minimise the size of the child volumes).

14
The choice of which split point to use is (also) often restricted to the following: (a) Splits at object median, (b) splits at object mean, (c) splits at spatial median Object median: splitting at the middle object (thereby evenly distributing the primitives and providing a balanced tree). Object mean: splitting at the mean object offset (e.g. along the axis with greatest variance). Bounding volume median: splitting at the middle of the bounding volume (thereby splitting into two equal parts).

15
Approaches to traversing bounding volumes hierarchies

16
Given two BVHs a descent rule is used to determine overlap status when the top-level volumes overlap. Approaches include breadth-first (BFS) and depth- first (DFS) searches. BFS explores all nodes at a given depth before descending. DFS descends down into the tree, backtracking up once a leaf is hit. A decent method is blind (or uninformed) if it only uses the tree structure to select the next node. Informed methods examine node data (e.g. using heuristics) to select the next node (e.g. a best-first search maintains a list of best-scoring moves). For collision detection systems, DFS (possibly a simple heuristic – i.e. basically a best-first approach) is typically favoured over BFS.

17
Given two BVHs the following descent strategies might be adopted: 1. Descend A before B (or vice versa). Fully descend into the leaves of A before starting to descend into B. This will be very expensive if Bs root bound fully contains A and/or if A contains lots of nodes. 2. Descend the larger volume. Dynamically determine which BVH node is currently larger and descend into (avoiding the problems of Approach 1). Which type of traversal is most effective depends entirely on the structure of the data, as indicated by the refinery example. 3. Descend A and B simultaneously. Similar to Approach 2 but without any cost evaluation overhead (but it may not prune space as efficiently). 4. Descend based on overlap. Similar to Approach 2, priortise descent on degree of overlap between BVH regions.

18
An example informed depth-first traversal algorithm is: void BVHInformedDFS(CollisionResult r, BVHNode a, BVHNode b) { if (!BVOverlap(a, b)) return; if (IsLeaf(a) && IsLeaf(b)) { CollidePrimitives(r, a, b); } else { if (DescendA(a, b)) { BVHInformedDFS (r, a->left, b); BVHInformedDFS (r, a->right, b); } else { BVHInformedDFS (r, a, b->left); BVHInformedDFS (r,,a, b->right); } } } CollisionResult is assumed to store relevant collision detection/contact information If the bounding volumes do not overlap then simply return If two leaf nodes are found, then perform collision detection on the primitives Descent rule to determine which BVH to follow bool DescendA(BVHNode a, BVHNode b) { return IsLeaf(b) || (!IsLeaf(a) && (SizeOfBV(a) >= SizeOfBV(b))); } Descend into the larger volume

19
See the source text book for: A non-recursive, faster, implementation of the generic informed depth-first traversal Simultaneous depth-first traversal algorithm Optimised leaf-directed depth-first traversal

20
Directed mathematical reading Directed reading

21
Directed reading Read Chapter 6 of Real Time Collision Detection (pp235-284) Related papers can be found from: http://realtimecollisiondetection.net/books/rtcd/references/

22
To do: Read the directed material After reading the directed material, have a ponder if this is the type of material you would like to explore within a project. Today we explored: Bounding volume hierarchies Overview of top- down construction approaches

Similar presentations

OK

Efficient Distance Computation between Non-Convex Objects by Sean Quinlan presented by Teresa Miller CS 326 – Motion Planning Class.

Efficient Distance Computation between Non-Convex Objects by Sean Quinlan presented by Teresa Miller CS 326 – Motion Planning Class.

© 2018 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on ancient greek clothing Ppt on narrative writing for 3rd grade Ppt on chapter 3 atoms and molecules youtube Ppt on ms word 2007 tutorial Ppt on db2 architecture Ppt on the road not taken analysis Ppt on minimum wages act in tamil Ppt on marie curie quotes Volumetric display ppt on tv Ppt on states of matter grade 5