Terrain textures and terrain generation

01.09.2009

Some of you have been curious about methods of terrain generation used in Driftmoon as compared to Notrium, so here's a brief explanation of what anybody interested in map editing can expect.

First of all, blending. When we're dealing with natural landscapes, we expect our terrain textures to blend into each other. I did this in Notrium by blending the texture with different vertex alphas. The picture below from Notrium shows a location where it looked good. The whole world was divided into squares with each square assigned a texture. If the texture next to the square was different, we blended one side of the texture using different vertex alpha values.

terrain_notriumScreenshot from Notrium

And below here is where the Notrium method failed. Sometimes it was not possible to achieve a smooth look in corners, especially if the textures had very different colors.

terrain_notrium2Screenshot from Notrium

And below here is what we've done with Driftmoon. The blending effect is achieved by methods called texture baking and texture splatting. The world is divided into quite small rectangles, with each assigned a texture. For each texture, an alpha map is generated, and finally using this alpha map a complete texture is rendered. The end result is that no matter how many or complex textures you use in the terrain, it won't affect rendering speed. Since Driftmoon maps can be quite large, we actually generate the terrain textures on the fly as the player moves around in the world. An additional bonus is that we can bake in things such as seashells and grass patches without any hit to the framerate.

terrain_driftmoon Blending textures in Driftmoon

One more problem with the terrain rendering in Notrium was that it was not possible to turn the texture blending off. You might want to do this if you created a house in the middle of a grass field, and didn't want the floor boards to blend into the grass. In Driftmoon this is solved by the ability to create sharp edged floors, such as the black/white rectangle in the picture above.

As for actually drawing the terrain, some of you may remember that in Notrium the terrain was randomly generated unless you specified some texture in an area. This random generation was nothing more than a few randomly generated circles filled with a random texture, and would have been much better using for example a Perlin Noise algorithm. In Driftmoon my intent is to hand generate all of the content, and leave nothing to chance, so there is no random generation for the terrain textures. In my opinion you can hardly get enough interesting randomly generated content, even if you spent the exact same amount making the algorithm as you would spend hand working the terrain.

blog comments powered by Disqus