Skip to content

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

Merged
transfix merged 2 commits into
masterfrom
p8/volume-render-pr
Nov 23, 2026
Merged

transfix merged 2 commits into
masterfrom
p8/volume-render-pr

Conversation

@transfix

Copy link
Copy Markdown
Owner

Joe asked to be able to switch which renderer draws a scene's volume in 3D (VTK's mapper, volren or volslice) for any scene's volume, not only the volume_grid's. This is a P8 follow-up, built on D1 (#1446).

  • cvcGL VolumeRenderNode: one volume (a shared_ptr<const cvc::volume>, its voxels shared, published as <node>.volume). It is drawn by a child VolumeNode, VolRenNode or VolSliceNode, chosen by <node>.renderer (vtk is the default; also volren, volslice, none). The child is replaced on the next tick when the key changes.
    • Each child is named for its kind, so its settings stay under <node>.children.<kind>, and a renderer you switch back to finds them as it left them.
    • The first volren is lit.
    • A new volume goes to the renderer that is drawing; a volren takes it through VolRenNode::setVolume.
  • tf_binding:
    • New: an optional model_key and make_transfer_function, so one model stays bound across a renderer swap. The swap happens from inside a tick.
  • Ariadne type: volume_render:
    • source: { data | state | node } is followed with D1's volume_data_source, VolumeFollower and wait_for_datasets.
    • There is one binding for <node>.transfer_function, so an edit carries over a switch.
  • volume_grid:
    • display.render (none by default) draws the grid's own volume in the 3D view, through a VolumeRenderNode in the surfaces group that the slice views hide. It is added after P10's contour curves and surfaces.
    • 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.
  • Docs: ARIADNE.md and the roadmap's P8 section.

What doesn't change:

  • The VolumeNode, VolRenNode and VolSliceNode classes, and scene_realize's built-in volume, volren and volslice branches. So the built-in types, terrain clouds and One World draw as before. The One World session confirmed that its open stack touches none of this code.
  • The goldens. display.render is none by default.

Tests (Windows Release, local):

  • New:
    • 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, and two apps. Offscreen, each renderer draws.
    • ariadne_loader_test's VolumeRenderDemoLoadsClean.
  • Rerun:
    • volume_grid and its neighbours;
    • P10's cvcgl_volume_grid_contours;
    • the One World suites.

…hed 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).
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.
@transfix
transfix enabled auto-merge (squash) November 23, 2026 06:47
@transfix
transfix merged commit 6246d21 into master Nov 23, 2026
31 checks passed
@transfix
transfix deleted the p8/volume-render-pr branch November 23, 2026 14:10
transfix added a commit that referenced this pull request Nov 23, 2026
…p9/volume-grid-segment

VolumeGridNode keeps both the segmentation and the VolumeRenderNode: both
includes, both forward declarations, both ticks; the surfaces group's comment
(header and ARIADNE.md) names the volume, the contours' and the segments.
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