Voronoi-based terrain generator with biome coloring, river networks, and texture export for 3D rendering.
Built for MATH 437 - Computational Geometry (Batsambuu Batbold, December 2025).
The blog post: https://basabu1.github.io/Map-Generation/
The 2D demo: https://basabu1-map-generation-app-fut9qy.streamlit.app/
- Geometry - random points → Lloyd relaxation → Delaunay triangulation → Voronoi regions
- Elevation - multi-octave Perlin noise with land-anchor distance falloff; supports random or custom anchor placement
- Biomes - 10 biomes (altitude x moisture lookup) with Gaussian-blended transitions
- Rivers - priority-flood drainage routing, two-pass selection (main rivers + tributaries)
- Export - 16-bit heightmap, colormap, and river mask
pip install -r requirements.txtPython 3.10+ required.
python main.pySliders for seed, noise scale, water level, and land centers - instant preview.
streamlit run app.pySame controls in a browser UI with random/reset buttons, custom anchor presets, and caching.
python export.pyReproducible export example:
python export.py --seed 123 --points 50000 --resolution 4096 --water-level 0.35 --noise-scale 4.0 --land-centers 5Written to outputs/ by default:
| File | Description |
|---|---|
heightmap.png |
16-bit grayscale elevation |
colormap.png |
RGB biome texture with rivers |
rivermap.png |
Grayscale river mask for shaders |
| Path | Purpose |
|---|---|
map.py |
Terrain model - geometry, biomes, hydrology, texture export |
main.py |
Desktop Matplotlib viewer with parameter sliders |
app.py |
Streamlit web UI |
export.py |
CLI texture exporter |
lloyd/ |
Vendored Lloyd relaxation library |
Delaunator-Python/ |
Vendored Delaunay triangulation library |
report/ |
Quarto report source and figures |
- Delaunator: https://github.com/mapbox/delaunator
- Lloyd package: https://github.com/duhaime/lloyd
- Red Blob Games terrain articles: https://www.redblobgames.com/maps/terrain-from-noise/