Making nice voxel based system similar to the game Enshrouded
In this post we are going to explain to you why we spend so much time on creating hundreds of graphical pieces like these:
In our game we want to allow players to add and remove different blocks that automatically transform into pleasant landscapes. The easiest way to implement this functionality is with marching cubes algorithm.
Classical marching cubes algorithm looks like that:
You see, the classical marching cubes algorithm is used for creating smooth surfaces from a set of filled or empty points on a grid.
Here is an example of an application of marching cubes algorithm to visualize a statue:
To achieve that smooth surface, the algorithm goes through all the spaces between the points on the grid and considers 8 potential neighbors for that space (or a slot). Each neighbor may be filled or may be empty. In total it gives us 256 potential combinations of the neighbors.
The marching cubes algorithm establishes a mapping between these 256 combinations of the neighbors and smooth surfaces. Here is an example:
So the only thing that we need to change in our game is to create a similar mapping between these 256 combinations of the neighbors and stylized surfaces.
After doing that we may get these nice results:
Of course creating these 256 configurations is not an easy task, but there are multiple shortcuts that may be used to reduce the number of unique graphical pieces. For example – we don’t need to develop new pieces if we can get them from already created pieces by rotation or mirroring.
Rotations:
Mirroring:
Moreover, in some cases there is more than one solution for the pieces that are diagonally connected.
Here is an example of two possible solutions:
The game developer may choose from these two solutions with relatively low impact on the gameplay. Certain solutions require developing less geometries than others. For example, solution 2 may be created by a combination of more simple solutions.
That means that we may use Solution 2 over Solution 1 to reduce the number of unique pieces we need to develop.
After all these simplifications we got only 34 unique graphical pieces that we need to develop.
In the next video we will explain to you why most of our graphical pieces are covered in red color, while almost nothing in our game is red.
If you like what we are doing, please feel free to subscribe to our YouTube channel: Catiger Studio, or our newsletter down below.
1 thought on “Marching Cubes In Games”
Hello! I simply would like to offer you a huge thumbs up for the great information you have right here on this post. I will be coming back to your blog for more soon.