The Procedural Engine

So, I mentioned I wanted infinite, fully destructible terrain. It rings minecraft, but wanted it to be much more advanced and realistic. So originally started off with a Marching Cubes algorithm. 

If you're interested, you can read up about Marching Cubes here. 

It did have some limitations though. Ultimately. It didn't look super realistic, so in the end I chose to go with Dual Contours. This was quite effective..  But still had issues. The biggest killer for me is that when you remove a voxel/spatial point, a large chunk of terrain just disappears. 

The solution. Weight the point. This allowed me to add different volumes at spatial positions allowing for much more free flowing and natural terrain.

Ironically.. I didn't know that at the time.. This is pretty much how most modern games that use volumetric terrain do this. I could have saved myself a fair bit of time on this.

To be honest though. This was probably not the hardest part of all of this. 

Performance. Take the following example

Think about a cube that contains this volumetric data.

A 32 x 32 x 32 cube. effectively 32 cubed, and you need to have a 1 metre marker for every 1m cubed position. This equates to 32,768 points in that 32 metre area. And that's the trick. Standing in the middle of that would be just 16 metres into the distance! (Assuming I was standing right in the middle). Now Let's assume for 1024 metres in the distance from the player/person. 

Let's assume it was a 1km square radius... That's now a massive 4,194,304 spatial points to perform calculations on! That's not even considering the full radius, just looking in a straight line. This doesn't even take into account height and depth.

Anyway, suffice to say, it becomes very expensive with massive data sets very quickly...

Anyway, there are still performance issues I need to work on with it. Mostly only an issue if I need to implement flying... which isn't a high priority function at the moment.

Up Close
For the record, I am trying to keep some detail out. Conversations for further blogs, but from the above view, it's working relatively well. Quite seamless and effective.
From Above

We can see some tearing. This is more related to the distance and LOD2 (Effectively I reduce the resolutions of the calculation to load items from the distance more). Needs to be fixed, but the intent isn't to have players up this high so not super extreme.


Either way, progress I am relatively happy with. Intending to leave as is for now and come back to it when I'm ready to apply strong polish.