Skip to content

fe_lab: stop ends any job; field colours take the opacity curve - #944

Merged
transfix merged 1 commit into
masterfrom
fix/fe-lab-stop-any-job-field-opacity
Oct 31, 2026
Merged

transfix merged 1 commit into
masterfrom
fix/fe-lab-stop-any-job-field-opacity

Conversation

@transfix

Copy link
Copy Markdown
Owner

Two problems in the FEM gallery (arigl ?doc=fem_gallery):

  • Previous / Next while an item computes didn't stop it. The gallery writes stop load, but fe_lab honoured stop only for a heat solve. A load, a mesh, or a Poisson or modes solve ran to the end first, with its progress bar still moving under the new item's heading. Every stage is a stepped sliced task now, so FeTask checks job.cancel before each step:
    • A heat solve under way still finishes its step and keeps its field so far.
    • Any other job ends with nothing (load: stopped, mesh: stopped, ...), and the node keeps what it had.
    • fe.stoppable is 1 while any job runs, so fe_controls' Stop button works for all of them.
  • The colour map's opacity couldn't be changed. The Colours editor hid the opacity curve (show_opacity: false), and the field colours used only the colour ramp.
    • The curve now shows in fe_controls and mesh_tools, and it is baked with the ramp.
    • GeometryNode::setColorTable(rgb, alpha) takes an opacity per entry. The field is then a 4-channel (RGBA) colour array, which VTK draws in the translucent pass where the curve is below 1 (times the actor's opacity).
    • An all-opaque curve keeps plain RGB, out of the translucent pass. The colormap combo still resets to an opaque ramp.

Checked in the gallery

A probe copy of fem_gallery.ari (arigl snapshot, native Release) steps from item 1 to item 10 while item 1's SDF load is at 26%:

  • On the next frame the status is stopping....
  • One frame later it is load: stopped.
  • On the frame after that, the CT body's load starts, then it meshes and solves.

A second probe sets the CT body's opacity curve to 0 below 0.35 and 1 above 0.6. The skin and lungs (u = 0) disappear, and only the warm interior of the cut shows.

Tests

  • cvcgl_scalar_field: an opacity table gives RGBA colours with the alpha sampled like the colours, and the mapper reports translucent geometry. Opacities of the wrong length are ignored.
  • cvcgl_ariadne_realize:
    • A running Poisson solve is stoppable.
    • Stopping a 160³ SDF load ends it with load: stopped, keeps the mesh, and keeps the volume, so loading the old source again reads nothing.
    • For both mesh_lab and fe_lab, an opacity curve gives the node's colours an alpha channel and translucency, and the colormap key resets them to RGB.
  • cvcgl_fe_interval and cvcgl_tf_binding pass unchanged (Release, Windows).
  • clang-format is clean on the changed lines.

Not changed: mesh_lab's jobs run one-shot on its async lane, so they can't stop mid-run. The surface items' modes colouring is the open "as a sliced task" item.

Two problems in the FEM gallery:

- Previous / Next while an item computed did not stop it. The gallery
  writes "stop load", but fe_lab honoured `stop` only for a heat solve;
  a load, a mesh or a Poisson / modes solve ran to the end first, its
  progress bar still moving under the new item's heading. Every stage
  steps as a sliced task now, so FeTask looks at job.cancel before each
  step: a heat solve under way still finishes its step and keeps its
  field so far; any other job ends with nothing ("load: stopped", ...)
  and the node keeps what it had. fe.stoppable is 1 while any job runs.

- The Colours editor hid the opacity curve, and the field colours used
  only the colour ramp. The opacity curve is now shown (fe_controls,
  mesh_tools) and baked with the ramp; GeometryNode::setColorTable takes
  an opacity per entry, and the field is then an RGBA colour array, so
  VTK draws it translucent where the curve is below 1. An all-opaque
  curve keeps plain RGB, out of the translucent pass; the colormap key
  still resets to an opaque ramp.

Tests: cvcgl_scalar_field checks the RGBA mapping and translucency;
cvcgl_ariadne_realize checks a Poisson solve is stoppable, a stopped
SDF load keeps the volume and mesh, and an opacity curve gives both
mesh_lab's and fe_lab's colours an alpha channel until the colormap key
resets it.
@transfix
transfix enabled auto-merge (squash) October 31, 2026 20:28
@transfix
transfix merged commit e3cecf3 into master Oct 31, 2026
20 of 27 checks passed
@transfix
transfix deleted the fix/fe-lab-stop-any-job-field-opacity branch October 31, 2026 20:53
transfix added a commit that referenced this pull request Nov 1, 2026
…dow focus (#946)

VTK 9.5's exponential shadow map barely darkened anything at a city's scale, and its light camera spread a 4096 map over ~17 km, so cvcdbg's demo3 showed no building or vehicle shadows.

- FilteredShadowMapPass: the maps read back as depths and filtered (16-tap Poisson PCF), with normal offset, depth bias and receiver-plane bias in shadow texels; empty texels read lit; fades at the map's border. SceneGraph::setShadowSoftness.
- StridedShadowBaker bakes through its own copy of VTK's loop: shader keys on every prop it draws, and texels hold 1 + exp(c z), so a pale background no longer reads as an occluder.
- SceneGraph::setShadowFocus(x, y, z, r) / clearShadowFocus: each light's map aimed at a sphere (demo3: what the camera looks at, ~0.2 m a texel), the whole scene's depth range kept.
- No GL error check around the forked bake: VTK's low-memory mapper raises GL_INVALID_OPERATION after a shader-cache release, VTK's own, which its compiled-out checks never report.
- New test cvcgl_city_sun_shadows; also carries the macOS JoltRollout calibration (4add8b3 on #942).

Merged with package-linux Debug-grpc red on cvcgl_ariadne_realize's heat-stop check, a timing flake inherited from master (#944's CI failed it too); fixed in #953.
transfix added a commit that referenced this pull request Nov 1, 2026
The heat-stop check sent "stop" once fe.progress reached 1%. The first 3%
of a solve job's progress is the boundary walk before the solve, so on a
slow build (package-linux Debug-grpc) the stop landed there and the job
ended with nothing ('heat: stopped'), failing "heat.steps = 1e30 is
clamped, and stop interrupts it" (#944's CI, and twice on #946's).

Wait for fe.phase "stepping" instead: the time steps are under way, so a
stop ends the solve at a step, and a solve wrapped to one step is still
caught (done, busy 0, before the stop).

(cherry picked from commit 23eae43)
transfix added a commit that referenced this pull request Nov 1, 2026
The heat-stop check sent stop at fe.progress 1%, which a slow build reaches during the boundary walk before the solver, so the job ended with nothing ('heat: stopped'). It now waits for fe.phase "stepping". package-linux Debug-grpc, where it failed on #944 and #946, passes.
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