O'Reilly logo

OpenGL Insights by Christophe Riccio, Patrick Cozzi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Octree-Based Sparse
Voxelization Using the GPU
Hardware Rasterizer
Cyril Crassin and Simon Green
22.1 Introduction
Discrete voxel representations are generating growing interest in a wide range of
applications in computational sciences and particularly in computer graphics. Ap-
plications range from fluid simulation [Crane et al. 05], collision detection [Allard
et al. 10], and radiative transfer simulation to detail rendering [Crassin et al. 09,
Crassin et al. 10, Laine and Karras 10] and real-time global illumination [Kaplanyan
and Dachsbacher 10,Thiedemann et al. 11,Crassin et al. 11]. When used in real-time
contexts, it becomes critical to achieve fast 3D scan conversion (also called voxeliza-
tion) of traditional triangle-based surface representations [Eisemann and ecoret 08,
Schwarz and Seidel 10, Pantaleoni 11].
In this chapter, we will first describe an efficient OpenGL implementation of a
simple surface voxelization algorithm that produces a regular 3D texture (see Fig-
ure 22.1). This technique uses the GPU hardware rasterizer and the new image
load/store interface exposed by OpenGL 4.2. This section will allow us to familiarize
the reader with the general algorithm and the new OpenGL features we l everage.
In the second part, we will describe an extension of this approach, which enables
building and updating a sparse voxel representation in the form of an octree structure.
In order to scale to very large scenes, our approach avoids relying on an intermediate-
full regular grid to build the structure and constructs the octree directly. This second
approach exploits the draw indirect features standardized in OpenGL 4.0 in order to
allow synchronization-free launching of shader threads during the octree construc-
tion,aswellasthenewatomic counter functions exposed in OpenGL 4.2.
303
22
304 III Bending the Pipeline
Figure 22.1. Real-time voxelization of dynamic objects into a sparse voxel octree (Wald’s hand 16K triangles
mesh voxelized sparsely in approximately 5.5 ms) and use of the technique for a voxel-based global illumination
application.
One of our main motivations in this work has been to investigate the usability of
the hardware graphics pipeline for fast and real-time voxelization. We will compare
the performance of our approach to the recent work of Pantaleoni [Pantaleoni 11],
which uses CUDA for regular-grid thin voxelization, and detail the performance
of our sparse-octree building approach. A typical real-time usage of our dynamic
voxelization inside a sparse voxel octree has been demonstrated recently as part of the
voxel-based global illumination approach described in [Crassin et al. 11].
22.2 Previous Work
Previous work on 3D voxelization makes a distinction between two kinds of surface
voxelization: thin voxelization,whichisa6-separating representation of a surface
(cf. [Huang et al. 98]) and fully conservative voxelization, where all voxels overlapped
by a surface are activated, or 26-separating (Figure 22.2). Although our method
could easily be extended to fully conservative voxelization, in this chapter we will
only describe the case of thin voxelization. Thin voxelization is cheaper to compute
and is often more desirable in computer graphics applications.
Figure 22.2. Examples of a 4-separating (left) and an 8-separating (right) 2D line rasteriza-
tion equivalent to 6-separating and 26-separating surface voxelizations in 3D.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required