Skip to content

Ariadne: authored viewpoints for scene cameras - #1495

Merged
transfix merged 1 commit into
masterfrom
scene/authored-viewpoints
Nov 23, 2026
Merged

transfix merged 1 commit into
masterfrom
scene/authored-viewpoints

Conversation

@transfix

@transfix transfix commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

A camera can now say exactly where it looks from and with what lens. Until now cameras were rigs: mode: plus azimuth, elevation and zoom on a view framed automatically, so a document could not put the eye at a point, look at another, or pick a lens. This is item 4 of the Ariadne scene-format gap plan.

scene:
  cameras:
    - camera: main               # where the main view starts
      position: [12, -9, 7]
      target: [1, 1, 0]
      fov: 35
      near: 0.25
      far: 400
    - camera: plan
      orthographic: true
      position: [5, -20, 30]
      target: [0, 0, 0]
      height: 16                 # 16 tall at the target

The keys

A named camera (scene: cameras:), a viewport's own camera and the main view all take the same keys. The main view reads them from a cameras: entry named main. That entry isn't a named camera of its own, so camera: main on a viewport still follows the main view.

  • position and target ([x, y, z], world coordinates) are the eye and the point it looks at.
    • Together, they replace azimuth, elevation and zoom.
    • A target alone turns the framed view to look at it from the same angle and distance.
    • A position alone looks from there at what the view framed.
    • The pose is the orbit's own (centre, distance, azimuth, elevation in state), so a drag or the wheel carries on from it. The orbit keeps its elevation within 89 degrees, so a camera straight above its target sits just off vertical.
    • With mode: fly, the eye stands at position facing target.
  • up: the world's up axis the camera turns about (+z by default).
  • fov: the vertical field of view in degrees.
  • near and far: fixed clipping distances. When unset, they are fitted every frame as before.
  • orthographic: true: a parallel projection in orbit, fly and track.
    • The view is as tall at the target as the field of view is, so the wheel still zooms it.
    • height sets that height at the start.
    • map and slice are parallel anyway; they take over and hand the projection back.

Changes

  • CameraController, all opt-in with defaults unchanged:
    • lookAt(eye, target) sets the current pose of every 3-D mode;
    • setOrthographic (state settings.orthographic);
    • setClipRange (state settings.clip_near / settings.clip_far; 0, 0 fits the range as before).
    • applyNeeded watches the new settings.
  • SceneCamera gains the viewpoint fields. read_scene_camera_viewpoint (new scene_camera.cpp) reads them for both the loader and the viewport widget. A malformed vector, or an fov outside 0 to 180, is ignored rather than half read.
  • frame_scene_camera (scene_views.h) frames any controller from a SceneCamera, as viewports already did internally. AriRuntime uses it for the main view.
  • Named cameras: the per-frame clipping fit leaves alone a camera that has near: and far:.
  • ARIADNE.md §5.18: an "Authored viewpoints" paragraph, plus a row in the viewport key table.

Tests

  • New cvcgl_camera_viewpoint, headless, 28 checks:
    • lookAt puts the vtkCamera exactly at the eye looking at the target, as the orbit's pose in state; the wheel then zooms toward the same target from the same direction;
    • in Fly, lookAt stands at the eye facing the target; an eye on the target moves only the centre; a straight-down look keeps the target and the 89-degree limit;
    • orthographic: the parallel scale is tan(fov / 2) times the distance, the wheel zooms it, a Map round trip hands it back, and settings.orthographic = 0 through state restores perspective;
    • a fixed clipping range holds as the camera moves, and (0, 0) or far ≤ near fits it again;
    • a new controller is perspective with a fitted range.
  • New cvcgl_ariadne_viewpoints, offscreen, 15 checks:
    • the main view starts at camera: main's position, target, fov, near and far;
    • a named orthographic camera is 16 tall (parallel scale 8) and looks from its position's direction;
    • a viewport's own camera takes position, target and fov;
    • all three hold over frames.
  • ariadne_loader_test CameraViewpoints: every key parsed, defaults kept, and bad vectors and an out-of-range fov ignored.

Verified locally

Windows, MSVC, with cvcGL (no examples, no pycvc), on master a4c447c: the full ctest suite, 8,381 tests.

  • Pass: everything except the six below, including the three new tests and the camera, viewport and pick tests (cvcgl_camera, cvcgl_camera_map, cvcgl_camera_slice, cvcgl_camera_idle, cvcgl_ariadne_pick, cvcgl_ariadne_slice_view, cvcgl_ariadne_volume_grid, cvcgl_room_view).
  • cvcgl_contour_lab, cvcgl_volume_grid_contours: this build has no cvc::planar (Clipper2/CDT).
  • cvcgl_ari_golden: the same seven goldens that fail on this machine without this change (Intel Arc GPU, no mesh_lab, no cvc::planar), with the same pixel counts.
  • cvcgl_ariadne_swarm: failed 4 of 25 checks (streamed vehicles moving, the follow layer) while other heavy tests ran. The same binaries then passed 3 of 3, and after a rebuild 6 of 6 with the machine idle. The test drives realize_scene and tick_scene directly, and none of the code this change touches runs there.
  • Two timeouts under -j 10 (NavPlantConvergence.EnergyTrainedPolicyOnJolt, PlantLogPowerConvergence.FitsTheLedgerAndPredictsHeldOutSeeds): both pass rerun at -j 2 (1,030 s and 1,327 s, past the 900 s cap).

Not verified locally: Linux, macOS, wasm and pycvc.

Schema (#1464)

#1464, the closed .ari schema, lands last among the PRs that add loader keys and carries their keys, so this PR can merge first. #1464 needs, in $defs/camera: position, target and up ({"$ref": "#/$defs/vec3"}), fov, near, far and height ({"type": "number"}), and orthographic ({"$ref": "#/$defs/flag"}). Viewport widgets are custom widgets there, so their keys are open already.

Not done

  • A camera that animates between viewpoints (item 7, keyframes).
  • up for map mode, which stays north-up as before.

A camera can say exactly where it looks from and with what lens. A named
camera (scene: cameras:), a viewport's own camera and the main view (a
cameras: entry named main) take position: and target: ([x, y, z], world),
up:, fov:, near: and far:, and orthographic: with height:.

- position and target set the orbit's own pose (centre, distance, azimuth,
  elevation), so a drag or the wheel goes on from it; a target alone turns
  the framed view to it, a position alone looks at what was framed; with
  mode: fly the eye stands at position facing target.
- CameraController::lookAt(eye, target); setOrthographic (state
  settings.orthographic: parallel in Orbit, Fly and Track, as tall as the
  field of view at the focal point, so the wheel still zooms; Map and Slice
  take over and give it back); setClipRange (settings.clip_near/clip_far, a
  fixed range; 0, 0 fits it as before). All off by default.
- read_scene_camera_viewpoint reads the keys for the loader and the viewport
  widget alike; frame_scene_camera frames any controller from a SceneCamera,
  which AriRuntime uses for the main view.
- ARIADNE.md section 5.18: "Authored viewpoints", and the viewport key table.

Tests: new cvcgl_camera_viewpoint (headless) and cvcgl_ariadne_viewpoints,
ariadne_loader_test CameraViewpoints.
@transfix
transfix enabled auto-merge (squash) November 23, 2026 15:09
@transfix
transfix merged commit 93670c5 into master Nov 23, 2026
32 checks passed
@transfix
transfix deleted the scene/authored-viewpoints branch November 23, 2026 17:02
transfix added a commit that referenced this pull request Nov 23, 2026
loader.cpp conflicted where master edited the inline schema this branch
replaces (#1450's notifications: always); the closed schema already has it,
so the branch's side stays.

The schema gains the keys master now reads:
- #1495 (merged): a camera's position, target, up, fov, near, far,
  orthographic and height;
- #1491 (open): a scene node's on_pick.
transfix added a commit that referenced this pull request Nov 23, 2026
… into p9/volume-grid-segment

INDEX.ari keeps both new entries (volume_grid_segmentation, http_cache).
volume_grid_contours.png conflicted (#1450 re-rendered it for rows that
flow); kept ours until CI renders the merged panel.
transfix added a commit that referenced this pull request Nov 23, 2026
src/cvcGL/CMakeLists.txt conflicted where this branch registers
cvcgl_ariadne_node_pick and #1495 registers cvcgl_ariadne_viewpoints at the
same place: both kept. ariadne.cpp (#1493's custom_scope around the custom
widget call) and scene_views.cpp (#1493's key_scope, #1495's viewpoints) merged
cleanly beside this branch's events.
transfix added a commit that referenced this pull request Nov 23, 2026
Conflicts in scene_views.h / scene_views.cpp: SH2's prepare() and
frame_named() beside master's key_scope() (#1493), and master's
near:/far: guard (#1495) on the named cameras' clipping range, which the
first-frame path for a new view now honours too.
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