Skip to content
Back to skills

Terrain3d

ASecurity

Build large 3D landscapes in Godot 4 with Terrain3D (MIT GDExtension by TokisanGames): install and set up the Terrain3D node and its data directory, sculpt and paint in the editor, import EXR/R16 heightmaps, prepare packed texture sets, scatter foliage with the instancer, configure collision and navigation, and generate, query or edit terrain from GDScript (get_height, import_images, set_height, update_maps). Use when a Godot project needs open-world terrain, heightmaps, landscape sculpting, ...

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 22, 2026
ai-agentsgoc++c#nodegitapiperformancedocumentation

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned November 22, 2026

npx -y skills add jasonmello/pixelstrata --skill terrain3d --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Terrain3d?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Terrain3d
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/jasonmello-terrain3d/badge)](https://www.skillsdirectory.com/skills/jasonmello-terrain3d)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: terrain3d
description: >
  Build large 3D landscapes in Godot 4 with Terrain3D (MIT GDExtension by TokisanGames): install
  and set up the Terrain3D node and its data directory, sculpt and paint in the editor, import
  EXR/R16 heightmaps, prepare packed texture sets, scatter foliage with the instancer, configure
  collision and navigation, and generate, query or edit terrain from GDScript (get_height,
  import_images, set_height, update_maps). Use when a Godot project needs open-world terrain,
  heightmaps, landscape sculpting, terrain texturing or foliage, or mentions Terrain3D,
  Terrain3DData, Terrain3DAssets, Terrain3DInstancer, region files or clipmap terrain.
---

# Terrain3D

[Terrain3D](https://github.com/TokisanGames/Terrain3D) (MIT) is a C++ GDExtension clipmap terrain
for Godot. Latest release **v1.1.0** supports **Godot 4.5–4.8+** (v1.0.2: 4.4–4.7). It allows up
to 32 textures and terrains from 64 m to 65.5 km across. Usable from GDScript, C# (bindings since
1.1) and other languages through ClassDB. Docs: https://terrain3d.readthedocs.io

## When to use

- Outdoor 3D levels: open world, survival, racing, RPG overworld, pixel-sprites-in-3D landscapes.
- Importing a real or generated heightmap, procedural terrain from noise, runtime digging/holes.

**Not this skill:** caves and overhangs (Terrain3D is a heightfield; use meshes or Zylann's
godot_voxel); small hand-built arenas (use meshes + `godot-3d-essentials`); 2D tilemaps →
`godot-tilemap`. Materials for the texture layers → `material-maker`. Physics engine settings →
`jolt-physics` / `godot-physics`.

## Workflow

1. **Match the version** to the project's Godot version (`project.godot` → `config/features`).
   Godot 4.4 needs Terrain3D 1.0.x. Read the release notes before upgrading a project, because
   1.0 → 1.1 changed APIs.
2. **Install.** AssetLib → search "Terrain3D" → pick the TokisanGames entry for your Godot version
   → install `addons/` (and `demo/` to learn) → Project Settings → Plugins → enable Terrain3D.
   Or copy `addons/` from the GitHub release zip. Run Godot's console build to see errors. Open
   `demo/Demo.tscn` (F6) to check it works. To upgrade, close Godot before replacing the folder.
3. **Create the terrain.** Add a `Terrain3D` node, set **Data Directory** to an empty folder (one
   folder per terrain), and save `material` and `assets` as `.tres`. Region data is saved as
   `terrain3d±XX±YY.res` files (`terrain3d_00_00.res`, `terrain3d-01_02.res`; `_` means +).
4. **Set the scale before sculpting.** `region_size` (64–2048, default 256), `vertex_spacing`
   (1.0 = one vertex per meter; raise it for bigger, lower-poly worlds).
5. **Textures** (format below), then **sculpt and paint** in the editor (hotkeys below).
6. **Collision:** default `DYNAMIC_GAME` is fastest. Use `FULL_*` only if a plugin needs the whole
   shape. Collision exists only inside regions.
7. **Navigation:** paint navigable areas (N), run Terrain3D menu → *Set up Navigation*, then bake
   with the **Terrain3D baker**. The stock NavigationRegion3D bake button ignores the terrain.
8. **Foliage:** add meshes as `Terrain3DMeshAsset`s, paint with the Instances tool (I) or place
   from code. Instances have **no collision**. Put trees you can bump into in real scenes.

## Textures

Each texture set is **two images**: albedo RGB + height in A, and normal RGB + roughness in A
(1.1 can pack AO too). Every albedo shares one size/format, and every normal shares one
size/format. Normals must be OpenGL (+Y). Use Terrain3D menu → *Pack Textures* to build them from
separate maps (for example a `material-maker` export at matching sizes). Import PNGs as VRAM
Compressed, mipmaps on, Normal Map **disabled**. DDS (BC3 with mipmaps) is desktop only. Missing
mipmaps or uncompressed textures are the number-one performance problem.

## Editor hotkeys (terrain selected, mouse in viewport)

E region · R raise/lower · H height · S slope · B paint base texture · V spray overlay · A
autoshader · C colour · W wetness · N navigation · X holes · I instances. Ctrl/Cmd+click inverts,
Shift+click smooths, Alt+click is the alternate mode. `[` `]` change brush size, `-` `=` change
strength. Overlays: 1 region grid, 3 contour lines, 4 slope colours, 5 vertex grid. Ctrl+S saves
the scene and terrain data.

## Heightmaps

Use `addons/terrain_3d/tools/importer.tscn`: select the Importer node, set options in the
Inspector, then Run Import. **EXR** (32/16-bit float with real heights) is best. **R16/RAW** needs
the height range and size entered by hand. **8-bit PNG terraces**, so convert 16-bit PNGs to EXR.
A flat result usually needs `import_scale` around 300–500. Region size must exceed image width /
32. Export maps from the same tool; the file extension picks the format.

## GDScript

```gdscript
@onready var terrain: Terrain3D = $Terrain3D

# Height and normal at a world position (NaN at holes and outside regions)
func ground_at(pos: Vector3) -> float:
    var h := terrain.data.get_height(pos)   # get_surface_height(pos) = visible height
    return pos.y if is_nan(h) else h

# Keep an actor on the ground
func _physics_process(_d: float) -> void:
    global_position.y = maxf(global_position.y, terrain.data.get_height(global_position))

# Ray against the terrain without physics
var hit := terrain.get_intersection(cam.global_position, -cam.global_basis.z)
```

Procedural generation (from the official `CodeGenerated` demo):

```gdscript
var terrain := Terrain3D.new()
add_child(terrain, true)
terrain.material.world_background = Terrain3DMaterial.NONE
terrain.material.auto_shader_enabled = true
terrain.assets.set_texture_asset(0, grass_ta)          # Terrain3DTextureAsset
terrain.assets.set_texture_asset(1, rock_ta)

var noise := FastNoiseLite.new()
noise.frequency = 0.0005
var img := Image.create_empty(2048, 2048, false, Image.FORMAT_RF)
for x in 2048:
    for y in 2048:
        img.set_pixel(x, y, Color(noise.get_noise_2d(x, y), 0, 0, 1))
terrain.region_size = Terrain3D.SIZE_1024
terrain.data.import_images([img, null, null], Vector3(-1024, 0, -1024), 0.0, 150.0)

# Foliage on the surface
var xforms: Array[Transform3D] = []
for i in 500:
    var p := Vector3(randf_range(-1000, 1000), 0, randf_range(-1000, 1000))
    p.y = terrain.data.get_height(p)
    if not is_nan(p.y):
        xforms.append(Transform3D(Basis().rotated(Vector3.UP, randf() * TAU), p))
terrain.instancer.add_transforms(0, xforms)
```

Runtime edit (dig, raise):

```gdscript
terrain.data.set_height(pos, terrain.data.get_height(pos) - 2.0)
var region := terrain.data.get_regionp(pos)
region.set_edited(true)
terrain.data.update_maps(Terrain3DRegion.TYPE_HEIGHT, false)
region.set_edited(false)
# if collision doesn't follow: Full modes update one region
# terrain.collision.update(terrain.data.get_region_location(pos))
# Dynamic modes (default) recalculate the shapes around the target
# terrain.collision.update(Vector2i.MAX, true)
```

For bulk edits, write to `region.get_map(Terrain3DRegion.TYPE_HEIGHT)` at
`terrain.data.world_to_pixelv(pos)`, then `calc_height_range()`, `set_modified(true)`,
`set_edited(true)` and one `update_maps`. For many instances, call `add_transforms(..., update =
false)` and then one `instancer.update_mmis()`.

## Pitfalls (symptom → cause → remedy)

- **Heights come back NaN** → hole or outside any region → check `is_nan` and add regions.
- **Terraced terrain** → 8-bit heightmap → re-export as 16/32-bit EXR or R16.
- **Flat import** → heights are normalized 0–1 → raise `import_scale` (300–500).
- **Textures black or pink, or a texture won't add** → sizes or formats differ across the set → resize all albedos to one size and all normals to one size.
- **Lighting on bumps inverted** → DirectX normals → invert green.
- **NavMesh ignores the terrain** → baked with the stock button → use Terrain3D → Bake NavMesh.
- **Player falls through far away** → no region or collision there → add regions; collision follows `collision_target`/camera.
- **Low FPS** → no mipmaps or uncompressed textures, NOISE background, high `mesh_lods`/`tessellation_level` → fix textures first.
- **Android crashes or shader errors** → uniform limits → `material.max_regions` 64–256 (128 is common), PNG + ETC2/ASTC.
- **macOS refuses the library** → Gatekeeper quarantine → remove the quarantine attribute or build from source.

## Platform notes

Forward+ (Vulkan; D3D12 since Godot 4.6) and Mobile: full support. Compatibility renderer:
supported since 1.0 with Godot 4.4. Windows and Linux full; macOS works; Android and iOS
experimental; Web very experimental. No lightmaps, no built-in streaming yet (in progress upstream, PR #675),
sculpting runs on the CPU.

## References

- Docs: https://terrain3d.readthedocs.io (API classes: Terrain3D, Terrain3DData,
  Terrain3DMaterial, Terrain3DAssets, Terrain3DCollision, Terrain3DInstancer).
- Related: `godot-3d-essentials`, `material-maker`, `jolt-physics`, `procedural-gen`,
  `level-design`, `performance-optimization`.

*Code examples are adapted from Terrain3D's documentation and its CodeGenerated demo (MIT, © 2023-2026 Cory Petkovsek, Roope Palmroos, and Contributors).*

Files in this skill

  • SKILL.md9 KB
  • agents/openai.yaml198 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.