Voxels are hot topic. Ever since the minecraft game ‘voxels’ are popping up everywhere. The technology is not new, but with the power of modern-day GPU’s, advanced techniques are now possible in real-time.
I was particularly impressed by the works of Procworld, Voxel Quest and Blockscape. Since this technology requires combining computer graphics, maths, CPU/GPU parallelism and complex algorithms, I was very excited to taste some of those delicious voxels myself!
Voxels are the three-dimensional equivalent of 2D pixels on your screen. Your screen is divided in a finite set of points (hopefully at least Full HD 🙂 ). Each point corresponds to a dot or a square with a single color. Put all of these millions of points together and you get an image.
Voxels follow the same principle. The 3D world is divided using a regular (equally spaced) grid, and each gridpoint corresponds to a single voxel. Instead of containing color, a voxel typically holds the type of material present at this point, like grass, dirt, rock, air, but a voxel can be used to store any kind of volumetric information.
I deliberately didn’t refer to voxels as cubes, since they aren’t. Voxels can be represented as cubes, by placing a cube at each voxel using the voxel’s material (as done in Minecraft). However, alternative techniques exist, Procworld converts the 3D voxel information back to 2D triangles by generating the surface between air and solid. I’m guessing blockscape stores different shapes of cubes in its voxels and displays those. Voxel Quest is using some sort of ray marching algorithm and evaluates 3D mathematical functions.
For my implementation, I started with a surface extraction approach as in Procworld, since it has as a main benefit that it outputs triangles, making it compatible with most mainstream 3D rendering technologies. This way I can render the voxel world using my existing deferred rendering implementation.