Repository navigation
water: the rings on terrain_lab's lake (aliased glitter ripples), and twelve ripples in place of six - #1349
Merged
Conversation
… 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
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 footprintfp(the geometric mean of the pixel's axes) grew from 0.12 m to 0.5 m.fpread 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.water.wake=0gave a pixel-identical image, and the swell and the near grid's shape had already been ruled out.Fix
oWaterFulltakes the derivatives (dpx,dpy). Both callers, the water node'skWaterFsLightand lsystem_coast'sOCEAN_FS_LIGHT, already take them before any branch. No new uniform, sampler or texture, and no process-wide state.Before / after (terrain_lab.ari,
arigl snapshot1280×720,--frames 240, orbit centre (0, 170, 0), elevation 10°, azimuth -120)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.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 snapshotruns, 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 newoWaterFull).Not verified: the browser (WebGL2: an
outparameter andconst float[12]arrays, both GLSL ES 3.00), Linux and macOS (CI).Not done (follow-ups):
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).