For the final project of a computer graphics class, I created a framework for generating procedural terrain. The basic idea is to create a fully featured and realistic terrain automatically, with the option of user interaction at every step.
The framework follows the following steps:
- Create an initial island shape
- (optionally) edit the terrain using feature curves to add hills, mountains, cliffs, riverbeds,…
- simulate water erosion to increase the realism
- assign biomes and plant trees and grass
This video shows the final output on a small scale
The project is open-source, hosted on https://github.com/shamanDevel/ProceduralTerrain.
You can use the code for free (as long as you respect the Apache licence).
For all implementation details, the third-party libraries that I’ve used and the paper that I’ve implemented, I refer to the Paper that I’ve written about it.
The four processing steps are shown in detail in the following four movies:
Step 1: from an initial island shape in 2d to the first terrain heightmap:
Step 2: adding features (hills, mountains, cliffs, …) by specifying feature curves:
Step 3: simulating water erosion, this creates riverbeds and adds small details and roughness to the terrain
Step 4: assign biomes, add grass (the forester still works) and trees (impostors)
This is a work in progress, use with care. However, I don’t know how much time I will spend on this project in the future (course is over).
- Tree impostors are not correctly generated from the high-poly models, the transition is still visible
- improve paging of trees, I often run out of memory when there are too many high-poly trees in the scene
- support more grass variation and better close-up rendering
- draw rivers and lakes, I already get all the flow data from the erosion simulation
- port the feature solver and erosion solver to the gpu, the cpu implementations do not run in realtime