Landscape splatting
In this tutorial you’ll learn the basics of landscape splatting. Landscape splatting is best described as painting on the landscape. So you can have different textures on 1 landscape. In our tutorial we’ll use rock and grass. We’ll use rock as a base layer, and then we’ll apply grass only on the spots where the alpha value of a third texture is less than 1.

What do we need?
- We’ll need a texture for grass and an integer to keep track of it.
- We’ll need a texture for the rocky surface and an integer to keep track of it.
- We’ll need an alpha texture to overlay the grass on the rock. And an integer to keep track of it.
How do we set this up?
- Of course the texture will need to be loaded. You’ve seen this a couple times already, i won’t go in to depth with it anymore.
- Now we’re going to tell the engine to use splatting. This is done in the next 3 steps:
- We’re going to add the grass texture to the landscape by calling:
The first parameter is of course the texture ID.
The second parameter is the priority or layer number. You can add up to 4 layers of splatting.
The third and fourth parameter are used for tiling. In this case, the texture is tiled 15 times in x, and 15 times in z direction.
The last two parameters are the shift in x and z direction, in this case 0.
- Now we need to give the splatting texture an alpha map and extend it over the whole landscape. We’re doing that by calling this line:
The first parameter is the ID of the alpha texture that should be used for the grass layer.
The second parameter is the ID of the grass texture.
The next two parameters define the starting point of the texture.
The last two parameters define the width and height (/length) of the texture. In this case they’ll be extended over 4 chunks in each direction.
- Last thing we need to do is to tell the landscape that it should use the splatting. We’re doing that in this line:
The first parameter is used to enable or disable the splatting (true is enabled).
The second parameter defines on which chunk the splatting should be enabled. -1 will use splatting on each chunk
The last parameter is the splatting alpha. In our case, it’s 1, since it should splat if the alpha is 1.
How do we render this?
- We can render this scene in exactly the same way as the previous two examples
Things you can add/change yourself
- Try adding another layer of splatting, with for example snow. You’ll need another alpha map and another texture.
- Try moving or scaling the textures around.