220 likes | 248 Views
Binary Space Partitioning Trees variants from many papers Eric Etheridge. BSP Trees. Introduction: Space Partitionings. What are space partitionings? Divide space semantically using a data structure Same general goal as bounding-box hierarchies Usually a tree structure
E N D
Binary Space Partitioning Trees variants from many papers Eric Etheridge BSP Trees
Introduction: Space Partitionings • What are space partitionings? • Divide space semantically using a data structure • Same general goal as bounding-box hierarchies • Usually a tree structure • Nodes store or implicitly define spatial boundaries
Nodes / Cells • Nodes, or “cells”, refer to regions of space • Each object in the world is in one or more cells • Some options for data stored at a cell: • objects entirely in a cell / also those partly in a cell • data in leaves only / data in all nodes in a tree • store references to the objects in a cell • store polygons from the parts of objects in the cell • The exact data stored depends on the algorithm
Simpler Space Partitionings • Grid: • multidimensional array over a fixed maximum space • fixed-size cells • axis-aligned
Simpler Space Partitionings • Quad- / Oct-Trees: • tree structure over a fixed maximum space • each node divides the parent cell into four or eight sub-cells • the tree is not balanced • axis-aligned
Simpler Space Partitionings • K-D Trees • tree structure over an unbounded space • each node divides the parent into two cells • axis-aligned • usually rotates the choice of dimension to split at each level
General Space Partitioning Uses • Fast approximate object intersection detection: possibly intersecting vs. definitely not • line / object: efficient ray-tracing • volume / object: volume culling for rendering • object / object: avoid many collision detection checks
Binary Space Partitioning • BSP Trees • tree structure over an unbounded space • each node divides the parent into two cells • NOT axis-aligned • polygons that intersects planes are split along the plane
BSP Tree Original Purpose • Avoid the overhead of the painter's algorithm and Z-buffer for graphical display • First used for this purpose in the game Doom by Id Software, released in 1993 • Uses trees that cut along polygon faces
BSP Trees For Rendering • Tree created once • Each node stores a polygon in the environment • Space is divided into 'in front' and 'behind' that polygon • A viewpoint is chosen for rendering • The planes in the nodes are tested against the viewpoint, each time determining the near side • Objects on near sides are before far objects
BSP Trees vs. Other Partitionings • Allows exact ordering of polygons for rendering • Able to pre-compute “visibility lists”, i.e. what objects are visible from what locations • Less nodes are needed than for axis-aligned structures: • http://portal.acm.org/citation.cfm?id=1115371 • Allows simple Level-of-Detail approximations by picking tree order to match detail level
Specific BSP Abilities • Simple exact object intersection, returning the point or space of collision, many uses: • Exact ray tracing with a single data structure • Exact collision detection, single structure • And returning the volume of the collision, not just a point • Approximate intersections within specified error • Can make a partial tree that approximates an object • Number of nodes required is linear in object size, vs. quadratic when using axis-aligned partitionings
BSP Trees vs. Other Structures • BSP Trees can quickly model or approximate non-rectangular objects • Compare modeling a pyramid (next slides): • Axis-Aligned Bounding Boxes • Non-Axis-Aligned Bounding Boxes • Oct-Tree • BSP Tree
Creating BSP Trees • Usually done by pre-processing • Artist does not have to specify anything • When splitting an object, it must be a hull • Needs a clear 'inside' and 'outside' for intersection • Does not have to be convex • When splitting space, objects are often not split • Heuristics used to make nearly-optimal trees • (Perfect Binary Decision Trees are NP-Complete)
Return Values: Simple Yes / No Contents lists for intersected cells Exact space of the intersection BSP Trees: Intersection Basics • Intersection types: • Point • Ray • Plane • Bounding Box • BSP Tree / BSP Tree
Some Other BSP Applications • medical image compression: • http://portal.acm.org/citation.cfm?id=949685.949714 • shadow computation: • http://portal.acm.org/citation.cfm?id=199412 • general set operations on polyhedra: • http://portal.acm.org/citation.cfm?id=97880.97892
BSP Tree Limitations • Deformation of objects stored in a BSP Tree: • Deformations move polygons across planes • Can't recompute the tree or re-cut faces quickly • Exact collision using BSP Trees is impractical • Moving objects stored in a BSP Tree: • Simple BSP Tree algorithms do not handle this well • Complex algorithms can: • http://portal.acm.org/citation.cfm?id=97880.97892
BSP Tree General References • Compiled BSP Tree FAQ: • ftp://ftp.sgi.com/other/bspfaq/faq/bspfaq.html • “Classic” BSP Tree Starting Point Mentioned: • http://portal.acm.org/citation.cfm?id=807481 • Bruce Naylor's Doctoral Thesis at UTD: • http://portal.acm.org/citation.cfm?id=909951 • Wikipedia Article: • http://en.wikipedia.org/wiki/Binary_space_partitioning