I was disappointed when I found out that the Unity terrain engine did not work properly on mobile devices, so I experimented with a number of different custom solutions. Over time, this project began to evolve into a fractal terrain generator, using simple noise algorithms to produce a randomly generated landscape. Next, I wrote custom shaders to blend between a stony texture and a grassy texture depending on the slope of the terrain. This worked well, but lacked the depth I felt it needed. The final step was implementing the custom shell model used to represent grass. The terrain is rendered multiple times with various vertex offsets in a multi-pass shader, with time and location based fluctuations to emulate wind, and a grass height based on slope, and some user specified parameters.
The system works fairly well, and allows for a simple procedural terrain that can be dropped into any scene.
- A simple landscape generated by the script.
- A close-up of the rendered grass, implemented in the base terrain shader.
- A view of the generated terrain from within the Unity engine.
You can experiment with this script by running the Unity Player here