Compressed Bounding Volume Hierarchies for Collision Detection & Proximity Query
CCompressed Bounding Volume Hierarchies for Collision Detection &Proximity Query
Toni Tan , Ren´e Weller and Gabriel Zachmann Abstract — We present a novel representation of compresseddata structure for simultaneous bounding volume hierarchy(BVH) traversals like they appear for instance in collisiondetection & proximity query. The main idea is to compressbounding volume (BV) descriptors and cluster BVH into asmaller parts (“treelet”) that fit into CPU cache while at thesame time maintain random-access and automatic cache-awaredata structure layouts. To do that, we quantify BV and compress“treelet” using predictor-corrector scheme with the predictor ata specific node in the BVH based on the chain of BVs upwards.
I. I
NTRODUCTION
Collision detection (CD) & Proximity Query (PQ) areessential for motion planning, especially sampling-based al-gorithms. They are used to test collision or calculate separa-tion distance between sampled configuration and workspaceobstacles. In most algorithms, this task can becomes com-putational bottleneck that takes up to 90% of computationtime [1].For algorithms that work with polyhedral models,
Bound-ing Volume Hierarchies (BVHs) are widely used to acceleratethe tasks. The idea is to wrap polyhedral models with bound-ing volumes (BVs) that allow faster overlap or separationdistance test. Commonly used BVs are spheres, axis-alignedbounding boxes (AABB) , oriented bounding boxes (OBB) or discrete oriented polytopes ( k -DOP) . By splitting themodels and wrap it recursively, this will generate a treedata structure called BVHs. To check overlap or separationdistance between two models, we have to simultaneouslytraverse BVHs of the models (see Algorithm 1).Despite its performance, BVHs also have drawback, whichis the additional memory needed to describe the data struc-ture, which usually consists of BVs descriptor (See FigureI), pointers to its parent and children. Complex BVs usuallycould fit better into models however will require more mem-ory to describe BVs. Due to the nature of BVHs traversalalgorithms, memory access could becomes a bottleneck. Toovercome this, some cache friendly BVHs layouts have beenproposed e.g., cache-oblivious layout of BVHs (COLBVH)[2], and van Emde Boas layout [3]. Beside utilizing cache,reducing memory footprint could actually lead to betterperformance [4].In this paper, we proposed and implemented a novelcompressed bounding volume hierarchies with the use casein collision detection & proximity query. The main idea isto compress bounding volume (BV) descriptors and clusterBVHs into a smaller parts (“treelet”) that fit into CPUcache while at the same time maintain random-access and University of Bremen, Germany
Algorithm 1:
BVHtraversal( BV a , BV b ) if a and b are both leaves then checkPrimitives( a , b ) else if a is leaf thenforall children b i of b doif a and b i intersect then BVHtraversal( a , b i ) else if b is leaf thenforall children a i of a doif a i and b intersect then BVHtraversal( a i , b ) elseforall children a i of a and b i of b doif a i and b i intersect then BVHtraversal( a i , b i )automatic cache-aware data structure layouts. We decidedto built our work on top of algorithm that make use ofSIMD Instruction Sets to parallelize simultaneous traversal[5]. Beside promising performance, the algorithm requireadditional memory footprint for storing BV descriptor inSIMD variables, which will be a good candidate to applyour compressed BVHs layout. BVs Descriptor Memory UseSphree center + radius 2 floatsAABB min + max 6 floatsk-DOP number of k k floats
TABLE I: BVs Memory UsageII. P
REVIOUS W ORK
In motion planning, many efficient algorithms that makeuse of different BVs have been proposed to accelerate colli-sion test and proximity query, e.g., spheres [6], AABBs [7],OBBs [8], a generalization of AABBs, BoxTree [9], memoryoptimized AABBs, k-DOPs [10], [11], or convex hull trees[12]. There also exist approach that combine several BVsinto a three-stage sequence of BVs namely AABB, Sphere,and OBBs [13] or adding time as additional dimension intoAABB-based BVHs [14]. A recent algorithm make use ofSIMD Instruction Sets inside CPU to accelerate the task byparallelize BVHs traversal algorithm and at the same timestudy the influence of branching factors & splitting strategyin BVHs [5].However, most algorithms did not take memory footprintinto consideration. Actually, in the literature, there exist re- a r X i v : . [ c s . G R ] D ec earch that show an improvement in performance by reducingmemory footprints [15].In application like ray tracing, reducing BVHs memoryfootprint are being considered to avoid out of core techniqueespecially when rendering huge scene either by reducingBVHs precision [16], compress leaf with multiple polygons[17], represent mesh using alternative representation [18], orimplicit BVHs representation [19] .III. O UR C OMPRESSED D ATA S TRUCTURE
To maintain random-access and automatic cache-awaredata structure layouts, we propose a novel compressed BVHsthat have compression and decompresion method based onfollowing components:
A. Compression of BVs descriptor
We decided to reduce precision of BVs descriptor byusing half precison floating point, which only require 2 bytesinstead of 4 bytes with single precision as reported in [20].This instantly reducing our memory footprint by half andcan be done using SIMD Instruction Sets mm cvtps ph .Since SIMD does not allow direct operation for half float,we need to convert BVs descriptor back during overlap orseparation distance test using mm cvtph ps . B. Cluster BVHs into a smaller parts (“treelet”)
We proposed of clustering BVHs into a smaller parts basedon CPU cache size. Additionally, we use predictors based onthe delta to the parent nodes.IV. R
ESULTS
We have implemented our compressed BVHs layout usingC++ and
Intel Intrinsics functions using Visual Studio 2019.We focused our implementation on the most recent AVX512instruction sets.To compare performance of our proposed BVHs layout,we use open benchmark for collision detection & proximityquery proposed by Tan et al. [21]. Figure 1 shows some ofthe used models with different shapes and resolutions in ourtimings: in particular, a ds9 station and a hand. We present allresults in this section for the most time consuming distancepreset, i.e. a distance of zero.First, we evaluated the performance of using half precisionfloating point as described in subsection III-A. Even thoughan additional operation needed to convert half precision tosingle precision before testing BV, the performance itself isactually better by around 5-10% depends on objects used asshown by Figure 2. This is due to the reduced memory trafficbetween CPU and RAM. (a) (b)(c) (d) (e)
Fig. 1: The objects we used in our timings: (a) ds9, (b) hand,(c) robot ATST, (d) robot dog, and (e) robot nao t i m e / m illi s e c polygons / 1000ds9 / 0.000000 bng-avx/bng-avx-half-float/ (a) t i m e / m illi s e c polygons / 1000hand / 0.000000 bng-avx/bng-avx-half-float/ (b) Fig. 2: BVHs simultaneous traversal timing for task collisiondetection using object (a) ds9 station, (b) hand , and (c) robotatst with half float to describe BVs.. C
ONCLUSION AND F UTURE W ORK
We have presented a novel compressed BVHs layout forcollision detection & proximity query. The main idea isto compress bounding volume (BV) descriptors and clusterBVH into a smaller parts (“treelet”) using predictor-correctorscheme with the predictor at a specific node in the BVHbased on the chain of BVs upwards.Our approach also opens up several directions for futurework. For instance, we would like apply our layout intoanother BVs e.g., OBB or using another approach for com-pression, e.g., by quantify BV as integer and compress itusing integer compression method [22].Finally, probably other applications using BVHs like raytracing or occlusion computations could benefit from ourcompressed BVHs layout, too.R
EFERENCES[1] M. Reggiani, M. Mazzoli, and S. Caselli, “An experimental evalu-ation of collision detection packages for robot motion planning,” in
IEEE/RSJ International Conference on Intelligent Robots and Systems ,vol. 3. IEEE, 2002, pp. 2329–2334.[2] S.-E. Yoon and D. Manocha, “Cache-efficient layouts of boundingvolume hierarchies,” in
Computer Graphics Forum , vol. 25, no. 3.Wiley Online Library, 2006, pp. 507–516.[3] P. van Emde Boas, “Preserving order in a forest in less than logarithmictime,” in . IEEE, 1975, pp. 75–84.[4] T. Viitanen, M. Koskela, P. J¨a¨askel¨ainen, K. Immonen, and J. Takala,“Fast hardware construction and refitting of quantized bounding vol-ume hierarchies,” in
Computer Graphics Forum , vol. 36, no. 4. WileyOnline Library, 2017, pp. 167–178.[5] T. Tan, R. Weller, and G. Zachmann, “Simdop: Simd optimizedbounding volume hierarchies for collision detection.” in
IROS , 2019,pp. 7256–7263.[6] P. M. Hubbard, “Approximating polyhedra with spheres for time-critical collision detection,”
ACM Transactions on Graphics (TOG) ,vol. 15, no. 3, pp. 179–210, 1996.[7] G. v. d. Bergen, “Efficient collision detection of complex deformablemodels using aabb trees,”
Journal of graphics tools , vol. 2, no. 4, pp.1–13, 1997.[8] S. Gottschalk, M. C. Lin, and D. Manocha, “Obbtree: A hierarchicalstructure for rapid interference detection,” in
Proceedings of the 23rdannual conference on Computer graphics and interactive techniques ,1996, pp. 171–180.[9] G. Zachmann, “Minimal hierarchical collision detection,” in
Proceed-ings of the ACM symposium on Virtual reality software and technology ,2002, pp. 121–128.[10] J. T. Klosowski, “Efficient collision detection for interactive 3 dgraphics and virtual environments,” Ph.D. dissertation, Citeseer, 1998.[11] G. Zachmann, “Rapid collision detection by dynamically aligned dop-trees,” in
Proceedings. IEEE 1998 Virtual Reality Annual InternationalSymposium (Cat. No. 98CB36180) . IEEE, 1998, pp. 90–97.[12] S. A. Ehmann and M. C. Lin, “Accurate and fast proximity queriesbetween polyhedra using convex surface decomposition,” in
ComputerGraphics Forum , vol. 20, no. 3. Wiley Online Library, 2001, pp. 500–511.[13] D. Ferguson, M. Darms, C. Urmson, and S. Kolski, “Detection, pre-diction, and avoidance of dynamic obstacles in urban environments,”in . IEEE, 2008, pp. 1149–1154.[14] U. Schwesinger, R. Siegwart, and P. Furgale, “Fast collision detectionthrough bounding volume hierarchies in workspace-time space forsampling-based motion planners,” in . IEEE, 2015, pp. 63–68.[15] T.-J. Kim, B. Moon, D. Kim, and S.-E. Yoon, “Racbvhs: Random-accessible compressed bounding volume hierarchies,”
IEEE Transac-tions on Visualization and Computer Graphics , vol. 16, no. 2, pp.273–286, 2009. [16] K. Vaidyanathan, T. Akenine-M¨oller, and M. Salvi, “Watertight raytraversal with reduced precision.” in
High Performance Graphics ,2016, pp. 33–40.[17] C. Benthin, I. Wald, S. Woop, and A. T. ´Afra, “Compressed-leafbounding volume hierarchies,” in
Proceedings of the Conference onHigh-Performance Graphics , 2018, pp. 1–4.[18] C. Lauterbach, S.-E. Yoon, and D. Manocha, “Ray-strips: A compactmesh representation for interactive ray tracing,” in . IEEE, 2007, pp. 19–26.[19] P. Bauszat, M. Eisemann, and M. A. Magnor, “The minimal boundingvolume hierarchy.” in
VMV , 2010, pp. 227–234.[20] M. Koskela, T. Viitanen, P. J¨a¨askel¨ainen, J. Takala, and K. Cameron,“Using half-precision floatingpoint numbers for storing boundingvolume hierarchies,” in
Proceedings of the 32nd Computer GraphicsInternational Conference , 2015.[21] T. Tan, R. Weller, and G. Zachmann, “Opencollbench-benchmarkingof collision detection & proximity queries as a web-service,” in
The25th International Conference on 3D Web Technology , 2020, pp. 1–9.[22] D. Lemire, N. Kurz, and C. Rupp, “Stream vbyte: Faster byte-orientedinteger compression,”