Skip to content

feat(terrain): renderoni/terrain — tiled heightfield cache and streamed LOD mesh - #40

Open
cmaycumber wants to merge 1 commit into
elemarin:mainfrom
cmaycumber:feat/terrain
Open

cmaycumber wants to merge 1 commit into
elemarin:mainfrom
cmaycumber:feat/terrain

Conversation

@cmaycumber

Copy link
Copy Markdown

A new renderoni/terrain entry point for large procedural worlds, extracted from a shipping game.

  • TiledHeightfield: caches a caller's analytic height function in lazily filled, LRU-evicted tiles. Subclass it and override analytic (and optionally sampleExtra for extra cached channels). It provides bilinear heightAt, slopeAt with a tile-free coarse mode, prewarm, channel() and stats. Tiles are a pure function of the sampler, so an evicted tile rebuilds bit-identically, which keeps determinism.
  • TerrainMesh: streamed, chunked, distance-LOD three.js terrain over any HeightSource. It has skirts against cracks, a per-update build budget, unloading, any material, and a TerrainShading callback for per-vertex attributes (colour, texture-layer weights). Picking uses loaded chunks with an analytic raymarch fallback (floor and ceiling options for water).
  • TileCache and Buckets: exported for reuse.

This is presentation and caching only; it never writes simulation state. The game's own renderer now runs on TerrainMesh, and its chunk geometry was checked value by value against the original implementation at every LOD.

Verification: typecheck, build, 243/243 tests.

🤖 Generated with Claude Code

…ed LOD terrain mesh

TiledHeightfield caches a caller's analytic height function in lazily filled,
LRU-evicted tiles (bilinear heightAt, slopeAt with a tile-free coarse mode,
prewarm, extra cached channels). Tiles are a pure function of the sampler so
evictions rebuild bit-identically. TerrainMesh streams chunked, distance-LOD
three.js terrain with skirts, a per-update build budget, unloading, any
material, per-vertex attribute callbacks, and ray picking with an analytic
raymarch fallback. TileCache and Buckets are exported on their own.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant