Fast and Lazy Build of Acceleration Structures from Scene Hierarchies Warren Hunt ∗ William R. Mark † Don Fussell ‡ Department of Computer Sciences The University of Texas at Austin ABSTRACT In this paper we show how to use structural information about a scene such as is contained in a scene graph to build SAH-based ac- celeration structures more efficiently. We provide a general method for doing so together with asymptotic analyses for both standard and lazy variants of our method. In particular, we show bounds of O(n) for full k-d tree builds over n primitives and O(v + log n) for lazy k-d tree builds over v visible primitives. We provide exper- imental results showing that these asymptotic properties translate into real-world speedups. In fact, without a method like ours, it is impossible to achieve better than O(n) for even the first split of a lazy build. We also show that under certain (realistic) assump- tions on the scene structure, our method produces provably good acceleration structures. Finally, we provide experimental results demonstrating that our acceleration structures are of nearly indis- tinguishable quality to those produced with a full SAH build. Keywords: k-d tree, scene graph, ray tracing, acceleration struc- ture Index Terms: I.3.7 [Computer Graphics]: Three-dimensional graphics and realism—Raytracing; 1 I NTRODUCTION Recent technological and algorithmic improvements have made in- teractive and even real-time ray tracing a reality on modern pro- cessors. Perhaps the most significant challenge in expanding the capabilities of modern real-time ray tracers is to handle dynamic scenes, in which objects are moving with respect to each other and possibly deforming as well. For such scenes, ray tracers cannot rely on pre-computed static acceleration structures that have been optimized for fast traversal; any acceleration structure used must be able to adapt to changing scene characteristics in real time. Until re- cently, this has resulted in the use of simple acceleration structures such as regular grids, median bounding-volume hierarcies (BVHs), or poorly-optimized k-d trees, that can be updated or rebuilt quickly each frame [12, 15, 8, 13]. However, recent work has made it possi- ble to construct much more highly-optimized k-d tree accelerators using the surface-area heuristic (SAH) efficiently enough so that they can be rebuilt on a frame-by-frame basis in real time [7, 11]. These highly-optimized structures are more effective at accelerating the rendering process than other techniques. If they can be rebuilt quickly, they can provide overall faster real time performance than was previously possible. Most existing SAH-based tree construction algorithms have as- sumed that the input data is essentially a “soup” of polygons or axis-aligned bounding boxes (AABBs) [7, 11, 14]. That is, no global scene structure is assumed, or taken advantage of, in build- ing the tree. However, real scenes have a great deal of structure. ∗ email: whunt@cs.utexas.edu † email: billmark@cs.utexas.edu ‡ email: fussell@cs.utexas.edu This structure is generally encoded as a scene graph representing the natural boundaries between, and relationships among, the ob- jects in a scene. A scene graph is a hierarchical object. Rigid body motions in the scene are represented by transformations between local coordinate frames associated with the objects represented in the scene graph. Natural clusters of geometry in the scene are found within objects. Thus, the information available in scene graphs is quite pertinent to the heuristics used for ray-tracing acceleration. One simple way in which a scene graph can be used to build an ac- celeration structure is to create a BVH that mirrors the hierarchy in the scene graph, where each object (or instance) in the scene graph contributes its bounding volume to the BVH. While some batch ray tracers have exploited scene graph infor- mation, for example to enable lazy creation of acceleration struc- tures, the Razor interactive ray tracer [2] is the first to our knowl- edge to exploit such information in an interactive or real-time sys- tem. Razor incorporates a fast SAH-based k-d tree build scheme based on an input scene graph and using the scan-based surface- area metric (SAM) approximation scheme of [7]. Use of an input scene graph also enables Razor to use a lazy build scheme to further accelerate the k-d tree builder. In this paper, we introduce a scheme for building SAH-based acceleration structures from input hierarchies that extends the k-d tree build algorithm of Razor to a more general class of acceleration structures. We show that our scheme is asymptotically fast and that in practice it produces acceleration structures as good as those pro- duced from scratch, as long as the input scene structure is as well- behaved as most common scene graphs. In particular, for input that is in some sense “presorted”, we show that our method performs a full SAH-based hierarchy build over n primitives in O(n) time that is in some provable sense high-quality. This can be compared to the known bound of n log n for tree construction using the SAH with no assumptions about scene structure [14]. We also show that, given an input hierarchy, we can perform a lazy k-d tree build over v visible primitives in a scene in O(v + log n). Given that v ≪ n, this result is substantially better than ei- ther a lazy build without scene structure or a non-lazy build using scene structure, which are O(n) or worse. We then show how the fast scan-based SAM approximation scheme of [7] can be used to improve the performance of our build methods by a constant factor. Finally, we use the k-d tree builder in Razor to demonstrate experimentally that our asymptotic efficiencies translate into real- world performance gains and that the trees produced are as good as those produced without exploiting scene structure. For example, by using a lazy strategy to build from a scene graph, we can build good acceleration structures an order of magnitude faster than by building them from scratch. We conclude from these results that exploiting the structural in- formation provided in scene graphs is key to achieving fast build speeds along with high rendering efficiency for ray-tracing acceler- ation structures.