RTIN (Right-Triangulated Irregular Network) mesh builder for terrain tiles.
This class generates a triangulated mesh from a heightmap using the RTIN algorithm
(https://www.cs.ubc.ca/~will/papers/rtin.pdf), which adaptively subdivides triangles based on
a maximum error threshold to efficiently represent terrain with fewer triangles where possible.
Features:
Supports variable grid sizes (must be 2^n + 1).
Computes per-vertex error metrics for adaptive mesh simplification.
Optionally generates skirts (extra geometry along tile borders) to hide cracks between tiles.
Can force maximum detail along tile edges using the maxEdgeDetails option to avoid visible seams.
Outputs mesh data as flat vertex and index arrays, with optional mapping for skirt vertices.
RTIN (Right-Triangulated Irregular Network) mesh builder for terrain tiles.
This class generates a triangulated mesh from a heightmap using the RTIN algorithm (https://www.cs.ubc.ca/~will/papers/rtin.pdf), which adaptively subdivides triangles based on a maximum error threshold to efficiently represent terrain with fewer triangles where possible.
Features:
maxEdgeDetails
option to avoid visible seams.Usage: const rtin = new RTIN(257, 3); const mesh = rtin.triangulate(heightmap, { maxError: 5, enableSkirts: true, maxEdgeDetails: true });