Demo video: here.
-
Reads SRTM
.hgtelevation tiles- Height samples are stored as 2-byte integers in a 1201×1201 grid (SRTM 3 arc-second tiles).
- The tile name encodes its geographic bounds (e.g.
N20E100.hgtcovers 20°N–21°N and 100°E–101°E). - Elevation values can be mapped to colors (no-data areas remain transparent).
-
Computes a Voronoi diagram (Fortune’s algorithm)
- Uses the Fortune sweep-line approach to split the plane into non-overlapping convex polygons.
- Data structures:
- Priority queues for site/circle events
- A red–black tree to maintain the “beach line” (parabolic arcs)
- This implementation is written in Java and was adapted from a C# codebase.
-
Builds a renderable surface (mesh)
- For each Voronoi cell / site, determines the neighboring sites.
- Sorts neighbors by angle around the site to build consistent triangles.
- Produces a triangle mesh suitable for OpenGL rendering.
-
Renders in OpenGL (LWJGL)
- GPU shaders are stored in
res/shaders. - Meshes are optimized for rendering with OpenGL.
- GPU shaders are stored in
src/— Java source code (Voronoi/Fortune algorithm, data loading, rendering)res/shaders/— GLSL shadersdata/— input data (place.hgttiles here)img/— images/screenshots for documentationlwjgl_linux/— LWJGL native binaries for Linuxlwjgl_win/— LWJGL native binaries for Windowsout/— build artifacts (recommended to exclude from Git)Map3DProject.iml— IntelliJ IDEA project file
- A recent JDK (11+ recommended)
- IntelliJ IDEA (recommended, since the repo contains an
.imlproject) - OpenGL-capable GPU/driver
Note: LWJGL native binaries appear to be bundled in
lwjgl_linux/andlwjgl_win/.
- Clone the repository.
- Open the project in IntelliJ IDEA (it should pick up
Map3DProject.iml). - Ensure
src/is marked as Sources Root. - Configure LWJGL:
- Add LWJGL JARs to the project/module dependencies (if not already configured).
- Set VM option to point to the native libraries directory:
- Linux:
-Djava.library.path=./lwjgl_linux - Windows:
-Djava.library.path=./lwjgl_win
- Linux:
- Find the entry point:
- Search in
src/for a class containing:public static void main(String[] args)
- Run that class.
- Search in
- Put your SRTM
.hgttiles intodata/. - Update the code/config (where the tile name is selected) to point to your tile, e.g.
N20E100.hgt. - Run the application.
-
Elevation tile → height field
- Reads the 1201×1201 grid of 16-bit samples.
- Optionally maps elevation to color/alpha for visualization.
-
Sampling / sites
- Selects/uses a set of points (sites) to build a Voronoi diagram over the area.
-
Voronoi (Fortune) → adjacency
- Fortune sweep-line constructs Voronoi edges and neighbor relationships.
-
Adjacency → mesh
- For each site:
- take neighbors
- sort by polar angle
- triangulate fan around the site
- Emit triangle list for GPU
- For each site:
-
Mesh → OpenGL
- Upload vertex/index buffers
- Render with GLSL shaders (
res/shaders)
- Fortune’s algorithm implementation in Java (adapted from a C# codebase).
- SRTM elevation tiles are a NASA/USGS data product (see SRTM documentation for dataset licensing/usage).