Recreating t3ssel8r's 3D pixel art terrain in Godot (C#)

For the past year or so now I’ve been trying to replicate this terrain system by t3ssel8r
(highly recommended watch if you want to help. Read the description, too). It’s pretty complicated and I’ve been struggling pretty hard.

What I know so far is:

  • it’s based on marching squares (NOT marching cubes)
  • it’s a multi-pass algorithm (meaning it does multiple passes to make the full mesh)
  • It uses a 2D heightmap for displacement

Following what I knew, I’ve attempted to get atleast a proof of concept working (atleast generating the terraces you can see in the video). Here’s a github repo containing all my code so far(made in 4.2, may work in earlier versions. Requires a mono build of Godot):

My method currently is:

  • Iterate through heightmap and create a ‘layer’ for each distinct height (heightmap is quantized down to a certain amount of colors. A layer is just a grid of floats)
  • Generate the data for each layer (filling in the grid of points with 1s and 0s with 1 denoting a full cell and 0 denoting an empty cell)
  • Generate the mesh (I use Geometry3Sharp’s DMesh as the initial mesh data structure and then convert to a Godot compatible mesh)

You can see the result if you run the project from Godot and you’ll also see my current issue: holes. There’s random holes all over the place. I have no idea how to fix these and is one of the reasons why I’m posting here now. I’m completely blocked on this.

If anyone that is experienced in procedural mesh generation is reading this and is able to give input, please do!

Extra stuff:
A wireframe view of the terrain from t3ssel8r’s twitter
A different video of the terrain system from t3ssel8r’s twitter