Package Exports
- @genart-dev/plugin-terrain
Readme
@genart-dev/plugin-terrain
Natural landscape element layers for genart.dev — 21 layer types, 114 presets, and 38 MCP tools for AI-agent control. Includes a depth lane system for multi-layer landscape composition and 13 scene recipe tools for instant complete landscapes.
Part of genart.dev — a generative art platform with an MCP server, desktop app, and IDE extensions.
Install
npm install @genart-dev/plugin-terrainUsage
import terrainPlugin from "@genart-dev/plugin-terrain";
import { createDefaultRegistry } from "@genart-dev/core";
const registry = createDefaultRegistry();
registry.registerPlugin(terrainPlugin);
// Or access individual exports
import {
ALL_PRESETS,
getPreset,
filterPresets,
searchPresets,
skyLayerType,
profileLayerType,
fieldLayerType,
rockLayerType,
treelineLayerType,
celestialLayerType,
starfieldLayerType,
cliffFaceLayerType,
snowfieldLayerType,
// ... all 21 layer types exported
} from "@genart-dev/plugin-terrain";Layer Types (21)
Active Layers (9)
| Layer Type | Presets | Description |
|---|---|---|
terrain:sky |
5 | Time-of-day sky gradients with zenith, horizon, and haze colors |
terrain:profile |
6 | Layered ridgeline silhouettes with depth-aware coloring, terrain type, and sub-ranges |
terrain:field |
8 | Vegetation fields with depth-aware marks (grass, wheat, wildflowers) |
terrain:rock |
6 | Natural rock forms (boulder, outcrop, pinnacle, shelf) |
terrain:treeline |
6 | Tree canopy silhouette bands |
terrain:celestial |
6 | Celestial bodies (sun, moon, stars) with glow effects |
terrain:starfield |
5 | Star fields with optional Milky Way band |
terrain:cliff-face |
5 | Vertical cliff/rock wall silhouettes |
terrain:snowfield |
4 | Snow-covered ground with drifts |
Deprecated Layers (12)
These layers are deprecated in v0.5.0 and will be removed in v1.0.0. They are being extracted into dedicated plugins in the v2 roadmap. Calls will continue to work but emit a console.warn deprecation notice.
Moving to @genart-dev/plugin-atmosphere (Phase C):
| Layer Type | Presets |
|---|---|
terrain:clouds |
5 |
terrain:fog-layer |
5 |
terrain:haze |
4 |
Moving to @genart-dev/plugin-water (Phase D):
| Layer Type | Presets |
|---|---|
terrain:water |
5 |
terrain:river |
8 |
terrain:reflection |
4 |
terrain:shore |
6 |
Moving to @genart-dev/plugin-architecture (Phase E):
| Layer Type | Presets |
|---|---|
terrain:building |
6 |
terrain:bridge |
4 |
terrain:path |
8 |
terrain:fence |
4 |
terrain:boat |
4 |
Depth Lane System
All terrain layers support a depthLane property for coordinated multi-layer landscapes. Seven named lanes define depth ordering from farthest to nearest:
| Lane | Depth Range | Typical Use |
|---|---|---|
sky |
0.00 | Sky, celestial bodies |
far-background |
0.00–0.20 | Distant peaks, starfields |
background |
0.20–0.40 | Ridgelines, treelines |
midground |
0.40–0.60 | Fields, rocks |
foreground |
0.60–0.85 | Cliff faces, snowfields |
ground-plane |
0.85–1.00 | Snow drifts, ground cover |
overlay |
full range | Full-canvas overlays |
Each lane supports sub-levels (-1, -2, -3) for fine-grained ordering within a lane. Atmospheric depth is applied automatically — distant layers desaturate and shift toward blue (western mode) or warm paper tones (ink-wash mode).
Presets (114)
Sky (5)
Profile (6)
Each profile preset supports three optional runtime properties that tune the landform character:
terrainType('mountains'|'hills'|'plains') — scales noise amplitude and frequency. Mountains use full amplitude; hills use ~45%; plains use ~15% with compressed frequency.subRangeCount(0–3) — number of sub-range ridges drawn behind the main ridge, adding depth and layering.subRangeAmplitude(0.1–1.0) — scale factor for sub-range ridge heights relative to the main ridge.
Field (8)
Rock (6)
Treeline (6)
Celestial (6)
Starfield (5)
Cliff Face (5)
Snowfield (4)
Deprecated Presets (63)
The 12 deprecated layer types retain their presets for backwards compatibility. See Deprecated Layers for the migration path.
| Layer | Presets | IDs |
|---|---|---|
terrain:clouds |
5 | fair-weather, overcast, wispy-high, storm-clouds, scattered |
terrain:fog-layer |
5 | morning-mist, mountain-veil, valley-fog, shan-shui-cloud-band, coastal-haar |
terrain:haze |
4 | light-haze, golden-haze, cool-mist, heat-haze |
terrain:water |
5 | still-lake, choppy-sea, mountain-stream, river, pond |
terrain:river |
8 | gentle-stream, wide-river, mountain-creek, lazy-oxbow, forest-brook, delta-channels, waterfall-stream, tidal-estuary |
terrain:reflection |
4 | calm-lake, rippled-reflection, dark-water, golden-reflection |
terrain:shore |
6 | sandy-beach, rocky-shore, muddy-riverbank, grassy-bank, tidal-flat, cliff-base |
terrain:building |
6 | farmhouse, church-steeple, tower-ruin, village-cluster, temple, lighthouse |
terrain:bridge |
4 | stone-arch, wooden-footbridge, suspension-bridge, flat-crossing |
terrain:path |
8 | dirt-trail, cobblestone-road, gravel-path, forest-path, mountain-switchback, garden-walk, sand-track, country-lane |
terrain:fence |
4 | white-picket, stone-wall, ranch-rail, wire-fence |
terrain:boat |
4 | sailboat, rowboat, fishing-boat, cargo-ship |
Landscape Composites (6)
Multi-layer scenes combining sky, terrain, clouds, and water:
Scene Recipes (12)
Multi-layer scenes assembled by the scene recipe MCP tools:
Note: Scene recipes that include deprecated layers (clouds, fog-layer, haze, water, river, shore, reflection, building, bridge, path, fence, boat) will emit deprecation warnings at render time.
Examples
The examples/ directory contains .genart sketch files organized by category, with .png thumbnails and .genart-workspace files:
examples/
├── sky/ 5 sky gradient presets
├── profile/ 6 terrain ridgeline presets
├── field/ 8 vegetation field presets
├── rock/ 6 natural rock form presets
├── treeline/ 6 canopy silhouette presets
├── celestial/ 6 sun/moon/star presets
├── starfield/ 5 star field presets
├── cliff-face/ 5 cliff wall presets
├── snowfield/ 4 snow ground presets
├── landscape/ 6 composite scenes
├── scenes/ 12 scene recipe compositions
└── terrain-gallery.genart-workspace (all active sketches)Regenerating examples:
node generate-genart-files.cjs # Create .genart files from presets
node generate-workspace-files.cjs # Create .genart-workspace files
node render-examples.cjs # Render .png thumbnails (requires local CLI)
node generate-galleries.cjs # Create category gallery montagesMCP Tools (38)
Exposed to AI agents through the MCP server when this plugin is registered.
Add Layer Tools — Active (9)
| Tool | Description |
|---|---|
add_sky |
Add a sky gradient layer with time-of-day preset or custom colors |
add_terrain_profile |
Add terrain ridgeline silhouettes from profile presets |
add_field |
Add a vegetation field with depth-aware marks |
add_rock |
Add natural rock forms |
add_treeline |
Add a tree canopy silhouette band |
add_celestial |
Add celestial bodies (sun, moon, stars) with glow |
add_starfield |
Add a star field with optional Milky Way |
add_cliff_face |
Add a vertical cliff or rock wall silhouette |
add_snowfield |
Add snow-covered ground with drifts |
Add Layer Tools — Deprecated (12)
These tools still function but emit a deprecation warning. They will be removed in v1.0.0 when the target plugins are released.
| Tool | Moves To |
|---|---|
add_clouds |
@genart-dev/plugin-atmosphere |
add_fog_layer |
@genart-dev/plugin-atmosphere |
add_haze |
@genart-dev/plugin-atmosphere |
add_water_surface |
@genart-dev/plugin-water |
add_river |
@genart-dev/plugin-water |
add_reflection |
@genart-dev/plugin-water |
add_shore |
@genart-dev/plugin-water |
add_building |
@genart-dev/plugin-architecture |
add_bridge |
@genart-dev/plugin-architecture |
add_path |
@genart-dev/plugin-architecture |
add_fence |
@genart-dev/plugin-architecture |
add_boat |
@genart-dev/plugin-architecture |
Scene Recipe Tools (13)
Complete landscape compositions assembled from multiple layers:
| Tool | Description |
|---|---|
create_landscape |
Sky + terrain profile + optional clouds + water |
create_mountain_valley |
Sky + alpine ridges + fog + treeline + field + haze |
create_river_scene |
Sky + hills + river + shore + treeline + reflection |
create_coastal_moonlight |
Night sky + starfield + moon + water + shore + reflection |
create_park_riverside |
Sky + terrain + river + path + treeline + field + building |
create_shan_shui |
Chinese landscape: sky + peaks + fog + rock + water + haze |
create_pastoral |
Golden-hour countryside: sky + hills + wheat field + path + fence + building + haze |
create_forest_clearing |
Sky + treeline + forest floor + fog + path |
create_alpine_lake |
Sky + alpine range + snowfield + water + reflection + cliff + haze |
create_japanese_garden |
Sky + water + bridge + rock + treeline + reflection + haze |
create_desert_expanse |
Sky + mesa + cliff + field + haze |
create_winter_woodland |
Sky + terrain + snow + treeline + fog |
create_tropical_coast |
Golden-hour coast: sky + water + shore + boat + reflection + haze |
Utility Tools (4)
| Tool | Description |
|---|---|
set_time_of_day |
Update a sky layer to a different time-of-day preset |
list_terrain_presets |
List all 114 presets, optionally filtered by category |
set_terrain_depth |
Adjust depth properties on a terrain profile layer |
set_depth_lane |
Update depth lane assignment on any layer |
Rendering
Each layer type renders via canvas2d:
- Sky — Three-stop vertical gradient (zenith → haze → horizon) with configurable haze band
- Profile — Back-to-front ridgeline silhouettes with fractal noise elevation and depth-aware color interpolation.
terrainTypescales noise amplitude/frequency for mountains, hills, or plains.subRangeCountadds secondary ridges behind the main ridge;subRangeAmplitudecontrols their relative height. - Field — Depth-aware mark generation (grass blades, wheat stalks, flowers) with perspective scaling, constrained to the assigned depth lane vertical extent
- Rock — Procedural rock silhouettes with fractal detail and depth-placed shading
- Treeline — Canopy silhouette generation with per-tree variation and atmospheric coloring
- Celestial — Radial gradient glow with optional lens flare and corona effects
- Starfield — Pseudo-random star placement with brightness variation and optional galaxy band
- Cliff Face — Vertical wall silhouette with horizontal striation marks and depth tinting
- Snowfield — Horizontal coverage bands with drift accumulation noise and sparkle highlights
Utilities
Shared utilities exported for advanced use:
import {
mulberry32, // Deterministic PRNG
createValueNoise, createFractalNoise, // Procedural noise generators
parseHex, toHex, lerpColor, // Color interpolation
darken, lighten, // Color adjustment
applyDepthEasing, // Depth curve functions
resolveDepthLane, // Depth lane resolution
depthForLane, // Lane → depth value
DEPTH_LANE_ORDER, // Lane names in order
DEPTH_LANE_OPTIONS, // UI-ready enum options
} from "@genart-dev/plugin-terrain";Preset Discovery
import { ALL_PRESETS, filterPresets, searchPresets, getPreset } from "@genart-dev/plugin-terrain";
// All 114 presets (51 active + 63 deprecated)
console.log(ALL_PRESETS.length); // 114
// Filter by category
const skyPresets = filterPresets({ category: "sky" }); // 5 presets
const profiles = filterPresets({ category: "profile" }); // 6 presets
const fields = filterPresets({ category: "field" }); // 8 presets
// Filter by tags
const dramatic = filterPresets({ tags: ["dramatic"] });
// Full-text search
const results = searchPresets("mountain");
// Look up by ID
const preset = getPreset("alpine-range");Related Packages
| Package | Purpose |
|---|---|
@genart-dev/core |
Plugin host, layer system (dependency) |
@genart-dev/mcp-server |
MCP server that surfaces plugin tools to AI agents |
@genart-dev/plugin-plants |
Algorithmic plant generation (110 presets) |
@genart-dev/plugin-patterns |
Geometric and organic pattern fills (153 presets) |
@genart-dev/plugin-particles |
Particle systems (15 presets) |
@genart-dev/plugin-atmosphere |
Clouds, fog, haze (v2 Phase C — coming soon) |
@genart-dev/plugin-water |
Water, rivers, reflections (v2 Phase D — coming soon) |
@genart-dev/plugin-architecture |
Buildings, bridges, paths (v2 Phase E — coming soon) |
Support
Questions, bugs, or feedback — support@genart.dev or open an issue.
License
MIT















































































