Cube Voxel Rendering

Update 1: First detailed article is up here, which is all about rendering using quads.

Update 2: Second detailed article is up here, which is all about rendering using raymarching.

I love voxels and I love seeing them in great games like Minecraft and Cube World. Naturally, that’s made me want to use them in my own games.

Cube voxels (as opposed to smooth voxels) can be rendered with a variety of techniques, but I haven’t found a good comparison of those techniques. That’s why I decided to make one.

In the coming weeks I’ll compare several of these techniques that can be used in games and do a small write-up of how to implement each. As I delve into them, I’ll link to my write-ups from here.

So, without further ado, these are the techniques I’ll look at:

  • Simple Quads. This represents each voxel as a cube with 6 quads. This technique comes in three primary flavors: (1) quads with all color and texture info baked into the vertices using vertex array objects (VAOs); (2) display/command lists that store color or texture info per polygonized voxel; and (3) geometry shader generated quads from a set of VAO points.
  • Reduced Polygons. This technique uses a static mesh, but combines quads (possibly splitting the result to avoid T-junctions) to reduce the triangle count. Vertices will need to contain texture information and may require generating a per-object texture atlas.
  • Raymarching. An interesting iterative algorithm where points are sampled along a ray to find volume intersections. Minimum distances to the next possible intersection are calculated at each step and the point is marched along that distance. One difficulty with this approach is not knowing how many steps convergence will take. Inigo Quilez has many excellent examples of this technique with a focus on Signed Distance Fields (SDF):
  • Volume Ray Marching. Another ray marching technique. Rather than trying to find an exact intersection, this technique takes uniform samples along a ray within a volume and blends them. It’s notable because it handles translucency well and produces a smooth surface. It doesn’t produce cube looking voxels, but its popularity makes it important for comparison.

Stay tuned and if you have suggestions for other techniques to try, leave a comment.