I am making an infinite procedural terrain for my game and currently trying to apply textures to it. The generated terrain has different biomes, so I want to texturize the terrain based on biome and have different textures applied based on the steepness and height of the terrain. I also have different areas generated, such as settlements and also roads so I want to apply specific textures to specific places like those as well.
Unity terrain only supports I think 8 layers, but generally, it should be around 4 for 4 channels? In my case I generate a custom mesh, so I don’t really need to worry about this, however, I am trying to figure out how to generate some sort of texture map (splatmap), and have lots of textures in it. I want to use (albedo, normal, height) for each ‘layer’. Considering that the biomes are generated based on the noise map and each chunk can have many different biomes in it, I need to have more than 4 layers available. For example, steep areas like cliffs will need to have a rocky texture applied and each biome will have a different rocky texture. So if a chunk has two biomes in it, there are lots of different textures that need to be used, including various misc textures for paths and settlement grounds, etc.
Something like this, where a single chunk mesh has for example two biomes. Also, the terrain has a settlement that has a dirt texture applied to the terrain, which extends to both biomes. So essentially, lots of textures in just one mesh.
The other chunk(s) can have similar biomes or even completely other types of biomes. Also, would like to perhaps add the ability to apply different textures to a specific position on terrain chunk at runtime, for example, if the player would want to create a path or if a specific object is placed that would spread some specific texture around the object on the terrain. Something like this for example, where a placed tree has spread some leaf ground texture around:
So, I am looking for a flexible way in applying various different textures to generated terrain mesh. I would like to do that in the script when I am generating a chunk, so I would know which biomes is it at the position and as well as things like steepness and etc.
I am using Shader Graph to create the terrain shader. I’m not really experienced with shaders, so would like to ask for some help on what would be the correct way to achieve something like this?