Bump mapping for built-in Unity terrain
This is a feature that a lot of Unity users gripe about, so I thought I would post our solution for it. In the .zip file (download below) you’ll find a shader replacement and a C# script for sending the bump maps to the shader.
To use it simply attach the C# script to your terrain object and add the shader replacement in your assets folder. You will probably need to restart Unity after this so that the shader replaces the built-in.
The script allows 4 bump map slots. These slots correspond respectively to up to 4 terrain textures. For each of these bump maps you also need to specify the tile size which should match the same as the terrain texture. You will also notice seperate specular levels for each texture.
It is fully integrated with Unity 3.0′s surface shaders so it reacts correctly with all lights, shadows, etc. It also exposes a means of sending textures and values to the built-in shaders, so let us know what you guys end up doing with this.
Note: The bump maps won’t affect the base map, so you’ll need to set the base map distance high.