π§ Brains complement: IF an
unreal-engine-skills-managertool (external MCP) exists in this session, call it with{action: "load", skill: "landscape-and-foliage"}for UE domain knowledge on this topic β correct APIs, architecture, best practices β and treat it as the rubric for any review / "best practices" question. If no such tool is available (e.g. running under Claude Code or Codex without that MCP), skip this line entirely and proceed with this skill alone β do NOT attempt the call.
Real-World Terrain Skill
Use terrain_data with the VibeUE API key configured in Editor Preferences β Plugins β VibeUE. Generated files default to the project's Saved/Terrain/ directory.
Aligned workflow at Enchanted Rock
Use longitude β98.819936, latitude 30.505025 and a 3 km square for every step. Heightmaps are now centred exactly on the requested point. Pass exact_center=false for the old off-centre crop on preview and heightmap (up to half a source tile away, about 1 km here). Check the returned alignment (exact or legacy) before overlaying imagery or geometry. Pass landscape_space=true to get_water_features: without it the water coordinates are the ones older builds wrote, with +Y north, mirrored north-south on the landscape.
| Step | Tool call | What to use |
| --- | --- | --- |
| 1. Preview | terrain_data(action="preview_elevation", lng=-98.819936, lat=30.505025, map_size=3) | Read minHeight, maxHeight, suggestedBaseLevel, suggestedHeightScale and alignment. |
| 2. Heightmap | terrain_data(action="generate_heightmap", lng=-98.819936, lat=30.505025, map_size=3, resolution=1009, base_level=0, height_scale=100) | Import the 16-bit PNG at file. For this example the XY scale is 297.619048 cm per quad and Z scale is 200. Use the preview settings if you need a different vertical mapping, and repeat them for the vista. |
| 3. Orthophoto | terrain_data(action="get_ortho_image", lng=-98.819936, lat=30.505025, map_size=3, size=4096, source="auto", band="both") | files.rgb is one stitched quality-92 JPEG. files.canopy is a linear 8-bit PNG vegetation proxy. manifest_file is the saved server manifest (bounds, credit). The result also has size, metres_per_pixel (ground metres per texel: 0.732600733 at 4096), source (naip or mapbox), source_reason, acquisition_years, attribution, license_note, import_hints and uv_formula (and fallback_reason when NAIP failed and the image was restarted from Mapbox). Canopy requires NAIP (United States); elsewhere auto picks Mapbox and only rgb exists. |
| 4. Masks | terrain_data(action="get_feature_masks", lng=-98.819936, lat=30.505025, map_size=3, resolution=1009, layers="surface,landcover,parking,road_distance", prefer="auto") | files (layer β PNG path), resolutions (layer β actual side), layers (layer β channel β meaning), counts, notes, source, import_hints, uv_formula and the saved manifest_file. Surface and landcover are 8-bit RGBA, parking is 8-bit grey, road distance is 16-bit grey in centimetres. Keep all channels linear, preserve RGB under zero alpha, and use lossless compression. |
| 5. Map features | terrain_data(action="get_map_features", lng=-98.819936, lat=30.505025, map_size=3, categories=["roads","buildings","pois"], min_spacing_m=0, max_features=500, prefer="auto") | file holds full vectors, tags, IDs and provenance. The reply gives counts, truncated, notes, source, attribution, license, alignment and first_names (up to five distinct names per category). In the file read ue5_point, ue5_points or ue5_rings for point, line or polygon geometry ({x, y, z} in centimetres, z 0). The first ring is the exterior and subsequent rings are holes. |
| 6. Water | terrain_data(action="get_water_features", lng=-98.819936, lat=30.505025, map_size=3, landscape_space=true, detail="high", min_spacing_m=0) | Read the saved JSON at file for complete lines and rings (ue5_points, ue5_rings: with landscape_space=true on the landscape's axes, north negative Y). The reply lists water bodies, waterways and point counts. Omit both options for the original server detail and spacing (at Enchanted Rock: 14 waterways / 223 points by default, 36 / 439 with detail="high", min_spacing_m=3). Water comes from whole source tiles, so some of it lies outside the landscape square. |
| 7. Vista | terrain_data(action="generate_vista_heightmap", lng=-98.819936, lat=30.505025, map_size=3, resolution=1009, base_level=0, height_scale=100, vista_factor=8) | file and alignment_file (the same numbers as a JSON sidecar) describe a 24 km backdrop (map_size_km). Use suggested_xy_scale (2380.952381 cm), suggested_z_scale (200), fractional inner_rect, and clipped / clipping. Match the playable landscape's centre, Z location and processing settings. |
Keep the returned attribution and license (or license_note) with the saved files and derived assets (map features, masks and orthophotos return them; heightmaps, vistas and water do not). Display imagery attribution when presenting the imagery. get_map_image provides a quick reference picture and list_styles lists its available styles.
Files, sources and waiting
- Every
filepath in a reply is a full path under the project'sSaved/Terrain/. - The default names of heightmap (
heightmap_<lat>_<lng>.png), water (water_features_<lat>_<lng>_<size>km.json) and map features (mapfeatures_<lat>_<lng>_<size>km.json) depend only on the place: a second call with other options (an exact and a legacy heightmap, default and high-detail water) overwrites the first. Passsave_pathto keep both. Masks, orthophotos and vistas get a unique id in their names, and masks and orthophotos ignoresave_path. sourcesays where vectors and masks came from:openstreetmap, ormapbox-streets-v8when the OpenStreetMap servers do not answer (thennotessays so: generalised geometry, roads cut into tile fragments, no building names, no OSM ids).prefer="openstreetmap"fails instead of falling back (HTTP_503, "OpenStreetMap detail unavailable",upstream"Overpass");prefer="tiles"asks for the fallback directly.- Orthophotos take time: a NAIP tile (2048 pixels; a 4096 image has four per band, an 8192 image sixteen) answers in under a second when its render is still warm and in 20-30 s when it is not, so a 4096 image takes about a minute and an 8192 image several. A tile or a mask layer that answers 502, 503 or 504, or does not answer, is asked up to three times. If your client gives up waiting, call again: tiles that finished rendering meanwhile usually come back quickly (measured at Enchanted Rock: 4096 in 45-55 s, 8192 in 3.6 minutes, one tile in each run answered 502 after 30 s and came back on the second try).
Registration and request options
- Import north-first rows with +X east and +Y south, centred at the world origin: north is negative Y. Map features always use these axes; water features do with
landscape_space=true. Without that parameterget_water_featureswrites what it always wrote, +Y north (kept so that existing scripts get the same file): fetch the water again withlandscape_space=true, or negate Y, for use on the landscape. Add the landscape centre offset to vector XY for a translated landscape. - On a 1009-vertex landscape, the summit at (β98.818824, 30.506464) falls at fractional vertex (539.835480, 450.176183), or (+10665.32, β16018.99) cm. Use unrounded XY scale
100000 * map_size / (N - 1)for alignment. - At landscape vertex (i,j), sample a mask or orthophoto of actual side M at
((0.5+i*(M-1)/(N-1))/M, (0.5+j*(M-1)/(N-1))/M), where N is the landscape vertex count per side. Road distance caps M at 2017. - Map features and masks accept up to 40 km and
prefer="auto" | "openstreetmap" | "tiles". Vector categories can be a comma list or JSON array of roads, tracks_paths, railways, buildings, parking, landcover, barriers, pois and water. Omit categories for the server's extent-dependent default. An explicit empty array selects none. - Masks default to 1009 samples and all four layers. Surface packs roads, tracks, water and buildings. Landcover packs rock, woodland, scrub/wetland and grass/agriculture. Parking is a single coverage channel.
- Orthophotos accept sizes 1024, 2048 (default), 4096 and 8192, sources auto, naip or mapbox, and bands rgb (default), canopy or both. Retryable tiles and mask layers get at most three attempts. Auto RGB can restart the entire image from Mapbox if NAIP repeatedly fails.
- Vista accepts the heightmap processing and format options. The outer footprint is
min(100, map_size * vista_factor)km. If applying the clipping report's suggested vertical mapping, regenerate both heightmaps. For a seamless mesh cutout, join the playable perimeter vertices to the first exterior vista row.
Test Prompts
Create a landscape from the terrain around Mount Fuji
Generate a heightmap for San Francisco at coordinates -122.4194, 37.7749
Build a real-world landscape from the Swiss Alps near Zermatt (lng=7.7480, lat=46.0207)
Get the terrain around the Grand Canyon and make a landscape
Generate heightmap for Tokyo at 139.6917, 35.6895 with a satellite reference image
Step-by-Step Example (Mount Fuji)
Step 1 β Preview elevation
terrain_data(action="preview_elevation", lng=138.7274, lat=35.3606)
Response:
{
"minHeight": 340.0,
"maxHeight": 3776.0,
"heightRange": 3436.0,
"suggestedBaseLevel": 340,
"suggestedHeightScale": 27,
"suggestedZScale": 741,
"suggestedXYScales": { "505": 3429, "1009": 1714, "2017": 857, "4033": 429, "8129": 213 },
"tileZoom": 13,
"tileCount": 9,
"alignment": "exact"
}
Preview XY scales are rounded. Use 100000 * map_size / (resolution - 1) for exact registration when calling create_landscape. Use suggestedZScale for the Z scale.
Step 2 β Generate heightmap using suggested values
terrain_data(
action="generate_heightmap",
lng=138.7274, lat=35.3606,
base_level=340,
height_scale=27,
resolution=1009, format="png"
)
Response:
{
"success": true,
"file": "C:/Project/Saved/Terrain/heightmap_35.3606_138.7274.png",
"min_height_m": 340.0,
"max_height_m": 3776.0,
"dimensions": "1009x1009",
"alignment": "exact"
}
Step 3 β Get satellite reference image
terrain_data(
action="get_map_image",
lng=138.7274, lat=35.3606,
style="satellite-v9"
)
Response:
{
"success": true,
"file": "E:/Project/Saved/Terrain/map_satellite_v9_35.3606_138.7274.png",
"style": "satellite-v9",
"size_bytes": 1981147
}
Step 3b β Attach satellite image for vision analysis
β οΈ CRITICAL: After downloading a satellite image, ALWAYS attach it so you can see the terrain colors and features. This lets you make informed decisions about material layers and painting.
attach_image(file_path="E:/Project/Saved/Terrain/map_satellite_v9_35.3606_138.7274.png")
attach_image is a tool call (like terrain_data), NOT a Python function. Do NOT put it inside execute_python_code. Call it directly as a tool. If no attach_image tool is available in your session, skip this step and proceed using the saved file path returned by get_map_image.
After attaching, you will see the satellite image in your next response. Use it to:
- Identify terrain features (rock, grassland, water, sand, forest, urban)
- Choose appropriate material layer names and colors
- Design accurate procedural painting rules (height/slope thresholds)
- Match real-world color distribution to layer weights
Step 4 β Import into UE5
Use the landscape skill to import the heightmap file:
- Component setup:
QuadsPerSection=63, SectionsPerComponent=2, ComponentCount=8x8β 1009Γ1009 resolution - X and Y scale:
100000 * map_size / (resolution - 1)(1714.2857 for a 17.28 km map at 1009;suggestedXYScales["1009"]from preview is the same value rounded to 1714, which is fine until vectors have to line up). Do NOT use the default 100 β that makes the landscape ~17x too small! - Z scale: Use
suggestedZScalefrom preview (e.g. 741 for Mount Fuji) - File: the
.pngpath returned in step 2
Example:
result = unreal.LandscapeService.create_landscape(
location=unreal.Vector(0, 0, 0),
rotation=unreal.Rotator(0, 0, 0),
scale=unreal.Vector(1714.2857, 1714.2857, 741), # XY = 100000 * map_size / (resolution - 1), Z from suggestedZScale
sections_per_component=2,
quads_per_section=63,
component_count_x=8,
component_count_y=8,
landscape_label="MyLandscape"
)
Parameters Reference
generate_heightmap
| Parameter | Default | Notes |
|-----------|---------|-------|
| lng / lat | required | Decimal degrees. Positive = East/North |
| format | png | 16-bit grayscale PNG, big-endian uint16 RAW (byte-swap for native little-endian import), or ZIP containing PNG and info |
| map_size | 17.28 | km β Cities: Skylines standard |
| resolution | 1081 | Samples per side, 33β4097. Pass the landscape's vertex count (505, 1009, 2017, ...) |
| exact_center | true | Centre the square exactly on lng / lat; the reply says alignment: "exact". false = the crop older builds returned (alignment: "legacy"), which does not line up with masks, orthophotos or vectors |
| base_level | 0 | Use suggestedBaseLevel from preview |
| height_scale | 100 | Use suggestedHeightScale from preview |
| water_depth | 40 | Cities: Skylines water units |
| gravity_center | 0 | 0=off, 2=N, 4=E, 6=S, 8=W (tilts terrain for water flow) |
| level_correction | 0 | 0=none, 2=flatten coastlines, 3=aggressive |
| blur_passes | 10 | Adjust per terrain character! 5β10=rugged, 15β25=hills, 25β40=smooth/flat. See Terrain Character Guide |
| plains_height | 140 | Meters β threshold between plains and mountains |
| save_path | auto | Saves to <ProjectDir>/Saved/Terrain/ by default |
get_map_image styles
| Style | Description |
|-------|-------------|
| satellite-v9 | Quick aerial reference |
| outdoors-v11 | Topo with trails and contours |
| streets-v11 | Street map |
| light-v10 / dark-v10 | Minimal |
UE5 Landscape Import Settings
Valid Resolutions β Always Pass `resolution=N`
β οΈ Never use the default 1081Γ1081 for UE landscapes β it requires 36Γ36 components and will timeout. Always pass resolution= matching your landscape config.
| resolution= | Components | Quads | Sections | km at UE scale=100 |
|-------------|-----------|-------|----------|--------------------|
| 505 | 8Γ8 | 63 | 1 | ~0.5 km |
| 1009 | 8Γ8 | 63 | 2 | ~1.0 km |
| 1009 | 16Γ16 | 63 | 1 | ~1.0 km |
| 2017 | 16Γ16 | 63 | 2 | ~2.0 km |
| 4033 | 32Γ32 | 63 | 2 | ~4.0 km |
"km at scale=100" is the UE world size when landscape XY scale = 100 cm/quad (default). Adjust scale to match real geography (see below).
Matching Real-World Scale
terrain_data's map_size (default: 17.28 km) controls the geographic area captured. To make the UE landscape match actual geography:
UE XY Scale (cm/quad) = (map_size_km Γ 100,000) / (resolution β 1)
Example: map_size=20, resolution=2017 β (20 Γ 100,000) / 2016 β 992 cm/quad (~9.9 m/quad)
Set this as the landscape's X and Y scale when creating it.
Format and Z Scale
- Format: 16-bit grayscale PNG
- Z Scale:
20000 / height_scalecm β e.g.,height_scale=27β Z scale β 741
β οΈ ALWAYS calculate Z Scale from height_scale. Do NOT guess. Use this formula when creating the landscape:
z_scale = 20000 / height_scale
For absolute elevations, set the actor Z at local zero to 100 * base_level + 32768 * z_scale / 128 cm. Use the same local datum offset for the inner map and vista.
Derivation: pixel encoding is pixel = elevation_m Γ heightScale Γ 64 / 100 and UE interprets height_cm = pixel Γ z_scale / 128. Setting height_cm = elevation_m Γ 100 (metersβcm) gives z_scale = 20000 / heightScale.
| height_scale | Z Scale | Terrain Type Example |
|-------------|---------|---------------------|
| 27 | 741 | Tall mountains (Mt. Fuji, Alps) |
| 50 | 400 | Moderate mountains (Appalachians) |
| 100 | 200 | Hills, canyons (Grand Canyon) |
| 150 | 133 | Low hills, mesas |
| 200 | 100 | Gentle rolling terrain |
| 250 | 80 | Very flat terrain, gentle domes |
For Cities: Skylines, export as PNG and import via the standard heightmap importer (1081 default is fine there).
Terrain Character Guide
β οΈ CRITICAL: The suggestedHeightScale from preview_elevation maximizes detail, but also amplifies noise. You MUST adjust blur_passes based on the terrain character.
Identifying Terrain Character
After preview_elevation, look at the heightRange and think about what the terrain actually looks like:
| heightRange | suggestedHeightScale | Terrain Character | blur_passes |
|-------------|----------------------|-------------------|-------------|
| > 2000m | Low (< 50) | Rugged mountains β keep default blur | 5β10 |
| 500β2000m | Moderate (50β100) | Mixed terrain β moderate smoothing | 10β15 |
| 100β500m | High (100β200) | Hills/mesas β needs more smoothing | 15β25 |
| < 100m | Very high (200β250) | Flat/gentle β needs heavy smoothing | 25β40 |
Smooth vs Rugged Terrain
Smooth terrain (granite domes, rolling hills, plains, gentle slopes):
- Use higher
blur_passes(20β40) to remove data noise - The high
height_scaleamplifies every pixel of noise β smoothing counteracts this - Examples: Enchanted Rock, Uluru, sand dunes, prairies
Rugged terrain (jagged peaks, canyons, volcanic craters):
- Use lower
blur_passes(5β10) to preserve detail - Lower
height_scalemeans less noise amplification, so less smoothing needed - Examples: Grand Canyon, Matterhorn, Iceland lava fields
Common Mistake: Jagged Smooth Terrain
If you get a terrain that looks jagged/spiky when the real place is smooth:
- The
height_scalewas too high without enoughblur_passes - Fix: Re-generate with
blur_passes=30or higher - Also check: Z scale should be
20000 / height_scale, NOT an arbitrary value like 200
Water Features Reference
get_water_features
Fetches waterways and water bodies from Mapbox vector tiles. Use the exact same lng, lat, and map_size as your heightmap call.
terrain_data(action="get_water_features", lng=-105.0, lat=39.7, map_size=17.28, landscape_space=true)
Response includes:
fileβ path to the saved JSON file (e.g.Saved/Terrain/water_features_42.9720_-71.3480_10km.json)num_waterways/num_water_bodiesβ countswaterway_class_breakdownβ object with class counts, e.g.{"stream": 191, "river": 26, "ditch": 12}waterways[]β summary of each waterway:name,class,estimated_width_m,num_pointswater_bodies[]β summary of each water body:name,class,num_ring_pointsmessageβ instructions on how to use the saved file, coordinate system infoue5_coordinate_noteβ critical info about coordinate offset for water planes
The saved JSON file contains the full data with:
waterways[]β rivers, streams, canals. Each hasname,class,estimated_width_m,points(lng/lat array),ue5_points(array of{x, y, z}objects in UE5 coords)water_bodies[]β lakes, ponds, oceans. Each hasname,class,rings(lng/lat array of arrays),ue5_rings(array of arrays of{x, y, z}objects in UE5 coords)
β οΈ CRITICAL FIELD NAMES:
- Waterway positions:
ue5_points(NOTpointsβ those are lng/lat) - Water body polygons:
ue5_rings(NOTpolygonorring) - Waterway type:
class(NOTwaterway_classortype)
Coordinate system
ue5_points and ue5_rings are landscape-center-relative (origin-centered):
- Map geographic center = (0, 0, Z) in UE5 space, 1 meter = 100 UU,
zis 0 - With
landscape_space=true: +X = East, +Y = South (north is negative Y, as on a landscape imported from the heightmap), the contract's projection, the same axes as map features, masks and orthophotos - Without it (the default, unchanged from older builds): +X = East, +Y = North, which is mirrored north-south on the landscape. The reply's and the file's
ue5_coordinate_notesay which convention a file uses
Troubleshooting
| Issue | Fix |
|-------|-----|
| 429 rate limit | Read the error for the daily request quota or hourly tile/layer allowance and its UTC reset |
| HTTP_503 (or HTTP_502 / HTTP_504 without detail) | An upstream source (OpenStreetMap, NAIP, Mapbox) failed or was too slow; upstream and retry_after_s say which and how long to wait. Call again; for vectors use prefer="auto" |
| Flat heightmap | heightRange < 50m β use height_scale: 250 for detail |
| Clipped mountains | Lower height_scale or increase base_level |
| Jagged/spiky terrain | Increase blur_passes (20β40 for smooth terrain) and check Z scale formula |
| Terrain doesn't match real place | Check terrain character guide β smooth places need high blur_passes |
| Timeout | Reduce the extent, resolution or filter passes for the operation |
| No waterways returned | Area may have no mapped water features (desert, urban grid) β check satellite image |
| Landscape too small | You used XY scale=100 (default) instead of the correct value from suggestedXYScales. Recreate with the correct scale |
| Black screenshots after camera move | Camera inside terrain. Use ActorService.get_actor_view_camera() to frame from TOP view instead of guessing Z height |
| Water features timeout | PBF tile fetch uses 45s timeout β large map_size at high zoom may still be slow |
| Field name errors | Use ue5_points (not points), ue5_rings (not polygon), class (not waterway_class) |