Skip to content

volren and volume_slice view a volume on the state tree, shared with volume_grid; volume.filter and data-put (D1) - #1446

Merged
transfix merged 8 commits into
masterfrom
tfx/data-from-state-tree
Nov 22, 2026
Merged

transfix merged 8 commits into
masterfrom
tfx/data-from-state-tree

Conversation

@transfix

Copy link
Copy Markdown
Owner

Step D1 of a new plan, docs/roadmap/DATA_FROM_STATE_TREE.md. The plan applies Joe's rule from P8 (2026-11-20) to every scene node type: a node views data the app holds on the state tree, never reads a file itself, keeps no private copy, and follows the data when it changes. P8 part 3 (#1423) did this for volume_grid. This PR does it for volren and volume_slice, so the main scene's volume renderer and a grid's slice planes can show one volume and both redraw when a filter changes it.

The plan, and Joe's decisions (2026-11-21)

docs/roadmap/DATA_FROM_STATE_TREE.md lists every node type and component that still reads files, and what each reads. It then splits the work into one PR per step: D1 volume, D2 the built-in volume/volslice, D3 geometry, D4 mesh_lab, D5 fe_lab, D6 contour_lab plus the file decision. Joe agreed the plan and decided two things:

  • source: { file } and { sdf } on the built-ins stay, as sugar for a data: entry named after the node. This applies to every type at once in D6; until then { file } works as before.
  • D1's demo runs a real filter, not only a regenerated SDF.

What changed

Shared pieces, moved out of VolumeGridNode, which now uses them:

  • cvc::followed_key (inc/cvc/state/followed_key.h): a state key followed through links. A change is a new node, a new lastMod, or a new payload type or pointee. The pointee check matters because the Windows clock ticks in milliseconds.
  • cvc::volume_payload and volume_payload_pointee (volume_slice.h): what a key holds as a volume. They also unwrap the DSL data object a program's state-data-set stores.
  • cvc::gl::ariadne::NodeDataSource, volume_data_source, wait_for_datasets and VolumeFollower (inc/cvc/gl/ariadne/node_data.h): what a source: names, and the volume a node shows, followed. The follower uses <node>.source.volume, <node>.source.status and the published <node>.volume.

volren with source: { data | state | node }:

  • It raycasts the volume the key holds. VolRenNode keeps a shallow handle on the same voxels.
  • Each new volume replaces the voxels and keeps the settings, through the new VolRenNode::setVolume(index, vol).
  • It publishes the very pointer as <node>.volume.
  • Its transfer function follows the volume through volume_source. The document's isosurfaces are data values, so the TF's seed has to be made on the volume's range. The new tf_binding_options::seed_from_volume makes it when the first volume arrives; before that the key stays empty. Before this change the binding seeded a default model on every tick.

volume_slice:

  • It takes the same sources, is registered reads_data, and publishes <node>.volume.
  • A volume_of: plane now follows its source plane, including one whose volume is still loading.
  • { node: ID } defaults to the node's volume, or grid.volume for a volume_grid realized before it.

volume.filter (inc/cvc/volume/volume_filter.h, volume_filter_intrinsics.h):

  • VolumeRover's bilateral filter as a resumable stepper that works a few rows at a time from a deep copy. The input is never written.
  • It is a sliced job in the DSL's three §1.6 forms (volume.filter, -async, -start).
  • The output equals VolMagick's voxels::bilateralFilter voxel for voxel (test below).
  • register_cvcgl_extensions installs it per app.

(data-put NAME ITEM VALUE) (DataStore::set_output):

  • A program cannot put a filter's result back into a dataset with state-data-set "data.NAME.volume": that write makes a key under the document's link, not in the store node. data-put writes the output into the store node and raises rev, so every view of the dataset follows.

Demo: examples/ariadne/documents/volume_shared.ari.

  • The bunny's SDF (a data: entry) is shown by the main scene's volren and by a volume_grid. The main view hides the grid's planes.
  • Filter > Smooth runs volume.filter-start, and on_tick data-puts the result back. Both views redraw. Original runs data-reload.

Docs: ARIADNE.md §5.17 (scene nodes that follow, data-put) and the volume_slice section; the ports roadmap's §1.6 intrinsics table.

Tests

New:

  • cvcgl_shared_volume (headless, two apps), 29 checks. One data: entry is shown by a volren, a volume_grid and two volume_slices ({ node }, volume_of:, { data }). Checks:
    • all of them hold one pointer, the dataset's;
    • a new volume put by set_output, two writes in one clock tick, and a reload are all followed by every view;
    • the volren keeps one volume;
    • its TF is unseeded before the volume arrives, and afterwards the isosurface sits at 150/357 of the volume's range;
    • { state } follows a program's data object and can be pointed elsewhere, and a key holding no volume is reported in source.status;
    • a second app's nodes keep that app's volume when the first app's changes.
  • cvcgl_ariadne_shared_volume (the demo through AriRuntime, offscreen), 7 checks. Smooth's job runs, on_tick puts the result back, the volren and the grid follow with one pointer, rev goes up, and Original is followed too.
  • volume_filter_test (a port test, so it also runs in the wasm-mt lane), 11 tests:
    • bit-for-bit parity with voxels::bilateralFilter at radius 1 and 2, with the input untouched;
    • step budgets, a constant volume, bad inputs;
    • the three DSL forms, cooperative and threaded, including a bad parameter raising and params.defaults;
    • installed on one app alone.
  • ariadne_host_test DataPutPutsADataObjectAsADatasetsOutput, and ariadne_loader_test VolumeSharedDemoLoadsClean.

Run locally (Windows, MSVC Release, Intel Arc): 279 of 280 pass in a run of every cvcgl test plus the volume, Ariadne data/loader/host-verb, job-intrinsic and TF-binding tests. The one failure is cvcgl_ari_golden, on documents this PR does not change: orthoslicer, contour_tiler, volume_grid (105 px) and volume_grid_quad (258 px) differ by the same pixel counts P8 recorded on this Intel GPU (llvmpipe vs Intel), and skeleton needs mesh_lab, which this build lacks. I did not run master's goldens myself. CI's llvmpipe is the golden check. volume_shared.ari has no golden yet; its frame was checked by eye locally (the volren above the grid window, the Filter window). Not run locally: Linux and macOS, the wasm lanes, sanitizers, the singleton scan, and pycvc.

Overlap with #1443

#1443 (the grid's volume picker) also edits src/cvcGL/VolumeGridNode.cpp. A trial merge conflicts in one spot: #1443 adds holds_volume() next to the old volume_of/payload_id, which this PR replaces with cvc::volume_payload and payload_pointee. Whichever PR merges second keeps holds_volume (or answers it with cvc::volume_payload) alongside payload_pointee. Master merges cleanly.

@transfix
transfix enabled auto-merge (squash) November 22, 2026 05:11
@transfix
transfix merged commit d1b5767 into master Nov 22, 2026
31 checks passed
@transfix
transfix deleted the tfx/data-from-state-tree branch November 22, 2026 09:38
transfix added a commit that referenced this pull request Nov 22, 2026
VolumeGridNode.cpp: D1 replaced the grid's payload_id with
cvc::volume_payload_pointee; holds_volume now asks that (or a cvc::volume
held by value).
transfix added a commit that referenced this pull request Nov 22, 2026
…tours

Master gained #1446 (D1: volren and volume_slice view a volume on the
state tree). The conflicts were both sides adding: the extensions'
includes and their comment, the port tests, the cvcGL tests, and a test
each in ariadne_loader_test. All kept.

cvcgl_ariadne_shared_volume (D1's) joins the 8 MB document host stack:
its document includes volume_grid, whose Contours tab is one level
deeper, and it overflowed Windows' 1 MB stack (0xC00000FD) here.
transfix added a commit that referenced this pull request Nov 22, 2026
D1 (#1446) put the key-following the volume_grid node did by hand into
cvc::followed_key (path through links, node, lastMod, payload type and
pointee). The contours helper had its own copy of the same logic; it
now uses the shared one, with its payload_id (data objects, and
grid_contours or contour_stack pointers) as the pointee.
transfix added a commit that referenced this pull request Nov 22, 2026
Brings in master through 08a7386 (#1413, #1430, #1446, #1420, #1447, #1435). No conflicts; nothing in it touches state_exec.
transfix added a commit that referenced this pull request Nov 22, 2026
…10) (#1451)

* volume_grid: the Contours tab, contours per object, trace and tile (P10)

VolumeGridRover's contours (docs/roadmap/VOLROVER-LIBRARY-PORTS-ROADMAP.md §4, P10): curves
drawn per object on the grid's planes, linear or spline, exported as contour stacks, and tiled by
the contour tiler into a surface per object in the 3D view.

Core (cvc/volume/volume_grid_contours.h, no GL):
- grid_contours: objects (name, colour, linear | spline, samples) holding curves on one plane
  each (axis, slice, control points, open or closed), on the grid's frame;
- sample_grid_curve (centripetal Catmull-Rom), grid_contour_editor (add at the active or the
  nearer end, close, open, move, select, delete, undo), grid_contour_gestures (picks to edits),
  the object rows, stacks both ways, JSON (and the session's optional contours), trace_slice
  (VolumeGridRover's isocontouring);
- tile_grid_contours, grid_tile_stepper and the job: each orientation's closed curves tiled by
  tile_stepper in voxel units, mapped back with the XZ/ZY winding turned so surfaces face out.
DSL: grid-contours.tile (-async, -start), .info, .stack, .from-stack, .add-curve; installed by
register_cvcgl_extensions. pycvc: pycvc_volume_grid_contours.i and tile_grid_contours_job.

Node and component:
- VolumeGridContours, owned by VolumeGridNode: the contours tool; grid.objects, grid.contour.*,
  grid.tile.* (the tile job's keys under tile, beside the segmentation's); requests tile,
  stop_tile, close_curve, new_curve, delete_curve, clear_object, trace; data grid.curves,
  grid.contours (+ .xz, .zy), grid.surfaces.<object>; overlays per plane and the 3D view's curves
  and surfaces; props objects:, contours:, contour:, tile:;
- Ariadne data: the contours decoder and encoder;
- volume_grid.ari: the Contours tab (volume_grid_contours_tab);
- demo volume_grid_contours.ari, golden volume_grid_contours.ari (PNG to follow from CI),
  arigl-web case volume_grid_contours.ari.

Tests: volume_grid_contours_test (33) and volume_grid_contour_intrinsics_test (7), native and
wasm-mt under node, in the sanitizer lanes; cvcgl_volume_grid_contours (58); loader and data
cases; test_pycvc_volume_grid_contours.py. cvcgl_ariadne_volume_grid and the other grid tests
get the 8 MB document-host stack.

* gallery: volume_grid_contours_ari, the Contours tab's demo

* contour_lab: follow a source written twice within one clock tick

contour_lab noticed new contours at a node or state source only by the
key's lastMod. boost's microsec_clock on Windows has the system timer's
resolution (15.6 ms on CI's VMs), so two writes close together share a
stamp and the second was never loaded. cvcgl_volume_grid_contours hit
it on Windows CI: the lab stayed one stack behind the grid's contours.

The lab now also keeps what held the stack it loaded (the shared
pointer, or the data object it came in) and loads again when the key
holds another. Keeping it means its address isn't reused. A stack held
by value is still told by lastMod alone.

cvcgl_contour_lab writes a followed stack 20 times with a tick between
and no sleep, and checks each write loads. It failed locally before
the change.

* goldens: volume_grid_contours, and volume_grid's tab bar with Contours

volume_grid_contours.png is new. volume_grid.png and volume_grid_quad.png
change only where the panel gains the Contours tool and tab.

They are the actual frames from #1451's CI run on cf67ebb, in the
package-windows ari-golden artifact, rendered by Windows' llvmpipe
(mesa-dist-win), which docs/ARIADNE.md measures within 1 of the Linux
llvmpipe goldens. The Linux jobs compare them on the next run.

* arigl-web smoke: the contours case asks for its trace from on_tick, and says where it stops

The case failed in headless Chrome: the page ran, but the line it waits
for never came within the 15 s the harness allows. Natively the same
document prints it within 20 frames.

The document wrote the node's trace request in init:, which may run
before the node is up, so the case depended on that order. It now asks
once the grid has the volume, as volume_grid.ari's case acts only once
the dims are there.

It also prints a `vgc:` line whenever the step, the dims, the tile's
status, bunny's triangle count or the node's status changes. A failing
run of the case reports those lines and the page's warnings.

* VolumeGridContours: follow grid.contour.source with cvc::followed_key

D1 (#1446) put the key-following the volume_grid node did by hand into
cvc::followed_key (path through links, node, lastMod, payload type and
pointee). The contours helper had its own copy of the same logic; it
now uses the shared one, with its payload_id (data objects, and
grid_contours or contour_stack pointers) as the pointee.

* VolumeGridContours.h: align the member comments (clang-format)
transfix added a commit that referenced this pull request Nov 23, 2026
…lumes the grid shows (#1443)

The volume_grid component's Probe tab now has a Source combo that picks which of the app's volumes the grid shows.

- VolumeGridNode publishes grid.volumes: each output of the document's data: entries that holds a volume (data.<name>.<output>), then the key grid.source.volume names when it isn't one of them. It is empty while that key names nothing, and rebuilt only when the source key or an entry changes.
- The Probe tab's Source is a combo over grid.volumes that writes grid.source.volume; the read-only text shows while the list is empty.
- The volume_grid demo loads a coarser bunny (24^3) beside the 64^3 one.
- volume_grid_quad.png is CI's llvmpipe render with the combo and P10's Contours tab (#1451).
- Merged with D1 (#1446): holds_volume uses cvc::volume_payload_pointee.
- Docs: ARIADNE.md's volume_grid keys, the component header, and the roadmap's P8 "Which volume" bullet.

Tests: cvcgl_volume_grid (85), cvcgl_volume_grid_contours (58), ariadne_loader_test's VolumeGridDrivesItsNodesKeys combo checks, cvcgl_ariadne_volume_grid (17), cvcgl_shared_volume (29), volume_grid_test (21).
transfix added a commit that referenced this pull request Nov 23, 2026
…hed by a key (#1480)

* volume_render: one volume, its renderer (VTK, volren, volslice) switched by a key

Joe asked to change which renderer draws a scene's volume in 3D, VTK's mapper,
volren or volslice, for any scene's volume.

- cvcGL VolumeRenderNode: one volume (a shared_ptr<const cvc::volume>, its
  voxels shared, published as <node>.volume) drawn by a child VolumeNode,
  VolRenNode or VolSliceNode that <node>.renderer picks (vtk, the default;
  volren; volslice; none), replaced on the next tick when the key changes.
  Each child is named for its kind, so its settings keys stay under
  <node>.children.<kind>; a volren made again reads its settings back, and the
  first one is lit (volren's default draws a black silhouette). A new volume is
  handed to the renderer drawing; rendererVersion() moves on each make or hand.
- tf_binding: an optional model_key (empty: the node's own, as before) and
  make_transfer_function, which registers a binding without adding a scene
  tick, so a renderer swapped from inside a tick can be bound again.
- Ariadne type volume_render: source: { data | state | node } resolved into
  <node>.source.volume and followed (as volume_grid's, by node, lastMod,
  payload type and pointee); { node } takes its volume, else its grid.volume.
  One binding for <node>.transfer_function at a time, made again for each new
  renderer, so an edit carries over a switch; with none it keeps the range.
- volume_grid: display.render (none by default) draws the grid's own volume in
  the 3D view through a VolumeRenderNode in the surfaces group the slice views
  hide; the grid's single binding moves to that renderer, bound to the grid's
  model, so the planes and the volume colour through one transfer function.
  The Transfer function tab gets a 3D volume combo and the renderer's status.
- Demo examples/ariadne/documents/volume_render.ari: the bunny's SDF with a
  Renderer combo and the transfer function editor.

The VolumeNode, VolRenNode and VolSliceNode classes and scene_realize's
built-in volume, volren and volslice branches are unchanged, so the built-in
types, terrain clouds and One World draw as before.

Tests: cvcgl_volume_render (the three renderers switched with the volume and
model carried over, none, a bad name, a new volume, { node } on a grid, the
grid's display.render, two apps; offscreen, each renderer draws), and
ariadne_loader_test's VolumeRenderDemoLoadsClean. Rerun and passing:
cvcgl_volume_grid, cvcgl_ariadne_volume_grid, cvcgl_tf_binding,
cvcgl_tf_editor, cvcgl_volren_node, cvcgl_volslice_node, cvcgl_ariadne_realize,
cvcgl_ariadne_scenes, cvcgl_ariadne_views, cvcgl_world_geometry_nodes,
cvcgl_physics_scene_binding, cvcgl_volume_slice, volume_grid_test,
multi_app_integration_test. The goldens are unchanged (display.render is none).

* volume_render: follow the volume with node_data's VolumeFollower

On D1 (#1446), volume_render drops its own copy of the follower and source
parsing: volume_data_source names the source (a volume_grid realized before it
by its grid.volume, else a node's volume), VolumeFollower follows
<node>.source.volume and publishes <node>.volume, and wait_for_datasets keeps
the scene's pending work while a dataset loads. A volren handed a new volume
takes it through VolRenNode::setVolume, keeping its settings.

cvcgl_volume_render 24/24, cvcgl_volume_grid, cvcgl_ariadne_volume_grid,
cvcgl_shared_volume, cvcgl_tf_binding and ariadne_loader_test pass.
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