Skip to content

terrain_lab as an Ariadne document, on demo3's render path - #964

Merged
transfix merged 1 commit into
masterfrom
feat/ariadne-terrain-lab
Nov 2, 2026
Merged

transfix merged 1 commit into
masterfrom
feat/ariadne-terrain-lab

Conversation

@transfix

@transfix transfix commented Nov 1, 2026

Copy link
Copy Markdown
Owner

terrain_lab ported to an Ariadne document that follows the lsystem_forest.ari pattern, on the render discipline of demo3-csma (CVC-DBG's Austin convoy demo, our fastest cvcGL scene). This is the template for a generated world that other apps, the conference among them, can build on.

What changes

  • cvc::world::generate_world (inc/cvc/world/generated_world.h) is terrain_lab's world, moved out of the example, GL-free and deterministic. It covers:

    • the relief and the L-system props as merged meshes;
    • the roads-first city with the Austin archetypes, or box massing without them;
    • the surface texture (paint_surface);
    • the water below water_level_m (water_field);
    • a world_geometry for physics and nav.

    examples/cvcgl/terrain_lab.cpp now draws it, down from 1793 lines to about 900.

  • generated_world scene node type (src/cvcGL/ariadne/world_nodes.cpp), registered in register_cvcgl_extensions, so arigl, the gallery and the conference client all have it.

    • The node is the terrain, and its height field is published for ground:.
    • Next to it sit the props, buildings, roads, foliage, needles and water.
    • Its world.* state keys are driven by the new cvc://components/world_controls.ari. A change regenerates the world in place; a colour change only repaints the texture.
  • examples/ariadne/documents/terrain_lab.ari, plus a terrain_lab_ari gallery entry. It has no thumbnail yet, so the gallery shows its placeholder.

demo3's render path as scene keys

demo3 is fast by discipline, not custom GLSL. These are the pieces of it an .ari could not express before (documented in ARIADNE.md §5.4):

key sets
shadows.focus: camera, {follow: camera, min_radius, max_radius, per_distance, lead, lift, ground} or {center, radius} SceneGraph::setShadowFocus, re-aimed each frame by tick_scene (demo3's formula)
shadows.softness setShadowSoftness
casts_shadow: false on any node GraphicsNode::setCastsShadow
material: { opaque: true } the new GeometryNode::setForceOpaque (no per-texel alpha scan)
a rig's wash: removes the downlight ring and its shadow-map samplers

The document uses all of them, with demo3's soft afternoon look: sun key 1.3 at azimuth −60° and elevation 28°, fill 0.3, no back light or wash, a 4096 shadow map and a daylight sky.

Fixes found along the way

  • cloud_sky takes extent / base / top, so its slab fits a 1.2 km world. With its shadow starting off, it no longer overwrites its ground node's texture with white.
  • Scale: the island-scaled pines stood 20–100 m. They are calibrated to 3–31 m. The Austin archetypes have a median height of 7.6 m and were being squeezed into 10 m lots at a third of their height. fit_buildings gains true_scale: it picks an archetype that fits the lot at 0.85–1× its own size, or leaves the lot empty. The lab's lots are now 16 × 28 m. fit_buildings' default behaviour is unchanged.

Plan

docs/roadmap/GENERATED-WORLD-ROADMAP.md covers:

  • a terrain-source interface and a generator switch in the panel;
  • road kinds;
  • the district street model, frontage lots and eroded terrain;
  • the conference's world: a replicated descriptor, room_view, and avatar statics on the terrain;
  • hardening the template (perf budget, archetypes in the browser, large worlds).

The street, lot and terrain models follow the DBG project's private scene generator. Porting them needs its author's and the PI's OK first; the roadmap records that gate without the private details.

Testing (Windows, MSVC 14.44, cvcpkg prefix)

  • New tests, all passing:
    • world_generated_test, 6 tests: determinism, terrain = relief, dry-land props, water fill, geometry, presets, trees under 35 m;
    • WorldSites.TrueScaleFitsArchetypesAtTheirOwnSize;
    • AriadneScene.FastPathShadowKeys;
    • a generated_world + shadow-focus block in cvcgl_ariadne_realize: realize, a seeded key, the focus aimed by tick_scene, and regeneration in place.
  • Existing tests: ariadne_loader_test (211), world_sites / world_road_mesh / world_raster / world_buildings / lsys_forest, and the 84 ctest entries matching ariadne|world_|lsys_|cvcgl_|terrain|physics_world|nav_world all pass.
  • Renders, checked by eye:
    • the C++ terrain_lab frame is unchanged by moving the builder;
    • arigl snapshot terrain_lab.ari renders with the panel, the Austin city, water, clouds and camera-focused shadows;
    • a close-up shows the buildings and trees in proportion.
  • Not run: the wasm gallery build and a browser frame-time measurement (plan step G6).

terrain_lab's world moves into libcvc as cvc::world::generate_world
(GL-free, deterministic), drawn by a new generated_world scene node type in
the cvcGL extension bundle and driven by cvc://components/world_controls.ari.
examples/ariadne/documents/terrain_lab.ari is the lab as a document and the
template for a generated world; the C++ terrain_lab draws the same builder.

The document declares demo3-csma's render discipline, which needed new keys:
shadows.focus (a fixed sphere, or following the camera, re-aimed by
tick_scene), shadows.softness, casts_shadow on any node, material.opaque
(GeometryNode::setForceOpaque, new), and a rig's wash. cloud_sky takes
extent/base/top, and no longer overwrites its ground's texture when its
shadow starts off.

Scale: the island-scaled pines stood 20-100 m; they are calibrated to
3-31 m. The Austin archetypes were squeezed into 10 m lots at a third of
their height; fit_buildings gains true_scale (pick an archetype that fits
the lot near its own size) and the lab's lots are 16 x 28 m.

docs/roadmap/GENERATED-WORLD-ROADMAP.md plans the generator switch, the
street/lot/terrain models, and the conference's world.
@transfix
transfix enabled auto-merge (squash) November 1, 2026 23:40
@transfix
transfix merged commit bafcd78 into master Nov 2, 2026
27 checks passed
@transfix
transfix deleted the feat/ariadne-terrain-lab branch November 2, 2026 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant