Skip to content

Ariadne views: two demos, per-view override:, and start angles for a view's camera - #1007

Merged
transfix merged 7 commits into
masterfrom
feat/ariadne-views-demos
Nov 6, 2026
Merged

transfix merged 7 commits into
masterfrom
feat/ariadne-views-demos

Conversation

@transfix

@transfix transfix commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

Two new example documents use the viewport widget from #1005, and the widget gets what they need: per-view restyling (override:) and a starting angle for each view's camera.

The demos

examples/ariadne/documents/viewer_grid.ari is a 2 × 2 grid of views on one scene: a bunny in a courtyard of coloured pillars.

  • The four views are Front, Side, Top (a map) and Close-up, each with a camera of its own.
  • Drag a view to turn it, use the wheel to zoom, and double-click to reset. The other views and the main view behind the window don't move.

examples/ariadne/documents/viewer_looks.ari shows one plaza four ways. It has buildings, a statue, people (tagged sim) and their planned paths (tagged debug).

  • Wireframe: the buildings and statue as lines on black.
  • X-ray: the buildings see-through and the people in bright yellow, so the one behind the hall shows.
  • Plan: a top-down map of the people and their paths, with the buildings left out.
  • Clay: everything in one plain colour, like an architect's model, with the people in red.

The geometry is never copied. Each view draws the same mappers.

arigl viewer_grid.ari
arigl viewer_looks.ari

Widget changes

override: restyles nodes in one view only.

  • Each entry names a node id, a tag, or "*". It sets any of drawstyle (surface / wireframe / points), opacity, color, line_width and point_size.
  • An entry covers the named node's subtree. Entries merge in order, field by field.
  • A restyled actor is drawn by a twin: its own vtkActor and vtkProperty over the node's mapper, sharing the shader property and the texture too.
  • The twin follows the original's transform, visibility and material every frame. A see-through override is drawn in the translucent pass.
  • Viewport::PropFilter now returns the prop to draw: the prop itself, a stand-in, or nullptr. It is new in Ariadne views: a viewport widget, and node tags: that pick what each view draws #1005, so nothing else uses it yet.

Camera start: azimuth:, elevation: and zoom: set where an orbit camera starts once the view is framed, through the camera's own orbit.* state keys. A double-click in the view frames it there again.

Smaller changes

  • caption: puts a label in the view's corner.
  • The view is outlined while the pointer is over it.
  • clear_color: is now one colour. Before, the copied gradient won.
  • RealizedScene::tagged is now RealizedScene::nodes, which lists every realized node, so an override can name an untagged node by id.

Docs: ARIADNE.md §5.18 (the new keys, an Overrides section, the limits) and the roadmap §9.5 status.

Tested (Windows, Release, cvcGL + arigl)

  • New checks: cvcgl_ariadne_views, 34 checks (was 28):
    • twins are drawn instead of the originals, sharing their mapper;
    • "*" halves the opacity and keeps the node's colour, and a tag entry adds a blue wireframe on top;
    • the main view's actor keeps its own look;
    • the orbit starts at the widget's azimuth and elevation.
  • Existing suites:
    • ariadne_loader_test 220, with ShippedExamplesDeclareWhatTheyNeed covering both new documents.
    • cvcgl_ari_switch and cvcgl_ari_golden 34, the goldens unchanged.
    • cvcgl_viewport, cvcgl_viewport_input, cvcgl_scene_renderer_facade and cvcgl_ariadne_realize.
  • The demos: arigl check passes on both, and I looked at arigl snapshot frames of each.

Not run locally: pycvc and the wasm build.

Not in this PR

  • transform: overrides and mode: replace.
  • Volume nodes (volren, volslice) are drawn as they are, since an override restyles actors only.
  • A points look on dense meshes reads as a solid surface. That's why the looks demo has a clay view, not a points view.

Since opening

a58fe6a: shadows in every view, named cameras, demos shadowed

  • Shadows in views
    • Every viewport view now draws the scene's shadows, through a receive-only pass chain (SceneGraph::makeShadowReceiverPass) that reads the maps the main renderer bakes.
    • The maps are in light space, so any camera can read them. A mirror holds the same lights in the same order and draws after the main layer.
    • A view rebuilds its pass when the shadow setup changes: shadows switched off and on, a new baker, or a new softness.
    • shadows: false opts a view out. A node a view leaves out still casts a shadow there, so the two map views in the demos opt out.
  • Named cameras
    • scene: cameras: declares cameras, each with mode, track, azimuth, elevation and zoom, at <prefix>.viewers.<id>.camera.
    • A viewport with camera: <id> draws from that camera, so a drag, the wheel or a double-click in any bound view moves all of them. camera: main draws from the main view's camera, and moves it.
    • A named camera is framed on the whole scene, and its clipping range spans the scene, so no view that draws from it clips what it shows.
    • The widget's own-camera mode key is now mode:. camera: orbit|fly|map|track still means the mode. scene_view.ari takes mode and camera args.
  • Demos
    • viewer_grid, viewer_looks and scene_views cast soft shadows (softness 3, 2048-pixel maps).
    • viewer_looks' Wireframe, X-ray and Clay views share one camera: turn one and all three turn.
  • Tested:
    • cvcgl_ariadne_views now has 43 checks. They cover two views on one camera moving together while the main and other views stay put, camera: main moving the main view, and a view having a shadow pass except with shadows: false.
    • The five cvcgl_shadow* / city-sun shadow suites, cvcgl_ari_golden 34, the viewport suites, loader 220 and runtime 258 all pass.
    • I checked arigl snapshots of all three demos.

9c62fb6: several scenes per document, on shared assets (both ways)

  • assets: names meshes, each a node's source: and fit:.
    • Any node in any scene draws one with source: { asset: <id> }.
    • Each asset is read and fitted once, by one SceneAssetCache per document. Its nodes share cvc::geometry's copy-on-write buffers, but each node still builds its own VTK arrays.
  • Groups in one scene (option A). main_view: { show, hide } on scene: picks the tagged groups the main view draws.
    • The other groups' props come out of the main renderer only for the length of its draw. The views mirror the main renderer, so they still have them.
    • The main camera is framed on what the main view shows.
  • Scenes of their own (option B). scenes: entries take every scene: key: nodes, lights, shadows, background and cameras.
    • Each is realized into a SceneGraph of its own, with state under <prefix>.scenes.<id> (binds share the document's prefix), attached to a viewport of its own (scene.<id>) that is never shown.
    • A viewport with scene: <id> mirrors it: that scene's props, lights, background and shadows.
    • While the scene's shadows are on and one of its views shows, its viewport draws one pixel under that view, so the maps are baked.
    • A new document takes the scenes down. SceneAdapter::realize_scenes defaults to a warning on hosts that draw one scene.
  • shadows: own gives a view a whole shadow chain of its own (SceneGraph::makeShadowPasses, factored out of installShadowPasses). It bakes only what that view draws, so a view that shows what the main view leaves out gets correct shadows.
  • Framing: a view that names tags to show is framed on those nodes' world bounds.
  • Demos
    • viewer_scenes.ari has three scenes (day, night and a studio) built from one set of assets, each with its own lights, background and soft shadows.
    • viewer_groups.ari shows a courtyard in the main view and a gallery in a viewport with its own shadows, plus a map of both.
  • Tested
    • cvcgl_ariadne_scenes, 21 checks:
      • one read per asset across two scenes, with shared point buffers;
      • a scene's own viewport, two views mirroring it, and its background and shadows reaching them;
      • main_view's pixels, and the props back after the draw;
      • teardown on a new document.
    • AriadneScene.AssetsScenesAndMainView.
    • Loader 221, runtime 258, host 42, cvcgl_ariadne_views 43, the five shadow suites, cvcgl_ari_golden 34 and the viewport suites all pass.
    • arigl check passes on all five views demos, and I checked snapshots of each.

…view's camera

Two example documents exercise the viewport widget:
- viewer_grid.ari: a 2 x 2 grid of views on one scene (front, side, a top-down
  map, a close-up), each camera its own: drag, wheel, double-click to reset.
- viewer_looks.ari: one plaza four ways: wireframe, X-ray (see-through
  buildings, the people picked out), a plan of the people and their paths only,
  and a clay model.

What they need from the widget:
- override: { <node id | tag | "*">: { drawstyle, opacity, color, line_width,
  point_size } }, merged in order over a node's subtree. A restyled actor is
  drawn by a twin vtkActor with its own vtkProperty over the node's own mapper
  (shader property and texture shared too), kept in step with the original
  every frame, so no geometry is copied. Viewport::PropFilter now returns the
  prop to draw (itself, a stand-in, or nullptr).
- azimuth: / elevation: / zoom: where an orbit camera starts once framed;
  a double-click in the view frames it there again.
- caption:, and an outline while the pointer is over the view.
- clear_color: is one colour, not the scene's gradient.
- RealizedScene::tagged is now RealizedScene::nodes: every realized node, so
  override: can name untagged nodes by id.

cvcgl_ariadne_views: 34 checks (twins share their original's mapper, "*" and a
tag entry merge, the main view's actors keep their look, the orbit starts at
the widget's azimuth / elevation).
…demos shadowed

Shadows. Each viewport view now draws the scene's shadows: a receive-only
pass chain (SceneGraph::makeShadowReceiverPass) that reads the maps the main
renderer bakes. They are light-space, so any camera reads them; a mirror holds
the same lights in the same order and draws after the main layer. A view
remakes its pass when shadowReceiverKey() changes (shadows toggled, a new
baker, a new softness); `shadows: false` opts a view out. A node a view leaves
out still casts there, so the map views in the demos opt out.

Named cameras. `scene: cameras:` declares cameras (mode, track, azimuth,
elevation, zoom), each at <prefix>.viewers.<id>.camera. A viewport with
`camera: <id>` draws from it, so a drag, the wheel or a double-click in any
of them moves all of them; `camera: main` draws from (and moves) the main
view's camera. A named camera is framed on the whole scene and its clipping
range spans the scene. The widget's own camera mode is now `mode:`;
`camera: orbit | fly | map | track` still means the mode. scene_view.ari takes
`mode` and `camera` args.

Demos: viewer_grid, viewer_looks and scene_views cast soft shadows (softness 3,
2048 maps); viewer_looks' Wireframe, X-ray and Clay share one camera.

cvcgl_ariadne_views: 43 checks (two views on one camera move together and
nothing else does; camera: main moves the main view; a view has a shadow pass,
shadows: false none). Shadow suites, ari_golden, viewport suites pass.
…ew:, own-baked view shadows

Several scenes per document, on shared geometry (both ways, as asked):

A. Groups in one scene. `assets:` names meshes (a node's source: and fit:)
   that any node draws with `source: { asset: <id> }`: read and fitted once
   (SceneAssetCache, one per document in AriRuntime's adapter), the nodes
   sharing cvc::geometry's copy-on-write buffers. `main_view: { show, hide }`
   on the scene picks the tagged groups the main view draws: SceneViews takes
   the others out of the main renderer for the length of its draw (StartEvent
   / EndEvent), so the views, which mirror it, keep them, and frames the main
   camera on what it shows.

B. Scenes of their own. `scenes:` entries take every scene: key (nodes,
   lights, shadows, background, cameras). AriRuntime's adapter realizes each
   into a SceneGraph of its own (state <prefix>.scenes.<id>; binds share the
   document's prefix) attached to a viewport of its own, `scene.<id>`, never
   shown; a viewport with `scene: <id>` mirrors it (SceneSlot). While its
   shadows are on and a view shows, the scene's viewport draws one pixel under
   that view so its maps are baked; the views read them. A new document takes
   the scenes down. SceneAdapter::realize_scenes (default: warn, unsupported).

Shadows: `shadows: own` gives a view a whole chain of its own
(SceneGraph::makeShadowPasses, factored out of installShadowPasses), baking
what that view draws, for a view that shows what the main view leaves out.
A view that names tags to show is framed on those nodes' world bounds.

Demos: viewer_scenes.ari (day, night, studio from one set of assets) and
viewer_groups.ari (a courtyard in the main view, a gallery in a viewport).

Tests: cvcgl_ariadne_scenes (21: one read per asset across scenes and shared
point buffers; a scene's own viewport, its views mirroring it, its
background and shadows, two views of one scene; main_view's pixels and the
props back after the draw; teardown); AriadneScene.AssetsScenesAndMainView.
…/ariadne-views-demos

# Conflicts:
#	inc/cvc/ariadne/scene.h
#	src/cvc/ariadne/loader.cpp
@transfix
transfix merged commit 9d74793 into master Nov 6, 2026
27 checks passed
@transfix
transfix deleted the feat/ariadne-views-demos branch November 6, 2026 06:38
transfix added a commit that referenced this pull request Nov 7, 2026
… shared VTK arrays, shadows in the demos (#1039)

The leftovers of #1007, and the docs for its components and demos.

Overrides. An override: entry may move, turn and scale what it covers
(`transform: { position, rotation, scale }`), in the frame of the node it
names (a group scales about its own origin; a tag entry in each tagged node's
frame; "*" in world space), and `mode: replace` starts over from the node's
own look. Entries now apply in order, "*" included. `material: { color,
opacity }` spells the look fields too.

Volumes in views. A volslice node's slices face the camera they were swept
for, so a view from its own camera draws slices of its own
(VolSliceNode::viewProp: its own polydata and mapper over the node's shader
property, property, textures and uniforms, GeometryNode::observeShaderInputs).
A volren node is raycast for the main view and composited into its pixels, so
no view draws it (it drew wrong from another camera, and not at all on
camera: main). A `type: volume` node takes opacity (a second vtkVolume, with
its own property and mapper, every opacity point scaled) and transform.

Shared VTK arrays. An asset's nodes draw from the first node's points, cells,
normals and texture coordinates (GeometryNode::shareArraysFrom, wired through
SceneAssetCache::donors), so VTK uploads them once. Copy-on-write:
updateVertices / updateNormals first give the writer arrays of its own, the
donor included. Colours stay each node's own.

Scenes' shadows. A scenes: entry's viewport stops drawing while the UI is
hidden too (no widget walk), and on the first frame a view shows it again its
maps are baked for whatever moved meanwhile, whatever its update_interval.

Shadows in the demos: on in clip_planes, mesh_lab, fem_gallery and
terminal_scene. A volume casts nothing into the scene's maps, so the volume
demos get volren's own volumetric shadows instead: a new `volren: { shadows:
true | { enabled, strength } }` key, on in volren_bunny and transfer_function.

Docs: ARIADNE.md §5.1 (assets, scenes), §5.4 (volumes and shadows), §5.18
(the demos, transform / replace, volumes in views, shared arrays, the scenes'
bake, limits), §6.5; the scene_view component takes scene, shadows and
caption; examples/README.md lists the views demos; the browser gallery gets
cards for the five (web/demos.json, thumbnails); roadmap §9.5 status.

Tests: cvcgl_ariadne_views 56 (13 new: transform in a group's frame, replace,
a volume's opacity stand-in, volslice and volren in own-camera and camera:
main views); cvcgl_ariadne_scenes 29 (8 new: shared arrays and their
copy-on-write, the bake on showing a scene again); AriadneScene.
VolRenShadowsParse.
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