Skip to content

Ariadne scene: material: { opacity }, a node drawn see-through in the main view - #1238

Merged
transfix merged 1 commit into
masterfrom
feat/ariadne-node-opacity
Nov 15, 2026
Merged

transfix merged 1 commit into
masterfrom
feat/ariadne-node-opacity

Conversation

@transfix

Copy link
Copy Markdown
Owner

A scene node can now draw see-through in the main view: material: { opacity: <0..1> }. Until now only a viewport's override: entries took an opacity (§5.18), so a translucent dome or zone could be drawn see-through in a viewport but not in the main view. Documented in docs/ARIADNE.md §5.4 ("See-through nodes"), with a line in §5.18's overrides.

- node: reach
  source: { sphere: 40 }
  material: { color: [1.0, 0.35, 0.2], opacity: 0.25 }                         # a see-through dome
- node: zone
  source: { box: { size: [50, 30, 10] } }
  material: { color: [0.2, 0.8, 0.3], opacity: { bind: zone.alpha, default: 0.4 } }  # follows a key

What it does

  • Literal. opacity: 0.25 sets the mesh's vtkProperty opacity. Out of 0..1 is clamped, with a warning.

  • Opacity wins over opaque:. Below 1 the mesh draws in the translucent pass even with opaque: true beside it, as a viewport override's opacity does. At 1 the forced-opaque pass comes back.

  • Bound. opacity: <path> or { bind: <path>, default: <0..1> } follows a state key, as visible: does:

    • read each frame, never seeded;
    • clamped to 0..1;
    • default (1 when left out) while the key is unset or is not a number.
  • What it reaches. Everything the node draws:

    • its mesh;
    • every rung of its LOD ladder, the coarser ones built later included;
    • the meshes a source: { data } node draws, each redraw included;
    • the mesh a custom node type returns.

    A volume node ignores it: its transfer function holds its opacity.

  • Shadows. A see-through mesh casts no shadow into the scene's maps (the baker draws the opaque layer only).

  • Viewports. A viewport's twins already copy the node's property and its force-opaque flag, so views show the node's opacity unless an override: entry sets one.

Changes

  • SceneNode: has_opacity, opacity, opacity_bind; the loader parses all three forms.
  • GeometryNode::setForceOpaque: the force is kept but not applied while the mesh's opacity is below 1, and is applied again when the opacity returns to 1. No caller sets both today, so nothing that draws now changes.
  • scene_realize:
    • apply_node_material and apply_mesh_keys set the literal;
    • RealizedScene::opacity (SceneOpacityBinding: the bind path, the default, the node held weakly, its data-node entry) holds the bound ones;
    • sync_scene_opacity writes them into the node's meshes, once at realize and then from tick_scene after sync_scene_data. An unchanged value is a no-op state write. No host changes.

Tests

  • ariadne_loader_test: new AriadneScene.MaterialOpacity covers the literal, the clamps and their warnings, a path, { bind, default }, opaque: alongside, and a bad value's warning.
  • New cvcgl_ariadne_opacity (33 checks; its pixel part skips where nothing rasterises unless CVC_REQUIRE_RENDER=1):
    • Literal. See-through at 0.5, with and without opaque: true. opaque: alone still forces the opaque pass.
    • Bound. Starts at its default, follows the key, clamps at both ends, falls back on a non-number, and gives the forced-opaque pass back at 1.
    • LOD. Rung 0, then every coarser rung built after realize.
    • Data node. The drawn mesh, then the mesh redrawn from a replacement dataset.
    • Pixels. In the main view, a half see-through red tile over a blue ground reads as both, with or without opaque: true; a solid one reads red.

Run locally on Linux (GCC 13, Release, Mesa) with CVC_REQUIRE_RENDER=1; all pass:

  • cvcgl_ariadne_opacity (33/33). With the GeometryNode rule taken out, 8 of its checks fail;
  • cvcgl_ariadne_{data,physics,pick,realize,scenes,views}, cvcgl_ari_switch and cvcgl_ari_golden;
  • cvcgl_shadow_casters, cvcgl_lowmem_fastdraw and cvcgl_stage_setters, which call setOpacity;
  • cvcgl_lod_node, cvcgl_lod_cache, cvcgl_smoke;
  • ariadne_loader_test (232 tests) and ariadne_runtime_test (277 tests, 1 skipped as on master).

-Wall -Wextra is clean on the changed lines.

Not run locally: Windows, macOS and the wasm lanes (CI covers them).

Overlap

#1230 (repeat:) and #1236 (live textures) edit loader.cpp and scene_realize.cpp too. #1230's scene_node_instance puts the copy's index into visible_bind and source_data; opacity_bind needs the same line (out.opacity_bind = with_index(...)). Whichever of the two PRs lands second adds it.

… main view

A scene node's material takes opacity: <0..1>, a state path, or { bind, default }. Below 1 the
node's meshes draw in the translucent pass, even with opaque: true (as a viewport override's
opacity does); a bound opacity follows its key each frame (read without seeding, clamped) on the
node's mesh, its LOD rungs and what a source: { data } node draws. GeometryNode::setForceOpaque
keeps its force but leaves it off while the mesh is see-through. Test cvcgl_ariadne_opacity and
AriadneScene.MaterialOpacity; docs/ARIADNE.md §5.4 "See-through nodes".
@transfix
transfix enabled auto-merge (squash) November 14, 2026 20:36
@transfix
transfix merged commit 31dd227 into master Nov 15, 2026
28 checks passed
@transfix
transfix deleted the feat/ariadne-node-opacity branch November 15, 2026 00:25
transfix added a commit that referenced this pull request Nov 15, 2026
Master's #1217 keeps nothing per thread in state_exec: a native's context (call_args::context())
carries its group, registry and stream, async_host::call and begin_external take it, and the pool
drops in_pump_all() and the one-argument run_on_host.

- async_host.h: begin_external takes the context, as on master, and keeps this branch's note that
  a call is finished through the host it was made on.
- script_engine.cpp: the sliced form finds the calling program's group from the call's context
  (exec_group::current(ctx)), else group 0, and reads its data step from the context.
- ariadne.cpp: file-pick opens its picker through run_on_host for the group its verbs were bound
  for (the env's, as its host is), and inline in group 0 and the init lane.
- exec_pool: in_pump_all() is back, for the host-thread calls' debug assertion and
  ScriptLane::run's refusal, read from the pool's calls (their callers' and pumpers' thread ids)
  under its mutex rather than from thread-locals.
- ariadne_runtime_test: the init lane's cycles test no longer compares against the calling
  thread's own registry, which master removed; it is AriadneInit.RunsAScriptThatLeavesCycles.
- ci.yml: the sanitizer's required list names the test by its new name.
- STATE_EXEC_THREADED.md: B29-B31 and the file-pick and sliced-call notes name the context-based
  calls.
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