Martini
A JavaScript library for real-time RTIN terrain mesh generation
Install / Use
/learn @mapbox/MartiniREADME
MARTINI
MARTINI stands for Mapbox's Awesome Right-Triangulated Irregular Networks, Improved.
It's an experimental JavaScript library for real-time terrain mesh generation from height data. Given a (2<sup>k</sup>+1) × (2<sup>k</sup>+1) terrain grid, it generates a hierarchy of triangular meshes of varying level of detail in milliseconds. A work in progress.
See the algorithm in action and read more about how it works in this interactive Observable notebook.
Based on the paper "Right-Triangulated Irregular Networks" by Will Evans et. al. (1997).

Example
import Martini from '@mapbox/martini';
// set up mesh generator for a certain 2^k+1 grid size
const martini = new Martini(257);
// generate RTIN hierarchy from terrain data (an array of size^2 length)
const tile = martini.createTile(terrain);
// get a mesh (vertices and triangles indices) for a 10m error
const mesh = tile.getMesh(10);
Install
npm install @mapbox/martini
Ports to other languages
- pymartini (Python)
Related Skills
node-connect
334.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
82.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
334.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
82.2kCommit, push, and open a PR
