A procedural terrain generator — a faithful functional reconstruction of
terrains.zyfod.dev, built on the same stack
(Vite + React + Three.js, raw WebGL ShaderMaterial).
The terrain engine reuses the original's GLSL verbatim (noise → climate /
biome → height field → albedo / lighting), so a given seed produces the same
world. The default scene (highlands, seed 1337, earth palette) matches
the source.
npm install
npm run dev # http://localhost:5173
npm run build # production bundle in dist/npx playwright install chromium # one-time
node scripts/verify.mjs # boots app, checks for shader/console errors
node scripts/interact.mjs # checks controls drive the enginesrc/
shaders/
lib.js GLSL chunk library (uniforms, noise, climate/biome,
height field, palette, lighting) — extracted verbatim
terrain.js composed terrain vertex + fragment shaders
water.js composed water vertex + fragment shaders
engine/
TerrainEngine.js Three.js scene, board mesh + water plane, ShaderMaterial,
uniform mapping (config -> uniforms), orbit camera, minimap
state/
config.js default config, terrain / noise / palette presets, base
palette — extracted verbatim from the source bundle
ui/ React control panels matching the source CSS
Topbar, LeftPanel, RightPanel, controls, icons
App.jsx wires UI state to the engine
index.css the source stylesheet (byte-for-byte)
- Geography / terrain: preset (7), seed, height scale, sea level, island falloff
- Noise: 9 presets, scale, strength, FBM octaves / persistence / lacunarity / ridge / warp
- Climate & biomes: biome scale, temperature / moisture bias, snow line, biome debug
- Palette: 15 presets recoloring the terrain and water in real time
- Water: animated ripples, foam, depth grading, reflection / detail / wave complexity
- Environment: sun azimuth / elevation, fog, normal strength, AO, wireframe, chunk grid
- Camera: orbit + reset, preview (auto-rotate); minimap top-down preview; PNG export
This is a functional reconstruction, not a byte copy of the original 936 KB bundle. The board (studio) terrain mode is fully implemented; the original's infinite-chunk LOD streaming and first-person walk mode are approximated.