Skip to content

Procedural Hydrology / River / Lake Simulation

Notifications You must be signed in to change notification settings

Roipo/SimpleHydrology

 
 

Repository files navigation

SimpleHydrology

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

Banner Image

Compiling

Use the makefile to compile the program.

make all

Dependencies

Erosion System:
- gcc
- glm
- libnoise

Renderer (TinyEngine):
- SDL2 (Core, Image, TTF, Mixer)
- OpenGL3
- GLEW
- Boost
- ImGUI (included already as header files)

Usage

./hydrology [SEED]

If no seed is specified, it will take a random one.

Controls

- 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

Screenshots

Example Output Example output when simulating on semi-rugged terrain.

Hydrology Map Example of a generated hydrology map.

Terrain Render Corresponding rendering of the terrain.

Reading

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.

License

MIT License.

See my website for a more detailed copyright notice.

About

Procedural Hydrology / River / Lake Simulation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 78.0%
  • C 21.8%
  • Other 0.2%