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

Slides:



Advertisements
Similar presentations
Hierarchical Cellular Tree: An Efficient Indexing Scheme for Content-Based Retrieval on Multimedia Databases Serkan Kiranyaz and Moncef Gabbouj.
Advertisements

Introduction to Algorithms Quicksort
2.5. B ASIC P RIMITIVE I NTERSECTION Details of common forms of primitive intersection test.
Christian Lauterbach COMP 770, 2/16/2009. Overview  Acceleration structures  Spatial hierarchies  Object hierarchies  Interactive Ray Tracing techniques.
Restart Trail for Stackless BVH Traversal Samuli Laine NVIDIA Research.
Dynamic Planar Convex Hull Operations in Near- Logarithmic Amortized Time TIMOTHY M. CHAN.
Types of Algorithms.
Lecture 12: Revision Lecture Dr John Levine Algorithms and Complexity March 27th 2006.
2.1. C OLLISION D ETECTION Overview. Collision detection is used within many types of application, e.g. from robotics, through engineering simulations,
1 Trees Tree nomenclature Implementation strategies Traversals –Depth-first –Breadth-first Implementing binary trees Reading: L&C 9.1 – 9.7.
Sorting Chapter Sorting Consider list x 1, x 2, x 3, … x n We seek to arrange the elements of the list in order –Ascending or descending Some O(n.
Binary Search Trees Briana B. Morrison Adapted from Alan Eugenio.
Bounding Volume Hierarchy “Efficient Distance Computation Between Non-Convex Objects” Sean Quinlan Stanford, 1994 Presented by Mathieu Brédif.
Efficient Distance Computation between Non-Convex Objects by Sean Quinlan presented by Teresa Miller CS 326 – Motion Planning Class.
Preliminaries Multiway trees have nodes with greater than two children. Multiway trees of order k have nodes with most k children Trees –For all.
Fundamentals of Python: From First Programs Through Data Structures
Efficient Distance Computation between Non-Convex Objects By Sean Quinlan Presented by Sean Augenstein and Nicolas Lee.
Computer Graphics 2 Lecture x: Acceleration Techniques for Ray-Tracing Benjamin Mora 1 University of Wales Swansea Dr. Benjamin Mora.
1 Multiway trees & B trees & 2_4 trees Go&Ta Chap 10.
Spatial Data Management Chapter 28. Types of Spatial Data Point Data –Points in a multidimensional space E.g., Raster data such as satellite imagery,
1 Trees Tree nomenclature Implementation strategies Traversals –Depth-first –Breadth-first Implementing binary search trees.
Lecture 10 Trees –Definiton of trees –Uses of trees –Operations on a tree.
Binary Trees Chapter Definition And Application Of Binary Trees Binary tree: a nonlinear linked list in which each node may point to 0, 1, or two.
BINARY SEARCH TREE. Binary Trees A binary tree is a tree in which no node can have more than two children. In this case we can keep direct links to the.
PRESENTED BY – GAURANGI TILAK SHASHANK AGARWAL Collision Detection.
Starting at Binary Trees
Lecture 3: Uninformed Search
Lecture 11COMPSCI.220.FS.T Balancing an AVLTree Two mirror-symmetric pairs of cases to rebalance the tree if after the insertion of a new key to.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
1 Multi-Level Indexing and B-Trees. 2 Statement of the Problem When indexes grow too large they have to be stored on secondary storage. However, there.
Types of Algorithms. 2 Algorithm classification Algorithms that use a similar problem-solving approach can be grouped together We’ll talk about a classification.
Week 15 – Wednesday.  What did we talk about last time?  Review up to Exam 1.
Copyright © 2012 Pearson Education, Inc. Chapter 20: Binary Trees.
Binary Search Trees1 Chapter 3, Sections 1 and 2: Binary Search Trees AVL Trees   
2014-T2 Lecture 27 School of Engineering and Computer Science, Victoria University of Wellington  Lindsay Groves, Marcus Frean, Peter Andreae, and Thomas.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 20: Binary Trees.
Week 7 - Wednesday.  What did we talk about last time?  Recursive running time  Master Theorem  Symbol tables.
Ray Tracing Acceleration (5). Ray Tracing Acceleration Techniques Too Slow! Uniform grids Spatial hierarchies K-D Octtree BSP Hierarchical grids Hierarchical.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 20: Binary Trees.
Spatial Data Management
Trees Chapter 15.
COMP 53 – Week Fourteen Trees.
Data Structures and Algorithms for Information Processing
Distance Computation “Efficient Distance Computation Between Non-Convex Objects” Sean Quinlan Stanford, 1994 Presentation by Julie Letchner.
Binary Search Tree (BST)
Collision Detection Spring 2004.
Problems with Linked List (as we’ve seen so far…)
Trees Tree nomenclature Implementation strategies Traversals
Modeliranje kompleksnih modelov
Real-Time Ray Tracing Stefan Popov.
Binary Tree and General Tree
Chapter 20: Binary Trees.
Data Structures and Database Applications Binary Trees in C#
Analysis and design of algorithm
Types of Algorithms.
Advanced Topics in Data Management
Chapter 21: Binary Trees.
CSE373: Data Structures & Algorithms Lecture 6: Binary Search Trees
Types of Algorithms.
Quadtrees 1.
Chapter 11 Data Compression
Introduction to Data Structures
Backtracking and Branch-and-Bound
Types of Algorithms.
More advanced aspects of search
BVH Student: Jack Chang.
Modeliranje kompleksnih modelov
1 Lecture 13 CS2013.
CS203 Lecture 15.
Algorithm Course Algorithms Lecture 3 Sorting Algorithm-1
Presentation transcript:

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

Exploration of different types of bounding volume hierarchy

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.

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.

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

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.

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.

Top-down construction of a bounding volume hierarchy

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

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).

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

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.

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).

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).

Approaches to traversing bounding volumes hierarchies

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.

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.

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

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

Directed mathematical reading Directed reading

Directed reading Read Chapter 6 of Real Time Collision Detection (pp ) Related papers can be found from:

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