The most important terrain-editing feature is the freedom to try something terrible. Raise the snow line into the stratosphere. Put a road across the river. Turn a gentle erosion setting into a geological incident. Then change your mind without wondering whether Undo has restored the same world.
That freedom needs more engineering than a brush preview. The editor has a mutable document, workers preparing candidates, a scene with usable terrain, and a saved project that must reopen coherently. Those are four related states, not four names for the same buffer.
OmiLith’s first scene editor and native authored-level path are accepted foundations. The richer mask, graph, history and terrain-inspection workflows discussed here remain development work with scoped functional checks, including complete native import and connected play examples. Their design goal is already useful to explain: every unsuccessful experiment should leave an identifiable last working world.
A graph is a recipe with types and an order
A terrain recipe can connect generators, filters, masks and outputs. The wires should describe more than the fact that two nodes both contain arrays. Height in metres, dimensionless material coverage and velocity in metres per second are not interchangeable fields.
A useful abstract node has a typed signature
The graph also needs acyclic dependencies, compatible domains and bounded work. Matching element type is insufficient if one input describes a different region or grid. A mask’s sample spacing and origin matter as much as its width and height.
Order is visible in hydrology. Let grade the terrain for a road and compute drainage from a height field. In general,
The road can create a dam or alter a channel. Reusing drainage from the pre-road surface is therefore a stale dependency, even if the road mesh looks plausible. The developing authored-water path explicitly places ground changes before fresh drainage and composition, with checks for disconnected outlets, leaking lake regions and preserved physical values outside the owned corridor.
The preview is a view, not the painting
A small overview texture is an excellent way to inspect a large mask and an alarming place to store its only authoritative copy. Its resolution changes with the viewport. The authored field needs its own dimensions, coordinates and immutable version.
The editor’s named mask assets therefore have independent masters. Graph references can share one master; making an independent copy creates a different authoring choice. A completed stroke produces one new logical version and one history action. An unfinished stroke remains cancellable candidate work.
For an illustrative additive brush over a normalized mask,
where is signed strength and is the footprint/falloff. This explains one possible brush operation, not the full native brush catalogue. Smoothing needs particular care: sampling the frozen pre-stroke field avoids letting each freshly written dab become input to the next one, unless that feedback is deliberately part of the model.
A local stroke should process admitted affected regions, rather than clone an entire large master for every pointer movement. The surrounding immutable identity lets unchanged data remain shared while the history retains what Undo actually needs.
Cache the data dependencies, not the card layout
Node thumbnails and the larger three-dimensional terrain viewer introduce another kind of view. They help locate the operator that flattened a ridge or changed a mask, but a graph with many nodes should not rerun every operation whenever one parameter changes.
For a directed acyclic graph, changing node invalidates its result and every node reachable downstream:
This describes the dependency rule. An actual cache also needs input identities, operator versions and evaluation context. Equal-looking thumbnails are insufficient evidence that two inputs are interchangeable. Moving a node card changes layout, so it should leave field results valid; changing the node’s parameters changes data and must invalidate the affected chain.
# Explanatory dependency model, not the editor API.
on_data_edit(node):
mark_stale(node and its downstream dependants)
request_current_previews()
for node in dependency_order:
key = identity(operator_version, parameters, inputs, context)
if retained_result_matches(key): reuse()
else: evaluate_and_cache_within_budget()
The developing editor now refreshes affected node previews automatically and reuses unaffected results. A Granite Pass graph check refreshed 13 affected previews and reused 48; moving a card left those results alone. This establishes the dependency behaviour in that example, without supplying a time or memory benchmark. An older snapshot remains identifiable until its replacement is ready. A cache budget still limits how much reuse can be retained.
The newer tiled terrain and local-frame work carries the same source/view separation into larger landscapes: exact addressed terrain can outlive the small mesh window currently being inspected.
Undo is not negative erosion
It is tempting to define an inverse brush by subtracting what the forward brush added. Clamping already disproves the general idea. With , both and become 1. The output no longer contains enough information to identify the input.
Erosion and other many-to-one operations lose information in more complicated ways. Re-evaluating a recipe with a negative parameter is not a universal inverse. Undo needs retained state or sufficient change data tied to stable asset identity.
Qt’s command-stack documentation is helpful background for grouping a gesture into one action, maintaining the undo/redo cursor and identifying a clean save point. This editor does not use Qt. Its additional challenge is making the data behind history survive a real process restart.
After actions A and B, Undo B should leave B available for Redo. Saving at that point must preserve the cursor and the redo-only immutable assets. Saving only the visible terrain throws away part of the session. Save As must also carry resources referenced exclusively by retained history.
History has a budget too. An edit that would make the retained document impossible to save should be refused before it changes acceptance. Evicting old history then needs a coherent remaining base, rather than labels whose data has already disappeared.
A worker produces a candidate, not a world
Asynchronous preparation introduces a race with the author. A slow bake can finish after Undo, Open or another bake has superseded the request. Successful arithmetic does not make that result current.
One conceptual eligibility condition is
where the epochs stand for the document and scene identities captured by candidate . An implementation may represent this differently. The essential requirement is to revalidate ownership at publication, after the expensive work has finished.
request = capture_immutable_recipe_and_sources()
if not admit_combined_preparation_peak(request):
return AdmissionRefused
candidate = evaluate_and_prepare_off_thread(request)
on_owner_thread:
if candidate.is_cancelled_or_stale() or not candidate.is_valid():
discard_only_candidate_owned_work()
else:
stage_terrain_and_authored_actors_together()
accept_cache_and_publish_owned_scene_change()
This pseudocode is a conceptual contract. Scene actors, resource keys and prepared terrain must agree before publication. Unrelated live actors remain untouched. Cache acceptance and the scene change need a coordinated boundary, so a late cancellation cannot leave the scene committed without its corresponding accepted cache result.
The old terrain also remains part of the preparation peak. Candidate meshes, water, textures, vegetation and imported data coexist with it. Charging each stage as if the budget started empty would admit several individually affordable allocations whose total does not fit.
A stable result needs a logical identity
Repeated bakes exposed another subtle distinction: matching terrain can occupy different physical publication banks. If a result receipt includes its storage slot as content identity, unchanged geometry appears different each time the bank alternates.
Logical identity should describe the recipe inputs and accepted result, while a lease identifies the storage holding it alive. That separation makes repeated evaluation and reopening comparable without pretending that two physical allocations are the same object.
It also matters for source imports. A model and its supported dependencies are snapshotted before cooking, so the job reads the data it actually admitted. Changing the original while copying is a reason to reject that candidate, rather than silently cook a mixture of revisions.
Preview and Save have independent promises
Field-only Preview can inspect a candidate while the accepted scene remains visible. An exact regional read should retain master samples and required context. For an operator and region ,
in general. A local stencil needs a halo; drainage or another nonlocal operation may need much more than a cropped neighbourhood. A reduced overview cannot become the source just because it is convenient to read.
Saving is a different transaction. The developing workflow prepares copied data and history, validates them, then publishes the project manifest last. That offers a defined visible result for its handled failure paths. SQLite’s atomic-commit explanation is useful background for why all-or-nothing publication and storage durability require different arguments. It does not mean the level format is SQLite or that the editor has a general power-loss guarantee.
The accepted native authored-level path already connects the first editor to Drune. Newer canonical source exports and complete-scene imports now have connected play examples, while remaining development-branch work with separate device and cumulative acceptance. The editor overview makes that feature boundary explicit. What joins both stages is the same promise: the editor should make ambitious experiments easier to attempt, inspect and discard while the last accepted world remains useful.
References & further reading
Research papers and official documentation relevant to this article.

