C++ implementation of a particle based procedural hydrology system for terrain generation. This extends simple particle based hydraulic erosion to capture streams and pools.
Rendered using my homebrew TinyEngine.
Link to a blog post about this
Use the makefile to compile the program.
make all
Erosion System:
- gcc
- glm
- libnoise
Renderer (TinyEngine):
- SDL2 (Core, Image, TTF, Mixer)
- OpenGL3
- GLEW
- Boost
- ImGUI (included already as header files)
./hydrology [SEED]
If no seed is specified, it will take a random one.
- Zoom and Rotate Camera: Scroll
- Toggle Pause: P (WARNING: PAUSED BY DEFAULT!!)
- Change Camera Vertical Angle: UP / DOWN
- Toggle Hydrology Map View: ESC
- Move the Camera Anchor: WASD / SPACE / C
Example output when simulating on semi-rugged terrain.
Example of a generated hydrology map.
Corresponding rendering of the terrain.
The main file is just to wrap the OpenGL code for drawing. At the very bottom, you can see the main game loop that calls the erosion and vegetation growth functions.
The part of the code described in the blog article is contained in the file water.h
. Read this to find the implementation of the procedural hydrology.
The trees are implemented in vegetation.h
.
All of the code is wrapped with the world class in world.h
. The bottom of this file contains a bunch of stuff relevant for rendering, but not the erosion system.
The rest is shaders and rendering stuff.
MIT License.
See my website for a more detailed copyright notice.