A Splatmap (or Weightmap) is a control texture that tells the terrain shader which texture to draw where. This is how games achieve smooth transitions between grass, sand, and rock without creating thousands of unique textures.
A standard Splatmap uses the four color channels of a texture as weights for four different detail textures:
In the shader, we sample all four detail textures and multiply them by their respective weight from the Splatmap.
// Sample the control texture
float4 weights = tex2D(_SplatMap, i.uv);
// Sample the detail textures
float4 grass = tex2D(_GrassTex, i.worldPos.xz * _Tiling);
float4 dirt = tex2D(_DirtTex, i.worldPos.xz * _Tiling);
float4 rock = tex2D(_RockTex, i.worldPos.xz * _Tiling);
float4 snow = tex2D(_SnowTex, i.worldPos.xz * _Tiling);
// Blend them
float4 final = (grass * weights.r) + (dirt * weights.g) +
(rock * weights.b) + (snow * weights.a);
The 4-texture limit of a single RGBA splatmap is a common bottleneck.
You don’t have to paint splatmaps by hand. You can generate them based on the terrain’s geometry: