After writing my last devlog post I laid out a roadmap of mini-releases that I wanted to follow that would incrementally add more systems to my game idea, give fast visual feedback and take me to the fun faster. Since my game takes place on a gameboard, it seemed fitting that the first place to start would be to implement the terrain using splatting.
For this first test I wanted a flat terrain made of multiple Materials like rock, grass, and sand. I didn’t really care about elevation at this point and I didn’t care about realistic distribution of Materials in the terrain. My goal for the test was to have a system in place that generated terrain and displayed information about the Materials that made up the terrain.
Terrain Splatting Implementation
The most visual way I could think of to display the materials was to have a texture assigned to each Material and render the sections of the terrain that have that Material using the Material’s texture. The problem is that I didn’t want to have square sections of terrain with discrete tiles. I wanted the terrain to blend from one texture to another. So after a bit of research I decided to use Splatting.
For the curious, there’s an article that explains how to implement Splatting at the bottom of this post. Unity does do Splatting out of the box, but I thought it would be quicker to write a small terrain generator that did exactly what I wanted than it would be to learn to bend Unity’s terrain system to my procedural generation needs.
The results are pretty nice. Here are some screen shots of my testing.
Camera Control and Debugging info.
- Terrain Texture Compositing by Blending in the Frame-Buffer by Charles Bloom