Tuesday, April 29, 2014

So, You Want To Make A Voxel Engine?

Introduction to Voxel Engines:

Voxel terrain provides a few things that simple things that hightmaps cant. First off they are capable of representing complex concave geometries, like caves and tunnels.


Terrain created by heightmap

Terrain created by voxel field

Worlds created by voxel fields can easily be modified. This is why voxel based worlds like those seen in Minecraft and Everquest Next Landmark are so enticing. 
Everquest Next Landmark
Minecraft

Choices. Choices. Choices.

The first choice and most significant choice you'll have to make is the method you'll use to extract surface data (triangles) from your 3D voxel grid. It determines whether your world will be blocky like that of Minecraft or support the smooth hills and sharp featured buildings like those seen in Next Landmark. 

In the following chart I've broken down the pro's and con's of each method:

There are other difference that could have a significant effect on your voxel engine. For instance Dual Contour natively supports a more expressive environment which leads to consistent effects from the operations you do on your 3D voxel grid.

The Second DemoThe First Demo
Different geometries being represented by Dual Contour (on left) and Marching Cubes (on right).

There are more decisions to make like how do store, compression and manage your voxel data. There are plenty of other issues that may arise and further complicate the engine your trying to make. For instance consider the following image:

Notice those annoying repeating patterns in the lava and sand? This is due to a low resolution texture being tiled over a long distance. There are few solutions to this problem, wang-tiles being one of them. The point is that for every addition feature you want to support the complexity of your engine increases.

Papers on each method:

Marching Cubes
Dual Contour
Dual Marching Cubes
Conical Marching Squares


Next posts probably going to be on constructing an atlas that supports wang tiles, and how to incorporate them into your voxel terrain system.

No comments:

Post a Comment