Godot 3d world building

From thedivergentai/GD-Agentic-Skills · View interactive version

Godot 3d world building is an AI agent skill from the GitHub repository thedivergentai/GD-Agentic-Skills. Expert patterns for 3D level design using GridMap with MeshLibrary, CSG constructive solid geometry, occlusion, and runtime GridMap builders. Use when building 3D levels, modular tilesets, or BSP-style geometry. For sky/fog/Environment recipes, route to godot-3d-lighting. Trigger keywords: GridMap,

How to use this skill

Skill file

3D World Building

Expert guidance for level design with GridMaps, CSG bake, and occlusion — not lighting/atmosphere authorship.

NEVER Do


Available Scripts

MANDATORY: Read the appropriate script before implementing the corresponding pattern.

Do NOT Load lighting/sky/fog scripts or deep Environment tutorials here — route to godot-3d-lighting.

[collision_gen.gd](scripts/collision_gen.gd)

Automatic collision shape generation from meshes. Use when importing models without collision or for procedural geometry.

[gridmap_runtime_builder.gd](scripts/gridmap_runtime_builder.gd)

Sole streaming / runtime GridMap entry — batch tile placement, chunk-style rebuilds, and auto-navigation baking. Prefer this over ad-hoc WorldStreamer stubs.

[csg_bake_tool.gd](scripts/csg_bake_tool.gd)

EditorScript to bake CSG geometry to static meshes with proper materials and collision. Use when finalizing level prototypes.

[safe_csg_baking.gd](scripts/safe_csg_baking.gd)

Expert technique for safe CSG baking. Awaits the end of the frame before extracting baked meshes to avoid empty data.

[lod_manager.gd](scripts/lod_manager.gd)

Level-of-detail switching based on camera distance. Manages mesh swapping and visibility for large outdoor scenes.

[occlusion_setup.gd](scripts/occlusion_setup.gd)

OccluderInstance3D configuration for manual occlusion culling. Use for indoor levels with many rooms.

[grid_map_logic_manager.gd](scripts/grid_map_logic_manager.gd)

Proxy-tile pattern: replace invisible MeshLibrary markers with spawn/trigger scenes at _ready, then clear proxy cells.

[world_streamer.gd](scripts/world_streamer.gd)

ResourceLoader.load_threaded_request queue — stutter-free chunk instantiation after background load completes.


Golden Path (GridMap / CSG / Occlusion)

  1. MeshLibrary — Source scene: MeshInstance3D + StaticBody3D/CollisionShape3D → Convert To MeshLibrary → verify get_item_shapes().
  2. GridMap — Set cell_size once, place cells, bake NavigationRegion3D. Runtime rebuilds: MANDATORY gridmap_runtime_builder.gd.
  3. CSG greybox — Prototype with CSGCombiner3D → MANDATORY safe_csg_baking.gd / csg_bake_tool.gd → delete live CSG.
  4. Occlusion / LOD — Indoor rooms: occlusion_setup.gd. Distance swaps: lod_manager.gd.
  5. Sky / fog / WorldEnvironment — Out of scope; use peer godot-3d-lighting (keep only a DirectionalLight3D present if volumetric fog is enabled elsewhere).

GridMap Fundamentals

Setup (compact)

extends GridMap

func _ready() -> void:
    mesh_library = load("res://tilesets/dungeon_library.tres")
    cell_size = Vector3(2, 2, 2)  # Set once; never after tiles exist

Cell API: set_cell_item(pos, index[, orientation]), get_cell_item, INVALID_CELL_ITEM, local_to_map / map_to_local. For batch/runtime placement and nav bake, load gridmap_runtime_builder.gd — do not paste a custom chunk streamer.

Collision verification

var shapes := mesh_library.get_item_shapes(tile_index)
if shapes.is_empty():
    push_error("Tile %d has no collision — fix MeshLibrary source scene" % tile_index)

CSG Bake Order

  1. Finish boolean edits under CSGCombiner3D.
  2. await get_tree().process_frame (WHY: CSG dirty flags settle one frame late).
  3. Bake to MeshInstance3D + collision via scripts above; remove CSG from exported scenes.
  4. Never animate CSG at runtime.

Brush types (Box/Cylinder/Sphere/Polygon) are editor greybox tools only — not shipping geometry.


Streaming Decision

| Need | Action |

|------|--------|

| Runtime GridMap tiles / chunk rebuild + nav bake | MANDATORY gridmap_runtime_builder.gd |

| Large open-world scene streaming | Peer godot-genre-open-world |

| Ad-hoc WorldStreamer inline stub | Cut — do not reintroduce incomplete load-from-file TODOs |


Expert Techniques

Spatially Partitioning MultiMeshes

Partition dense props into regional MultiMeshInstance3D nodes so frustum/occlusion can cull whole clusters (single MultiMesh AABB draws everything).

GridMap Logic Proxies

Use invisible proxy tile IDs for spawns/triggers; at _ready, get_used_cells_by_item, instantiate logic scenes, clear proxy cells. Keep logic off the GridMap itself.

Interior-Mapping

For city-scale fake interiors, use a spatial shader on window planes — peer godot-shaders-basics. Do not paste full shader recipes here.

Edge Cases

Deep recipes (on demand)

| Topic | Reference / script |

|-------|-------------------|

| GridMap / CSG bake walkthrough | gridmap-and-csg.md |

| Chunk streaming / procgen rooms | streaming-and-procgen.md |

| Proxy spawn tiles | grid_map_logic_manager.gd |

| Threaded chunk load | world_streamer.gd |

Reference

Progressive disclosure: open Official Documentation links only when researching a specific API; load Related Skills when routing to a peer domain — do not preload the whole lattice.

Official Documentation

Related Skills

Prerequisites
Complements
Downstream / consumers
Master
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.