Pigment map
This script must be added to your terrain object. It generates a color map texture (pigment map) and heightmap (stored in the alpha channel) for the FAE/Grass shader (see shaders section). Which can be utilized in the material to tint the grass by the terrain’s color and have the height taper off where there is no grass texture painted.
This script is compatible with any third-party terrain shader, and will not impair their functionality.
Attaching this script to your terrain will load its pigment map on startup. So it’s possible to be used in multiple scenes. Do note that only one pigment map can be assigned to the grass shader at a time.
Once this map is generated, you can adjust pigment map’s influence on the material (if this is set to 1, without a pigment map present, the grass will appear gray).
If you have selected a terrain material in the “Grass texture dropdown”, the minimum and maximum grass height in any material using the FAE/Grass shader can be adjusted. This is according to how strongly the terrain texture is painted on the terrain.
Multi-terrain setups
To render a pigment map from multiple terrain tiles, add the script to an empty GameObject (preferably the parent object of your terrain tiles). Please note this object must be active in a build, in order to load and assign the pigment map to the grass shader.
Once you’ve done this, a list will appear in the inspector, allowing you to add the terrain objects.
Mesh terrains
The script also works with mesh terrains. However, like Unity terrain’s, the size must be uniform, and the pivot point must be in the corner. If a mesh terrain fails to meet these requirements the pigment map will not line up accordingly.
When using a mesh terrain, option to flip or rotate the pigment map will be available, in case your mesh’s UV’s are set up differently.