This is a basic introduction to what voxels are, what they are not and their general use cases.

If you wish to know the history of voxels, see here.

What is a voxel in theory?

To quote Wikipedia:

Voxels In 3D computer graphics, a voxel represents a value on a regular grid in three-dimensional space.

— Wikipedia on Voxels

Since most people don't have a good understanding/foundation of math (in this case: linear algebra), let's explain this piece by piece.


A voxel represents a value...

An individual voxel can be absolutely anything. Yes, anything.

And of all this is without taking the encoding, be it in-memory or on-disk, into account.


A grid of voxels containing colours.

CC-BY-3.0

...on a regular grid...

Taking the definition from Wikipedia...

A regular grid is a tessellation of n-dimensional Euclidean space by congruent parallelotopes (e.g. bricks). [...]

...and breaking it down:

  • Tessellation
    The grid is formed by dividing space into cells.
  • n-dimensional
    The grid has at least one dimension.
    But since we are in 3D space, at least three.
  • Euclidian space
    The axes are at 90° degree angles to each other, everywhere.
  • Congruent
    Every cell in the grid has exactly the same shape.
  • Parallelotopes
    • The cells are shaped like boxes.
    • Each opposing side has the same area/shape.
    • Their edges in a given axis are parallel.

Now you might think that the cells of the grid are the voxels, but that is not the case! The voxels are theoretically on the corners where the cells meet, they are neither inside the cells nor are they the cells; a voxel is a point sample, not a little cube.

In practice you will usually notice this when either rounding or off-by-one errors occur.


...in three-dimensional space.

  • There must be at least three-dimensions, so as to form a volume.
  • Adding more spatial dimensions turns the voxels hyper-volumetric,
    making them hypervoxels (there is no shorthand or acronym for this).
  • Adding a time-dimension turns them into temporal voxels,
    making them toxels.

That is the definition of a voxel; and if that all sounded complicated... well that's because it is! Mathematics are like that sometimes.

What is not a voxel?

Every now and then, someone thinks they are dealing/working with voxels, when they're in fact not doing so...

Heightmaps Are Not Voxels

If values are generated in a two-dimensional grid and expanded into a third dimension on-demand, such as during rendering, you are not using voxels.

That's just a plain old heightmap pretending to be voxels!

Important:
This does not mean that columns of values arranged in a grid, like run-length encoded data might be, aren't voxels! The way that voxels are stored does not matter as long as the grid is indexable.

Individual Voxels Have No Position

If one defines individual voxels with an explicit position, like...

struct Voxel {
  position: (i32, i32, i32),
  value: ???
}

...then its not a Voxel, by definition.

It's also really, really bad for performance. Don't do this.

Let me repeat: Don't do this.


What are voxels used for?

Many things, but three of them stick out:

Since you are visiting this wiki, you might already know what you intend to use voxels for; if not, please take some time to think about it, otherwise just read on ahead! :)

For the creation of voxel art, we highly recommend checking out MagicaVoxel, which is currently considered to be the best voxel-editor you can get; it's completely free!

Perhaps share your creation?


Next

Choosing a programming language!