Hello friends,
Each time when I am going to create some game I end with a tool for games or assets creation. Meet another one: the Terrar.
Terrar is a modular terrain generation system built with TypeScript. It provides a complete pipeline for creating, visualizing, and exporting digital landscapes with a clean, modular architecture. The project demonstrates production-ready engineering with thoughtful separation of concerns, comprehensive export capabilities, and seamless Babylon.js integration.
The library is structured around several focused packages, each serving a distinct purpose:
1. terrar/builder – The Render-Agnostic Terrain Engine
- In-memory terrain asset construction
- Heightmap, flow map, river map, lake map, and sediment map generation
- Resource distribution mapping (coal, iron, copper)
- Combined water and resources maps
- Terrain serialization and deserialization
- POI (Points of Interest) and road data generation
Noise defines the landform, erosion and hydrology make it believable, planners place gameplay features, and the renderer turns the cached snapshot into chunked LOD meshes.
More info about the world systems
terrar/HOW_IT_IS_DONE.md at main · eldinor/terrar · GitHub
The builder produces a TerrainAsset – a canonical runtime contract containing complete terrain data. This format is render-agnostic, meaning the same terrain data can be visualized in different engines without regeneration
Terrar employs a chunk-based terrain architecture, which is essential for handling large-scale worlds efficiently. Chunk-based architecture naturally supports level of detail (LOD) systems where chunks farther from the camera can be rendered at lower resolution while nearby chunks maintain full detail.
Terrar includes infrastructure for high-performance terrain processing through SharedArrayBuffer support and an implied worker pool architecture. These work together to enable true parallel chunk processing with additional chunk stitching. So it is really fast, for the volume of data used.
The export creates a well-organized directory:
my-terrain/
manifest.json # Metadata about the export
terrain.asset.json # Complete terrain data
poi.json # Points of interest
roads.json # Road networks
maps/ # PNG format maps
heightmap.png
flow.png
river.png
lake.png
sediment.png
resource-coal.png
resource-iron.png
resource-copper.png
water-combined.png
resources-combined.png
2. terrar/babylon – The Visualization Adapter
A dedicated adapter renders the render-agnostic terrain asset into a Babylon.js scene:
import { renderTerrainAsset } from "terrar/babylon";
const adapter = renderTerrainAsset(scene, terrain);
adapter.mount();
The adapter updates the terrain system based on the current camera position, managing chunk loading, LOD transitions, and occlusion. The number of draw calls with properly tuned LOD values is very low. The suspended rendering utlitiy stops render at demo page if there are no user interactions.
Use Cases
Game Development – Procedural world generation with Babylon.js rendering
Asset Pipeline – Generate terrain assets for export to game engines
Simulation – Terrain data for environmental or geospatial simulations
Visualization – Real-time terrain visualization with Babylon.js
Tooling – Build custom terrain generation tools and pipelines
The next evident step would be a Terrain Editor. I also think that the adapter could be easily ported to Babylon Lite. The texturing currently is done with 256*256 procedural textures (or user textures if chosen) and also may be improved.
Feedback and PRs are welcome!


