Terrain Blending

About The Product

     Terrain Blending is something that can make or break an environment. All too often games will have linear blends between textures. Linear blending causes the terrain to look fake in many ways. It works if extra grass, or rocks are used to help break cover it up. A better approach is to use heightmaps to determine how two textures should blend. Take for example, a stone walkway with cracks in it. To blend the sand in to the cracks of the stones, you would use a heightmap that describes where the cracks are. The cracks become filled with sand and the tops of the stone have little to no sand on top.

Technical Overview

     Heightmap blending for terrains requires an alpha channel. Ordinarilly you could just pack it in with another texture, or pass it in as it's own texture. Unity's terrain system is only designed for taking albedo from the rbg of texture 1, smoothness from the alpha of texture1, normal map data from the rbg in texture 2, and a single metallic value. Unity strips the strips the alpha from any texture marked as a normal map texture and moves the blue into the alpha channel. Just enough to do pbr.

]

      The workaround was to manually swap the channels, import into unity as a normal map, then assign it to the normal map of the trerrian. After this, the normal map texture can be marked as a standard texture and unity will not reject the normal map since it is already assigned. This allows for using all 4 channels from the second texture slot.