Skip to content

water: the rings on terrain_lab's lake (aliased glitter ripples), and twelve ripples in place of six - #1349

Merged
transfix merged 2 commits into
masterfrom
fix/water-rings
Nov 18, 2026
Merged

transfix merged 2 commits into
masterfrom
fix/water-rings

Conversation

@transfix

Copy link
Copy Markdown
Owner

The evenly spaced concentric rings on terrain_lab's lake (seen from an orbit camera 140 m off the boat at 10°) were the A4 shading's glitter ripples aliasing. They also explain the regular parallel ridges near the camera at 16 m/s. Drawing only.

Cause

  • oMicroSlope (src/cvcGL/ocean/OceanFoam.cpp) adds six fixed short gravity waves (1.7 m down to 0.43 m) to the normal, for the sun to glitter on. They faded together as the isotropic footprint fp (the geometric mean of the pixel's axes) grew from 0.12 m to 0.5 m.
  • At a grazing angle the mean hides the pixel's long axis. From 140 m at 10° a pixel is 0.1 m across the view and 0.58 m along it: fp read 0.24 m and kept 80 % of the waves, while the pixel sampled them down the view at under two pixels a crest. A fixed wave sampled past that aliases, and in perspective its alias is a zone plate: evenly spaced rings round the screen point where the wave is one crest a pixel.
  • How it was isolated:
    • With the orbit centre moved 60 m east and 60 m north, the rings kept their place on the screen, not on the water.
    • A build with the ripples off had no rings, near or far.
    • water.wake=0 gave a pixel-identical image, and the swell and the near grid's shape had already been ruled out.
  • The 16 m/s ridges come from the same ripples. Six fixed waves of equal steepness sum to a pattern that repeats. With them off, the near grid's own waves leave the lake almost flat at 9 and 16 m/s: the lake's peak waves are a few metres long, under the 2 m vertices' 4 m limit. So the ripples carry the near texture.

Fix

  • Each ripple fades by how far its own phase turns across the pixel. The turn is measured from the rest position's screen derivatives, along that wave's direction. A ripple is whole within an eighth of a turn (eight pixels a crest) and gone at a quarter (four). The slope variance it drops goes to the GGX lobe, as the shared fade's did.
  • oWaterFull takes the derivatives (dpx, dpy). Both callers, the water node's kWaterFsLight and lsystem_coast's OCEAN_FS_LIGHT, already take them before any branch. No new uniform, sampler or texture, and no process-wide state.
  • Twelve ripples in place of six: 1.7 m down to 0.43 m in equal ratios, golden-ratio directions within 0.95 rad of the wind, scattered phases. Near the camera the 16 m/s ridges break up, and the diagonal lattice that the six left further off once the rings were gone mostly goes.

Before / after (terrain_lab.ari, arigl snapshot 1280×720, --frames 240, orbit centre (0, 170, 0), elevation 10°, azimuth -120)

  • Distance 140: the rings round the boat are gone. The far lake carries the lost ripple slope as a broader sun sheen.
  • Orbit centre (60, 230): the rings at the far shore are gone.
  • Distance 16, 9 and 16 m/s: the irregular ripples replace the parallel ridges. The rings round the bobbing crates are the eWave wake's own and stay.

Frame cost (Windows, Intel Arc iGPU, where cvcGL's contexts run)

  • A scratch harness (not committed) shades a full 1280×720 quad with the whole oWaterFull, old against new: glFinish over 100 quads, the two alternated 12 times, median of the paired differences.

    footprint six ripples (ms / frame) twelve, per-wave fade (extra ms / frame)
    every ripple resolved, 0.02 m a pixel 0.087 +0.081
    terrain_lab's grazing view, 0.1 m × 0.6 m 0.088 +0.054
    none resolved, 1 m 0.059 +0.001
  • A pixel too coarse for the longest ripple, whichever way it runs, skips the loop, as the shared fade did past 0.5 m. The wavenumbers, frequencies and direction cosines are constants.

  • Whole-frame snapshot timings can't show this. Unpaced 720- minus 120-frame arigl snapshot runs, interleaved, swung from 60 to 128 ms a frame on the shared machine.

Tests run locally (Windows, MSVC Release; pass): cvcgl_ariadne_realize (307 checks), cvcgl_ariadne_physics, lsystem_coast --offscreen --frames 30 (its sea shades with the new oWaterFull).

Not verified: the browser (WebGL2: an out parameter and const float[12] arrays, both GLSL ES 3.00), Linux and macOS (CI).

Not done (follow-ups):

  • The near grid's normal still comes from its 2 m vertices, which cannot carry a lake's 2–5 m peak waves, so the ripples stand in for them. A per-fragment normal from the short and middle cascades, faded by footprint as the far grid's is, would draw the real sea there.
  • oWindrow's 0.5 m lace and the cat's paws' noise still fade on the isotropic footprint. They are noise, not periodic, so they cannot ring.

Docs: the roadmap's A4 "Ripples for the glitter" note (OCEAN-AND-WEATHER-ROADMAP.md §A4 as built).

… them

The rings on terrain_lab's lake were the A4 shading's glitter ripples (oMicroSlope)
aliasing. They faded together as the isotropic footprint (the geometric mean of the
pixel's axes) grew from 0.12 m to 0.5 m. At a grazing angle the mean hides the long
axis: from 140 m at 10 degrees a pixel is 0.1 m across the view and 0.58 m along it,
the mean read 0.24 m and kept 80 % of the waves, and the pixel sampled them along the
view at under two pixels a crest. A fixed wave sampled past that aliases into a zone
plate: evenly spaced rings round the screen point where it is one crest a pixel. They
kept their place on the screen when the orbit centre moved; with the ripples off they
were gone.

Each ripple now fades by how far its own phase turns across the pixel (the rest
position's screen derivatives, along the wave's direction): whole within an eighth of a
turn, gone at a quarter. The variance it drops goes to the GGX lobe, as the shared fade's
did. oWaterFull takes the derivatives (dpx, dpy), which both callers (the water node,
lsystem_coast) already take before any branch.

Twelve ripples in place of six (1.7 m down to 0.43 m in equal ratios, golden-ratio
directions within 0.95 rad of the wind, scattered phases): six fixed waves of equal
steepness sum to a pattern that repeats, read as regular parallel ridges near the camera
at 16 m/s and, once the rings were gone, a diagonal lattice further off. With the
ripples off the near grid's own waves leave the lake almost flat, so they carry its
texture.
…bles

A pixel too coarse for the longest ripple whichever way it runs (k times its shortest
axis, bounded below by its area over the root of its axes' squares, at least a quarter
turn) skips the loop, as the shared fade skipped it past 0.5 m: far water costs what it
did. The wavenumbers, frequencies and direction cosines are constants, not worked out
per fragment.

Measured with a scratch harness (oWaterFull on a full 1280 x 720 quad, glFinish over 100
quads, old and new alternated 12 times, Intel Arc iGPU): 0.081 ms a frame more than the
six ripples' 0.087 where every ripple is resolved, 0.054 on terrain_lab's grazing view,
0.001 where none is.
@transfix
transfix merged commit cdba913 into master Nov 18, 2026
29 checks passed
@transfix
transfix deleted the fix/water-rings branch November 18, 2026 09:00
transfix added a commit that referenced this pull request Nov 18, 2026
…tprint (after #1349) (#1351)

* water: fade each glitter ripple by its own pixel footprint, twelve of them

The rings on terrain_lab's lake were the A4 shading's glitter ripples (oMicroSlope)
aliasing. They faded together as the isotropic footprint (the geometric mean of the
pixel's axes) grew from 0.12 m to 0.5 m. At a grazing angle the mean hides the long
axis: from 140 m at 10 degrees a pixel is 0.1 m across the view and 0.58 m along it,
the mean read 0.24 m and kept 80 % of the waves, and the pixel sampled them along the
view at under two pixels a crest. A fixed wave sampled past that aliases into a zone
plate: evenly spaced rings round the screen point where it is one crest a pixel. They
kept their place on the screen when the orbit centre moved; with the ripples off they
were gone.

Each ripple now fades by how far its own phase turns across the pixel (the rest
position's screen derivatives, along the wave's direction): whole within an eighth of a
turn, gone at a quarter. The variance it drops goes to the GGX lobe, as the shared fade's
did. oWaterFull takes the derivatives (dpx, dpy), which both callers (the water node,
lsystem_coast) already take before any branch.

Twelve ripples in place of six (1.7 m down to 0.43 m in equal ratios, golden-ratio
directions within 0.95 rad of the wind, scattered phases): six fixed waves of equal
steepness sum to a pattern that repeats, read as regular parallel ridges near the camera
at 16 m/s and, once the rings were gone, a diagonal lattice further off. With the
ripples off the near grid's own waves leave the lake almost flat, so they carry its
texture.

* water: the ripples skip a pixel too coarse for them, from constant tables

A pixel too coarse for the longest ripple whichever way it runs (k times its shortest
axis, bounded below by its area over the root of its axes' squares, at least a quarter
turn) skips the loop, as the shared fade skipped it past 0.5 m: far water costs what it
did. The wavenumbers, frequencies and direction cosines are constants, not worked out
per fragment.

Measured with a scratch harness (oWaterFull on a full 1280 x 720 quad, glFinish over 100
quads, old and new alternated 12 times, Intel Arc iGPU): 0.081 ms a frame more than the
six ripples' 0.087 where every ripple is resolved, 0.054 on terrain_lab's grazing view,
0.001 where none is.

* water: the cascades' slopes per fragment, filtered at the pixel's footprint

The near grid took its normal from its vertices (central differences 1-4 m wide over 2-8 m
triangles), which drops every wave under about 4 m, a lake's short-cascade peak; the far grid
took central differences of nearest texels per fragment.

OceanCascades now writes each cascade's height slopes (the spectrum's own dh/dx and dh/dy,
which the time pass works out for the Jacobian's buffers) into a layer of an RG16F 2D texture
array, one pass with a draw buffer a layer, and mipmaps it. Both grids read it per fragment with
textureGrad at their own footprint (anisotropic where the context can), so the waves a pixel
cannot resolve average away instead of aliasing. The near grid's vertex normal carries only the
swell; oWaterFull's nstep is 0 (nothing coarser than the pixel bounds the normal). One more
fragment sampler: cvcgl_ariadne_realize's 16-unit scene draws with none short.

vtkOpenGLFramebufferObject::AddColorAttachment attaches a texture array's layer as a 2D texture
and leaves the attachment empty, so the layers are attached with glFramebufferTextureLayer.
cvcgl_ocean_fft checks the layers against the height tiles' central differences (correlation
0.93-0.96, ratio 1.11-1.19 at N = 64) and counts the pass (3 + 2 log2 N).

On terrain_lab's sheltered lake little changes: the lee scales the cascades to about 0.06-0.3,
and the ripples, which take the share the lee removes, still carry most of the near texture.
With the lee off at 16 m/s the cascades' slopes draw a short-crested sea. No rings in any view.

Cost (scratch harness, full 1280 x 720 quad, Intel Arc iGPU): near grid +0.018 ms close,
+0.051 ms grazing; far grid -0.085 ms, -0.07 ms grazing (two filtered reads in place of eight
nearest fetches); slope pass and mipmaps +0.08 ms a frame.

* tests: the tiler's action test gets the segmentation's 900 s, as its twin

TilerIntrinsicsAriadne.AnActionStartsItUnderTheDefaultLimits (#1334) tiles a 30-slice tube
through an action's frame loop under ctest's default 300 s and a 300 s loop of its own. It takes
109-111 s in a Debug job (two other branches' package-linux / libcvc-debug runs today); on
#1351's run 44274032889 the runner was 3-5x slower (the segmentation twin took
548 s, the skeleton's 31 s against 10 s) and it timed out three times. Its segmentation twin got
ctest TIMEOUT 900 and a 900 s loop for the same reason; this gives it the same.
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