VDB: High-Resolution Sparse Volumes with Dynamic Topology
Total Page:16
File Type:pdf, Size:1020Kb
VDB: High-Resolution Sparse Volumes with Dynamic Topology KEN MUSETH DreamWorks Animation We have developed a novel hierarchical data structure for the efficient rep- cases volumetric data is represented on spatially uniform, regular resentation of sparse, time-varying volumetric data discretized on a 3D 3D grids, in part because such representations are simple and grid. Our “VDB”, so named because it is a Volumetric, Dynamic grid that convenient. Moreover, most volumetric algorithms and numerical shares several characteristics with B trees, exploits spatial coherency of schemes have a strong preference for uniform sampling. Discretiza- + time-varying data to separately and compactly encode data values and grid tion of differential operators, interpolation, convolution kernels, and topology. VDB models a virtually infinite 3D index space that allows for other such techniques can only be generalized to nonuniform grids cache-coherent and fast data access into sparse volumes of high resolution. with difficulty. This is particularly true for accurate finite-difference It imposes no topology restrictions on the sparsity of the volumetric data, discretization of hyperbolic and parabolic partial differential equa- and it supports fast (average O(1)) random access patterns when the data tions governing time-dependent level sets and fluid dynamics. Such are inserted, retrieved, or deleted. This is in contrast to most existing sparse numerical simulations are commonly used in VFX where simplicity volumetric data structures, which assume either static or manifold topology is a virtue, and they form the underlying motivation for most of the and require specific data access patterns to compensate for slow random applications presented in this article. However, the fact remains that access. Since the VDB data structure is fundamentally hierarchical, it also some volumetric applications, such as volumetric modeling and facilitates adaptive grid sampling, and the inherent acceleration structure ray marching, benefit from sampling at varying resolution, so it is leads to fast algorithms that are well-suited for simulations. As such, VDB desirable to employ a data structure that supports both uniform and has proven useful for several applications that call for large, sparse, ani- hierarchical sampling. Additionally, many volumetric algorithms mated volumes, for example, level set dynamics and cloud modeling. In like Computational Solid Geometry (CSG) and flood-filling benefit this article, we showcase some of these algorithms and compare VDB with significantly from a hierarchical data representation. existing, state-of-the-art data structures. Although dense regular grids are convenient for several reasons, they suffer at least one major shortcoming: their memory footprint Categories and Subject Descriptors: I.3.7 [ ]: Three- Computer Graphics grows in proportion to the volume of the embedding space. Even Dimensional Graphics and Realism— ;I.3.5[ Animation Computer Graph- moderately sized dense, regular grids can impose memory bottle- ]: Computational Geometry and Object Modeling— ics Physically based necks if multiple instances are required or if the 3D data is animated modeling and the grid domain dynamically changes, both of which are typical General Terms: Algorithms for simulations. Since most volumetric applications used in VFX production do not require data to be uniformly sampled everywhere Additional Key Words and Phrases: Volumes, level sets, implicit surfaces, in a dense grid, the solution is clearly to employ a sparse volumet- fluid animation ric data structure. Such a sparse volume should ideally have the ACM Reference Format: advantage that the memory footprint scales only with the number Museth, K. 2013. VDB: High-resolution sparse volumes with dynamic of voxels that contain meaningful sample values, and not with the topology. ACM Trans. Graph. 32, 3, Article 27 (June 2013) 22 pages. volume of the dense embedding space. While numerous sparse 3D DOI: http://dx.doi.org/10.1145/2487228.2487235 data structures have been proposed, most are designed explicitly for adaptive sampling, have slow or restrictive data access, do not 27 1. INTRODUCTION scale to extreme resolution, or cannot easily handle numerical sim- ulations with dynamic topology1. A few sparse data structures have Volumetric data is essential to numerous important applications been developed specifically for level sets and fluid simulation, but as in computer graphics, medical imaging, and VFX production, will be explained later, they impose restrictions on the topology and including volume rendering, fluid simulation, fracture simulation, access patterns of the data and as such cannot easily be generalized modeling with implicit surfaces, and level set propagation. In most to other volumetric applications. The VDB data structure is memory efficient, supports simulation of time-varying data, is capable of encoding arbitrary topology, and Author’s address: K. Museth, DreamWorks Animation; email: museth@ facilitates both uniform and adaptive sampling, while permitting acm.org. fast and unrestricted data access. While we do not claim VDB to be Permission to make digital or hard copies of part or all of this work for a“silverbullet”,wewillshowthatitoffersmanyadvantagesover personal or classroom use is granted without fee provided that copies are existing dynamic data structures. In fact, VDB has already found not made or distributed for profit or commercial advantage and that copies use in several movie productions, for example, Puss in Boots [Miller show this notice on the first page or initial screen of a display along with et al. 2012] and Rise of the Guardians, where it was instrumental the full citation. Copyrights for components of this work owned by others for the creation of high-resolution animated clouds, see Figure 1. than ACM must be honored. Abstracting with credit is permitted. To copy As will be discussed in more detail in the next section, the hier- otherwise, to republish, to post on servers, to redistribute to lists, or to use archical structure of VDB may at first glance seem similar to other any component of this work in other works requires prior specific permission data structures, but these similarities are superficial for at least two and/or a fee. Permissions may be requested from Publications Dept., ACM, reasons: either the existing data structures are not well-suited for Inc., 2 Penn Plaza, Suite 701, New York, NY 10121-0701 USA, fax 1 + (212) 869-0481, or [email protected]. c 2013 ACM 0730-0301/2013/06-ART27 $15.00 1Throughout this article “topology” is used to denote both the hierarchical ! DOI: http://dx.doi.org/10.1145/2487228.2487235 layout of a data structure and the spatial layout of voxels. ACM Transactions on Graphics, Vol. 32, No. 3, Article 27, Publication date: June 2013. 27:2 • K. Museth Fig. 1. Top: Shot from the animated feature Puss in Boots,showinghigh-resolutionanimatedcloudsgeneratedusingVDB[Milleretal.2012].Left:The clouds are initially modelled as polygonal surfaces, then scan-converted into narrow-band level sets, after which procedural noise is applied to create the puffy volumetric look. Right: The final animated sparse volumes typically have bounding voxel resolutions of 15, 000 900 500 and are rendered using a × × proprietary renderer that exploits VDB’s hierarchical tree structure. Images are courtesy of DreamWorks Animation. time-varying simulations with dynamic topology, or they do not restrictions on the dynamic grid topology (e.g., that they are closed, lend themselves to the implementation of the class of efficient algo- manifold surfaces) and require efficient algorithms for topological rithms that constitute an integral part of what we collectively denote operations like dilation, inside/outside flood-filling, and dynamic re- VDB. In other words, VDB should be evaluated against the relevant building of narrow-band level sets. In contrast, static data structures target applications of dynamic sparse volumes and simulations. generally support arbitrary but static grid topology. As such, exist- ing static data structures are not readily applicable to a large class of 1.1 Previous Work challenging numerical simulations, nor can current sparse dynamic data structures be used in volumetric applications that require effi- Considering the importance of sparse data structures in computer cient random access, nonrestricted topology, or adaptive sampling. graphics, it is no surprise that there is a large body of prior work, In essence, this dichotomy has motivated the current work. too large to be fully covered here. We limit our discussion to data Octrees have an especially long history in the context of render- structures for volumes without time-varying topology and those for ing, modeling, and mesh extraction. To mention just a few, Veenstra compact representations of narrow-band level sets often intended and Ahuja [1988] proposed a fast line-drawing algorithm for objects for fluid dynamics and other types of simulations. While the latter represented by octrees, Stolte and Kaufman [1998], and Frisken is the main focus of this article, the former is still relevant, since and Perry [2002] described several optimizations for tree traver- VDB can also be used as a generic, compact spatial data structure. sals, Frisken et al. [2000] used octrees to encode adaptive distance As a prelude we elaborate on the distinction between these two fields for modeling, Ju et al. [2002] used octrees for adaptive mesh- categories. Data structures for dynamics