Skip to content

cloud_sky: draw the far shells in the volume layer, over the water - #1036

Merged
transfix merged 2 commits into
masterfrom
fix/cloud-shells-over-water
Nov 7, 2026
Merged

transfix merged 2 commits into
masterfrom
fix/cloud-shells-over-water

Conversation

@transfix

@transfix transfix commented Nov 7, 2026

Copy link
Copy Markdown
Owner

The terrain lab's fuzzy (far) clouds were drawn behind its water: a lake's dark blue showed through the cloud above it.

Cause. VTK draws its layers in a fixed order: opaque, translucent, volumes, overlay. Each volume is composited over the translucent layer whatever its depth. The far cloud shells are translucent geometry and the world's water is a volume, so the water covered them. The near clouds are volumes themselves and were drawn after the water, so they were fine.

Fix.

  • GeometryNode::setDrawWithVolumes(bool) (new). Every GeometryNode's actor is now a small vtkOpenGLActor subclass. A node that asks for it sits out the opaque and translucent layers, and with them the shadow bake. It draws in the volume layer instead, in its place in the renderer's prop order among the volumes, as translucent geometry draws: blended, depth-tested against the opaque geometry, writing no depth. Other nodes are unchanged.
  • cloud_sky's far shells use it. The sky's tick keeps the renderer's props ordered as [the scene's other props, the shells, the near cloud volumes]:
    • the shells come after the water. The deck is above sea level, so it is in front of the water from any camera above the water.
    • the near clouds come after the shells, since they are nearer the camera.
  • A node shown again rejoins the renderer at the end (SceneNode::setVisible removes and re-adds its prop), so the tick restores the order when it has drifted. It is a walk of the renderer's prop list each frame, and a move only when needed.
  • Drawing the shells in the overlay layer, after every volume, was tried first. It fixed the water but put far clouds over near ones, so it was dropped.

Checked natively (arigl snapshots of terrain_lab.ari, 1280x720):

  • With every cloud a far shell (near: 0), from above, the cloud over the east lake shows the lake's dark blue before the fix and white after. It matches the same view with the water lowered out of the world.
  • The default deck over water: the near clouds are solid white over the water.
  • At cloud height across the deck, a near cloud is drawn over the far shells behind it.
  • cvcgl_ariadne_realize checks that the far shells draw in the volume layer.
  • The full cvcGL test suite: running locally at open (results to follow in a comment).

Snapshots are in the shared notes folder, cloud-shadows/ 13-17.

With #1034. That PR replaces the generated world's water volume with opaque surfaces, which fixes terrain_lab on its own. This fix is still needed for lsystem_forest.ari: there cloud_sky sits over a wave_sea, which is a VolumeNode. With #1034 it does no harm, since opaque water draws before anything in the volume layer.

VTK composites every volume over the translucent layer whatever its depth,
so a water or sea volume (generated_world's water, wave_sea) covered the
far cloud shells above it. GeometryNode::setDrawWithVolumes() draws a mesh
in the volume layer instead, in its place in the renderer's prop order,
as translucent geometry draws. cloud_sky's shells use it, and its tick
keeps the props ordered [others, shells, near cloud volumes]: the deck is
above sea level, so in front of the water, and the near clouds are in
front of the shells. A node shown again rejoins the renderer at the end,
so the order is restored when it drifts.

Test: cvcgl_ariadne_realize checks the shells draw in the volume layer.
@transfix

transfix commented Nov 7, 2026

Copy link
Copy Markdown
Owner Author

Local results on Windows (Release, cvcpkg prefix): the full cvcGL suite (ctest -R ^cvcgl) passes, 96 of 96. Every GeometryNode now uses the new actor class, so this covers the whole mesh path, including the low-memory mapper (cvcgl_lowmem_fastdraw), shadows, clipping and viewports.

…er-water

# Conflicts:
#	src/cvcGL/ariadne/lsystem_nodes.cpp
@transfix
transfix merged commit f94a9b2 into master Nov 7, 2026
12 of 27 checks passed
@transfix
transfix deleted the fix/cloud-shells-over-water branch November 7, 2026 01:07
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