Stone Devlog: Chip Off the Old Block

Just a quick update to show what I've been up to. Take a look:


That right there is a Voronoi cell successfully cut out of the mesh of a stone! Looks can be a bit deceiving, though. The remaining "core" is not actually solid, rather it is the remaining cutouts (in this case two) stuck together.


Figuring out a way to stitch those pieces back together is obviously one of the last remaining big ticket items. Unfortunately, there is still a ways to go yet. There are still several outstanding edge cases and bugaboos to sort out with the shattering portion of the algorithm, including a very likely issue with floating point precision. I only got it to cooperate for the above screenshots by rounding every vertex to four significant figures, and even that was not sufficient when introducing additional sites into the Voronoi diagram. It's going to take a bit of time to suss out what I can actually fix without switching from floats to doubles. Who knew computational geometry could be so complicated?

With all that said, this is incredibly promising progress. Imagine striking the above stone along the edge (roughly perpendicular to the angle pictured) and having that shard flake off. The screenshot was the result of three deliberately positioned sites that were used to create a tetrahedralization and subsequent Voronoi diagram. The first site defined the position of the shard that would be removed, while the other two flanked it to define the size and shape. In-game, these sites will be defined dynamically based on player input and the geometry of the rock. Probably easier said than done, but we'll cross that bridge when we get to it.

That's about all for now. I'm heading back into the trenches.