GregOrigin - TerraDyne: Unified Runtime Terrain Sculpting with Real-Time Physics

Watch a promo video: v0.1

Update video: v0.2

Read the manual

TerraDyne is a landscape plugin that unifies Runtime Terrain Sculpting with Real-Time Physics using a modern, unified architecture that moves away from legacy methods.

It started as an unassuming GitHub repo, and slowly built from there, with some help from the great OSS community. The 0.1 open-source version is still available there with 3 separate branches, but it only contains up to 15% of the present Fab version's functionality, which is being regularly updated.

UE 5.7 version is recommended over older versions: it's the version I develop on and the first to get updates.

TerraDyne currently features the following:

1. True Runtime Plasticity:

  • Unlike standard Unreal Landscapes, TerraDyne allows for real-time structural changes (sculpting, craters, tectonic shifts) during gameplay.

  • It successfully integrates a hybrid CPU/GPU pipeline, using Compute Shaders/Render Targets (HeightRT, SculptRT) for fast deformation and UDynamicMeshComponent for rendering.

2. "Live Takeover" Workflow:

  • The system can sample existing Landscape actors into its own data structures (16-bit precision), allowing developers to design in the editor and convert to TerraDyne for runtime interactivity without data loss.

3. Visual & Physical Parity:

  • It solves the complex problem of aligning visual meshes with physics collision at runtime.

4. Integrated Tooling:

  • It provides a standalone Runtime GUI (Slate-based STerraDynePanel) with GPU telemetry, proving it works as a "game-ready" tool, not just an editor plugin.

  • Includes a "Zero-Configuration" wizard (TerraDyneSceneSetup) for instant usability.

Big update today, but still considered 1.0.0:

Core Terrain

  • Procedural terrain grid via ATerraDyneManager spawning ATerraDyneChunk actors with DynamicMeshComponents and FBM noise
  • Distance-based LOD (disables collision beyond 500m)
  • Collision debouncing (0.2s)

Sculpting

  • 5 brush modes: Raise, Lower, Smooth, Flatten, Paint
  • Multi-layer sculpting (Base / Sculpt / Detail)
  • 4 weight paint channels (RGBA8)
  • GPU brush path loaded but falls back to CPU (compute kernel not implemented)

Undo/Redo

  • Per-player stroke stacks via BeginStroke/CommitStroke
  • Full Undo/Redo with UI buttons and keyboard bindings

Grass/Foliage

  • FTerraDyneGrassSystem — async background thread worker
  • Samples height + weight buffers, outputs HISM transforms on game thread
  • Profile-driven (mesh, density, slope, scale, weight-layer filtering)

Persistence

  • Binary save/load with ZLib compression and magic header (0x5444594E)
  • Stores sculpt + weight data per chunk

Multiplayer

  • Server-authoritative brush via RPCs (Server_ApplyBrush, Server_CommitStroke)
  • Multicast_ApplyBrush for visual sync to all clients
  • Client_ReceiveChunkSync for late-join data push
  • Player stack cleanup on disconnect

Editor Tools

  • Landscape-to-TerraDyne baker
  • Slate toolbar (STerraDynePanel) with all 5 brush modes + paint layer picker
  • Runtime UMG widget (UTerraDyneToolWidget)

Automated Showcase (please see DEMO.md)

  • 63-second 10-phase directed tour demonstrating every feature above
  • Data-driven phase configs, camera waypoint system, on-screen overlay
  • Hands control to the player at the end

Update 1.0.1:

TerraDyne Changelog — March 7-8, 2026

March 8 — Assessment & Issue Resolution

5 identified issues resolved, 6 additional defects fixed from code review.

GPU Brush Path — Enabled (TerraDyneChunk.h/cpp)

  • Root cause: single render target couldn't be read and written in the same Canvas draw pass
  • Added HeightRT_Swap for ping-pong rendering — material reads PrevHeight from current RT, draws to swap RT, pointers are swapped after each stroke
  • Added self-validation on startup: uploads CPU height data to RT, reads it back, spot-checks 16 samples (tolerance 0.01). Falls back to CPU automatically if validation fails or M_HeightBrush material is missing
  • Fixed RT upload to copy row-by-row respecting GPU row pitch (Stride from LockTexture2D), preventing corruption on GPUs with padded row alignment
  • Added FlushRenderingCommands() after RT upload in LoadFromData() to prevent stale pointer if chunk is immediately streamed out
  • Initialized HeightRT_Swap = nullptr in constructor for consistency

IsLocationTraceable — Implemented (TerraDyneCollision.cpp)

  • Was a non-functional stub that always returned true
  • Now performs grid-based triangle lookup: computes cell from mesh bounds and resolution, checks MaterialID on both triangles at that cell (non-zero = hole = not traceable)
  • Added mesh layout safety check: validates triangle count matches expected grid before using computed indices
  • Fixed const qualifier on GetMaterialID() return (const mesh in ProcessMesh lambda)
  • Fixed GetValue() call to pass int32* pointer (template requires subscriptable type)

Weight Baking — Enabled (TerraDyneBaker.cpp)

  • Was disabled due to WeightmapTextures being private in UE 5.6
  • Reimplemented using FLandscapeEditDataInterface::GetWeightDataFast() — the public editor API
  • Iterates GetWeightmapLayerAllocations() for up to 4 layer infos, reads per-layer weights, maps into RGBA channels
  • Added Foliage module dependency to TerraDyneEditor.Build.cs (required by LandscapeEdit.h)
  • Replaced magic number 128.0f with LandscapeHeightScale named constant
  • Removed RF_MarkAsRootSet from BakeComponent — was pinning baked assets to root set, causing permanent memory leak for the editor session

Multi-Player Streaming — Implemented (TerraDyneManager.h/cpp)

  • Was using GetFirstPlayerController() only — single player drove all chunk streaming
  • Tick() now iterates all player controllers via GetPlayerControllerIterator() to gather positions
  • UpdateStreaming() accepts TArray<FVector> and computes the union of all player load regions (diamond-shaped per player)
  • Chunks unload only when outside ALL players' unload radius (prevents one player unloading another's nearby chunks)
  • ProcessStreamingQueues() sorts by minimum Manhattan distance to nearest player (loads nearest first, unloads farthest first)
  • LOD updates use nearest player per chunk instead of first player globally
  • Replaced LastStreamingCenter (single FIntPoint) with LastStreamingHash (uint32 hash of all player chunk coords) for movement detection

Additional Defects Fixed

  • bMaterialsLoaded dead code (Manager.h/cpp): field was declared but never set. Now guards LoadMaterials() with early return and set to true at end, preventing redundant material loading on hot-reload
  • LODTimer first-frame fire (Manager.h): was initialized to 0.0f, causing streaming update with zero position on frame 1. Now initialized to 0.25f
  • GetWeightDataFast signature (Baker.cpp): was passing TArray<uint8> by value instead of pointer — would not compile

March 7 — Settings & Showcase Polish

Settings Expansion (TerraDyneSettings.h/cpp)

  • Corrected MasterMaterialPath default: removed VHFM/ subdirectory prefix from path
  • Added GrassDebounceTime setting (0.05s min, 0.5s default) — delay before regenerating grass after sculpt/paint edits
  • Added Streaming settings category:
    • ChunkLoadRadius (1-20, default 5) — diamond-shaped load region in chunk units
    • ChunkUnloadRadius (2-25, default 7) — hysteresis unload boundary
    • MaxChunkOpsPerTick (1-8, default 2) — throttles chunk spawn/teardown per tick
    • GridExtent (1-50, default 10) — half-width of world grid (-N..+N)
    • ChunkSaveDir (default TerraDyne/ChunkCache) — subdirectory for per-chunk cache files
  • Added Undo/Redo settings:
    • MaxUndoHistory (1-100, default 20) — max undo entries per player
  • Added Multiplayer settings:
    • MaxBrushRPCsPerSecond (1-120, default 30) — server-side rate limit per player
    • MaxBrushRadius (100+, default 10000) — max accepted brush radius
    • MaxBrushStrength (0+, default 5000) — max accepted brush strength

Grass Demo Fix (TerraDyneOrchestrator.cpp)

  • Removed MaterialOverride assignment from MWAM grass varieties in UpdateGrassDemo()
  • MWAM grass meshes (SMMWAM_GrassA-D) have their own embedded green materials — applying MTL_MWAMPlantsGrass as override was redundant and could conflict

Files Changed

Date File Change
Mar 8 TerraDyneCollision.cpp IsLocationTraceable implemented
Mar 8 TerraDyneChunk.h Added HeightRT_Swap UPROPERTY
Mar 8 TerraDyneChunk.cpp GPU ping-pong, RT stride fix, init fix
Mar 8 TerraDyneManager.h Multi-player streaming sigs, field inits
Mar 8 TerraDyneManager.cpp Multi-player Tick/streaming, materials guard
Mar 8 TerraDyneBaker.cpp Weight extraction, magic number, GC fix
Mar 8 TerraDyneEditor.Build.cs Added Foliage dependency
Mar 7 TerraDyneSettings.h Streaming, undo, multiplayer settings
Mar 7 TerraDyneSettings.cpp Defaults for new settings, path fix
Mar 7 TerraDyneOrchestrator.cpp Removed MWAM MaterialOverride