Voxel
 All Classes Namespaces Files Functions Typedefs Enumerations Enumerator Macros Pages
Voxel Documentation

Overview

This is a (relatively) simple OpenCL voxel raytracer (CPU rendering is also supported, but is very slow). The underlying data structure is a Sparse Voxel Octree (SVO). The main point of departure between this implementation, and the standard SVO formulation, is that each node in the tree stores not a single voxel, but rather a 4x4x4 grid of voxels. The advantages of this approach are twofold:

  1. Once we reach a leaf (equivalently, maximum mipmap level), and are raytracing in a 4x4x4 grid, we can forget about the tree structure until we exit the grid again, which simplifies the "inner loop". This effect would of course be magnified if we increased the grid size (to 8x8x8 or higher), but there are significant diminishing returns.
  2. On the GPU, these grids can be stored in texture memory, and are therefore cached, even on older cards (I'm using a GTX 260). On newer NVIDIA cards, global memory is also cached, but the use of textures may still be worthwhile, since the caching will take advantage of the 3D structure of the data.

Much of the complexity of this code comes from the fact that I try to keep the SVO state synchronized between the host and device (i.e. main memory, and graphics memory), and do so transparently, with smart pointers taking care of such tasks as marking blocks of data to be transferred to the device, and (at some point in the future) copy-on-write.

In-progress

To-do List

Ideas