This is the final installment of our procedural island generation series. After building the mesh foundation (Part I), painting elevation hints (Part II), adding mountain detail (Part III), simulating hydrology (Part IV), and colouring the terrain with our biome ramp (Part V), it is time to package the result. CartoKit finishes by baking the terrain into a compact mesh, visualising it through an egui viewer, and exporting artefacts for other tools.
The journey from mathematical representation to visual output ends with three components:
Terrain::from_terrain – a baked mesh carrying elevation, moisture, biome, and river metadata. The debug renderer & viewer – CPU rasterisers that turn the data into diagnostic images. Export helpers – GLB export, PNG captures, and GIF generation built on the same primitives.
Let’s look at each piece.
Baked Terrain Output
Terrain::from_terrain ( src/terrain.rs:368 ) distils the incremental TerrainBuilder state into a reusable asset. The bake step:
Keeps only faces whose centroids lie inside the unit square, trimming the guard ring used during generation.
Copies vertex elevation and moisture into mesh attributes so downstream tools can query them directly.
Tags every face with average elevation, a TerrainType (land vs. ocean), and the coarse BiomeType classification introduced in Part V.
(land vs. ocean), and the coarse classification introduced in Part V. Marks edges as regular, coastline, or river and stores river-flow magnitudes when a RiverSystem is present.
... continue reading