Abstract. This paper presents a quantitative evaluation of the accu- racy of different sphere-tree construction methods when they are used in deformable bodies.
Comparing Sphere-Tree Generators and Hierarchy Updates for Deformable Objects Collision Detection M. Garcia, S. Bayona, P. Toharia, and C. Mendoza Universidad Rey Juan Carlos, c/Tulipan s/n E-28933 Mostoles (Madrid) {marcos.garcia, sofia.bayona, pablo.toharia, cesar.mendoza}@urjc.es
Abstract. This paper presents a quantitative evaluation of the accuracy of different sphere-tree construction methods when they are used in deformable bodies. The methods evaluated are Grid (an extension of octrees), Hubbard, Adaptive Medial Axis and Spawn. We also present a new approach to update the sphere-tree hierarchy that ensures lower loss of accuracy than in traditional update techniques.
1
Introduction
One of the main concerns in surgery simulation is achieving a realistic framework such that interactions between virtual human tissues are as natural as in the real world. This implies to process, in real-time, the collision and contact responses between deformable virtual objects. Collision detection has always been a bottleneck to obtain real-time simulations and an extensively research topic in computer graphics. Most of the work has been focused on solving the rigid body collision detection problem, but, in the last years, collision detection between deformable objects has become a hot topic of research. Typical algorithms to detect the collision between deformable bodies are based on using bounding volumes and spatial decomposition techniques in a hierarchical manner. This work addresses the collision detection problem for deformable objects when bounding sphere hierarchies are used. In the last years, the sphere-tree construction process has been significantly improved [1]: the sphere-tree approximations are tighter and the object’s surface is better covered by the leaf spheres of the hierarchy. However, when an object deforms, the hierarchies need to be updated at each time-step to keep the accuracy of the collision checking. This update can be very slow and can affect the interactivity of the simulation. 1.1
Contributions and Outline
To the best of our knowledge, there is not a quantitative evaluation, in terms of accuracy, for different sphere-tree hierarchies when they are used in deformable objects. We present a quantitative evaluation of the accuracy of different spheretree hierarchies by measuring the looseness with which the sphere-tree fits an G. Bebis et al. (Eds.): ISVC 2005, LNCS 3804, pp. 167–174, 2005. c Springer-Verlag Berlin Heidelberg 2005
168
M. Garcia et al.
object in a deformable body. Additionally, we develop different update techniques for the sphere-tree hierarchies that keep the tightness to the object and we compare their accuracy. The rest of the paper is organized as follows. Section 2 gives an overview of collision detection methods and a brief description of the different sphere-tree hierarchies that we evaluate. Next, in section 3, we identify some aspects of the sphere-tree hierarchies that affect the looseness of the spheres and present our sphere-tree hierarchy update techniques. We also describe how we measure the looseness of the spheres on the object. After that, experiments and comparisons are presented in section 4. Finally, some possible future work and conclusions that can be drawn from our comparisons are described in section 5.
2
Related Work
Refer to [2, 3] for recent surveys in collision detection for deformable objects. Most of the algorithms developed for collision detection use bounding volumes hierarchies such as oriented bounding boxes (OBBs) [4], k-dops [5], including the 6-dop special case: the axis-aligned bounding boxes (AABBs) [6], and sphere trees [1, 7]. According to Van den Bergen [6], AABBs are better option than OBBs for objects undergoing deformations, in terms of memory storage and hierarchy updates. Larsson and Akenine-M¨oller [8] compared different methods for the hierarchy updating process (i.e. bottom-up and top-down strategies). They proposed an hybrid method that uses both strategies. Mezger et al. [9] speeded up the process by updating only parts of the hierarchy where the vertices have not moved farther than a given distance. Sphere-trees are a key factor in time-critical collision detection [10] which has only been applied in rigid body collision detection. Some works compared the performance of different bounding volumes for rigid bodies [1, 4]. Recently, James et al. [11] presented a method to update sphere-tree hierarchies by using reduced deformable structures. For deformable objects there has been some evaluations for axis-aligned and oriented bounding boxes [6, 8], but to our knowledge there is not evaluation of different sphere-trees hierarchies when they are used for deformable bodies. 2.1
Background
A collision detection algorithm, based on sphere hierarchies, checks for collisions between successively tighter approximations of the objects surface. These approximations are composed of a set of spheres that bound, in some manner, primitives of the surface object (e.g. facets, vertices). The better fit of these approximations to the surface object, the more accurate the collision algorithm is. Each level of the hierarchy represents a tighter fit that its parent and the children covering the object’s surface are totally wrapped by the parent sphere. We describe some techniques to construct these hierarchies. The Grid algorithm [12] is based on the octree algorithm [13, 14, 15] where the bounding cube of the object is subdivided into 8 sub-cubes (nodes). Each subcube can also be subdivided into another set of sub-cubes until a given depth.
Comparing Sphere-Tree Generators and Hierarchy Updates
169
These cubes are used to generate the sphere tree. The grid algorithm instead of producing an equal subdivision of the parent node as in the octree, allows more freedom in the sub-division. The idea is to find a grid that produces the fewest number of spheres to approximate the object. Thus, the spheres can be of any dimension. The algorithm can therefore be seen as an optimization problem by considering how well filled (by the object) each sphere is. The optimization technique will aim to increase the area covered by some spheres so others spheres can be discarded. The Hubbard’s algorithm [7] generates the sphere-tree from an approximation of the object’s medial axis surface. To span the surface, first a set of points are uniformly placed on the object’s surface and used to construct a 3D Voronoi diagram. Then, the Voronoi vertices inside the polyhedron are identified to span the surface. Each of these vertices define a sphere, and these spheres tightly approximate the object. Hubbard reduces the number of spheres while preserving as much tightness of the approximation as possible by merging the spheres. The Adaptive Medial Axis algorithm [1] is based on Hubbard’s algorithm. Hubbard [7] uses a static medial axis approximation while Bradshaw et al. [1] proposed to update the medial axis approximation during the construction of the sphere tree by adding more sample points. Location of these new points is chosen so that the worst sphere is replaced (or merged) with tighter fitting ones. The spawn algorithm [12] distributes the error evenly across the approximation. Each sphere is expanded the same amount until they protrude past the surface a given distance, a stand-off distance. A search algorithm is used to obtain this distance that will yield the desired number of spheres. Additionally, instead of using the object’s medial axis for the construction, a local optimization algorithm is used to generate the set of spheres. For each sphere in the set, the optimization algorithm chooses the location that best covers the object, hence keeping small the set of spheres. The algorithm is named spawn as each sphere grows from its predecessor.
3
Updating Hierarchies
The sphere-tree hierarchies, described previously, keep a constant accuracy during collision detection between rigid bodies. However, for deformable objects, where the hierarchies are modified (i.e. the radius and center of the spheres are changed), there is a loss in the accuracy. A standard manner to obtain the new position of a center is by adding to the original center the average displacement vector of the enclosed vertices. James et al. [11] relocated the center by the weighted average displacements of the vertices inside a sphere. The radius is computed by obtaining the distance from the new center to the farthest enclosed vertices. This might excessively increase the radius of the new sphere and largely affect the accuracy of the sphere-tree hierarchy. Additionally, for the latest sphere tree construction methods [1], in certain cases, the spheres do not enclose any vertex. For example, when lots of long, thin triangles are being used. We name these spheres void spheres. Next, we propose some approaches
170
M. Garcia et al.
that avoid an excessive increment of the radius of the sphere, keeping suitable levels of accuracy, and that take into account the vertices that are not inside the spheres to relocate the sphere. 3.1
Update of the Center
We first correctly link all the spheres to the vertices of the object’s surface to avoid the existence of void spheres. For each intersecting facet Fi with a given sphere, s, we obtain the vertices vj such that vj ∈ Fi and associated to s. This can include internal and external vertices with respect to s. Repeated vertices are excluded. Next, let BB be the bounding box of the set of vertices vj associated to s and cBB the center of BB. Let u be the displacement vector of the bounding box center, i.e. u = cBBnew − cBBoriginal . Thus, the new position of the center, c, of the sphere is given by: (1) cnew = c + u. This process is repeated for all the spheres in the hierarchy. 3.2
Update of the Radius
Let dj be the distance from the associated vertices vj ∈ s to the sphere’s center, c, in the undeformed configuration and let djnew the distance of the new positions (i.e. in the deformed object) of vj to the new center position. Define the distance increment ratio as αj = djnew /dj . Thus, for a given leaf sphere, the new radius, rn , is computed as follows: rn = r max(αj ) (2) where r is the original radius. This is done hierarchically, so that for upper levels, instead of using the vertices, we use the distance to its children spheres. Let dcj be the distance between the centers of s and of its associated child sphere sj , and rj the original radius of sj . For non-leaf spheres, dj is calculated as follows: dj = dcj + rj .
(3)
Consequently, if dcjnew is the distance between the new center of s and the new center of sj and rjnew is the new radius of sj , then djnew is calculated as follows: djnew = dcjnew + rjnew .
(4)
Hence the radius is obtained as in Equation 2. Alternatively, we can modify the radius using the bounding box, BB, of the elements (vertices or children spheres) associated to the given sphere. Redefine dj as the distance from the original center of the sphere to the j corner of BB and djnew the distance from the new center of the sphere to the j corner of the new bounding box. Hence we can compute the radius as: rn =
maxj (djnew ) r. maxj (dj )
(5)
For leaf spheres, the bounding box is calculated using its associated vertices and for non-leaf spheres it is computed using its children spheres.
Comparing Sphere-Tree Generators and Hierarchy Updates
3.3
171
Proposed Update Approaches
We have proposed two approaches based in how we update the radius and center of each sphere of the hierarchy. Both approaches use our linking method to associate spheres to the object’s surface and avoid the existence of void spheres. – Approach 1: The center of the sphere is updated using the traditional approach, i.e. weighting the displacement of the sphere center and the radius is computed using our method in Equation 2. – Approach 2: The center of the sphere is updated using the displacement of the center of the bounding box of the associated particles or children spheres, Equation 1. Similarly, the radius update is based on the bounding box as in Equation 5. 3.4
Accuracy Measure
We have measured the accuracy of a sphere-tree by measuring the looseness of the spheres, that is, a measurement of how much of the sphere protrude outside the object. Hubbard [16] uses Hausdorff distance from each sphere to the object’s surface. However, when the object is non-convex, the distance needs to be approximated. We measure the error by considering the volume outside the object but inside the spheres. Both measures are computationally expensive and prohibited for real-time simulations. Next, we explain how we measure the volume between the object and the spheres. Define a voxel grid, Gj , from the bounding box of the level j of the sphere hierarchy. Let ∆ji be a unit voxel of Gj , V∆ji the volume of ∆ji and c∆ji the center of the voxel ∆ji . Define Πj as the union of spheres of a level j in the hierarchy. Assume that the sphere-tree approximations totally cover the object, O. The error, eji , of the voxel, ∆ji , is calculated as follows: V∆ji c∆ji ∈ Πj ∧ c∆ji ∈ /O eji = (6) 0 otherwise. Thus the total error for level j is: ej =
eji
(7)
i
The resolution of the error can be increased by subdividing in more voxels the grid Gj . We took the center of the voxel to test for intersections.
4
Results
We have constructed the sphere-tree hierarchies using Bradshaw’s toolkit [1] (http://isg.cs.tcd.ie/spheretree/) with a depth of three (four levels including the root) and a branching factor of eight. We have measured the looseness error of different parametric deformations (bending, twisting, stretching), see Figure 1.
172
M. Garcia et al.
Fig. 1. (Top row) Deformations: bending, twisting, stretching, and the original position. (Middle row) Approach 2 for level 2. (Bottom row) Approach 2 for level 3 (leaves).
To evaluate the update approaches, we have used an Adaptive Medial Axis approximation [1] for the object. Figures 2.a,b show how the accuracy of the two deepest levels of the sphere-tree hierarchy, levels two and three (leaves), evolves during a stretch deformation. Observe that the error obtained using the update approach 1 (i.e. weighting the displacement for the center and obtaining a ratio of the distance from the vertices to the center to update the radius) grows exponentially for a stretching deformation. The accuracy using the update approach 2 (i.e. radius and center modified based on the bounding boxes of the associated particles or children spheres) is largely better. In both approaches, the center and radius of each sphere of the hierarchy can return to their initial conditions if the object returns to its initial condition as well. Next, we compare the error of the different sphere-trees hierarchies when they are exposed to deformations, see Figure 2.c,d. Sample zero shows the error of the hierarchy in a rigid body collision detection process and the next samples show the error in intermediate deformed configurations. This accuracy changes during deformations. Note that for the level two of the hierarchy, Hubbard and the Adaptive Medial approximations show better accuracy results. However, surprisingly, for level three (leaves), the grid method resulted slightly better than the others. This indicates that although it is more conservative for rigid body collision detection, it can have better accuracy results for deformable bodies.
Comparing Sphere-Tree Generators and Hierarchy Updates 0.16
173
0.025 bound. box / bound. box
bound. box / bound. box
weighted / % dist.
weighted / % dist.
0.14 0.02 0.12
0.015
Error
Error
0.1
0.08
0.01
0.06
0.04 0.005 0.02
0
0 0
2
4
6
8
10
0
2
4
6
Samples
8
10
Samples
(a)
(b)
0.022
0.0055 0.005
0.02
0.0045
0.018
0.004 0.016 0.014
Error
Error
0.0035
0.012
0.003 0.0025
0.01 0.002 0.008
medial
0.0015
medial
0.001
hubbard
grid 0.006
grid
hubbard spawn
spawn
0.004
0.0005 0
2
4
6
8
10
Samples
(c)
0
2
4
6
8
10
Samples
(d)
Fig. 2. Top Accuracy errors (measured in object dimensions) for the update approaches in level (a) two and (b) three (leaves). Bottom Accuracy errors for sphere-three generators in level (c) two and (d) three (leaves).
5
Conclusion and Future Work
In this paper we have presented a simple method to measure the accuracy of the sphere-tree hierarchy and we have used it to evaluate our proposed approaches to update the sphere-tree hierarchy (i.e. the center and the radius of each sphere). The approach based on the bounding box presented the best results. In terms of computational cost, it might be similar to updating an AABB, however, the fact that we update sphere-trees is particularly useful for time-critical collision detection or in cases where the contact response is computed using the leaves nodes. Moreover, we have compared the different sphere-tree hierarchies using our best update approach (bounding box based). The Adaptive Medial Axis approximation has turned out to have the best average accuracy for the different levels, however, it was surprising to obtain low error results for a Grid approximation in the leaves level. Currently, we are investigating the accuracy of the hierarchy update when we combine the approaches, one different for each level of the hierarchy. Additionally, we are also developing a method to measure, in an easy manner, the error in the coverage of spheres on the surface’s object when it deforms.
174
M. Garcia et al.
References 1. Bradshaw, G., O’Sullivan, C.: Adaptive medial-axis aproximation for sphere-tree construction. ACM Transactions on Graphics 23 (2004) 1–26 2. Jimenez, P., Thomas, F., Torras, C.: 3d collision detection: A survey. Computer and Graphics 21 (2001) 269–285 3. Teschner, M., Kimmerle, S., Heidelberge, B., Zachmann, G., Raghupathi, L., Fuhrmann, A., Cani, M.P., Faure, F., Magnenat-Thalmann, N., Strasser, W., Volino, P.: Collision detection for deformable objects. In Schilick, C., Purgathofer, W., eds.: Proc. State of the Art Reports, Eurographics ’04. (2004) 119–140 4. Gottschalk, S., Lin, M.C., Manocha, D.: Obbtree: a hierarchical structure for rapid interference detection. In: SIGGRAPH ’96: Proceedings of the 23rd annual conference on Computer graphics and interactive techniques, ACM Press (1996) 171–180 5. Klosowski, J.T., Held, M., Mitchell, J.S.B., Sowizral, H., Zikan, K.: Efficient collision detection using bounding volume hierarchies of k-dops. IEEE Transactions on Visualization and Computer Graphics 4 (1998) 21–36 6. van den Bergen, G.: Efficient collision detection of complex deformable models using aabb trees. J. Graph. Tools 2 (1997) 1–13 7. Hubbard, P.: Approximating polyhedra with spheres for time-critical collision detection. IEEE Transactions on Visualization and Computer Graphics 15 (1996) 179–210 8. Larsson, T., Akenine-M¨ oller, T.: Collision detection for continuously deforming bodies. In: Eurographics, short presentations. (2001) 325–333 9. Mezger, J., Kimmerle, S., Etzmuss, O.: Hierarchical techniques in collision detection for cloth animation. Journal of WSCG 11 (2003) 322–329 10. Dingliana, J., O’Sullivan, C.: Graceful degradation of collision handling in physically based animation. Computer Graphics Forum 19 (2000) 239–248 11. James, D., Pai, D.: BD-Tree: Output-sensitive collision detection for reduced deformable models. ACM Transactions on Graphics (SIGGRAPH 2004) 23 (2004) 12. Bradshaw, G.: Bounding volume hierarchies for level-of-detail collision handling. In: PhD Thesis, Trinity College Dublin, Ireland (2002) 161 13. Liu, Y., Noborio, J., Arimoto, S.: Hierarchical sphere model and its application for checking an interference between moving robots. In: IEEE International Workshop on Intelligent Robots and Systems, IROS. (1988) 801–806 14. Hubbard, P.: Interactive collision detection. In: IEEE Symposium on Research Frontiers in Virtual Reality. (1993) 24–31 15. Palmer, I., Grimsdale, R.: Collision detection for animation using sphere-trees. Computer Graphics Forum 14 (1995) 105–116 16. Hubbard, P.: Collision detection for interactive graphic applications. IEEE Transactions on Visualization and Computer Graphics 1 (1995) 218–230