Repository navigation
water: the cascades' slopes per fragment, filtered at the pixel's footprint (after #1349) - #1351
Merged
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.
…tprint 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.
…/water-near-normal # Conflicts: # docs/roadmap/OCEAN-AND-WEATHER-ROADMAP.md # src/cvcGL/ariadne/water_node.cpp
transfix
enabled auto-merge (squash)
November 18, 2026 09:18
…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
waternode's normal now reads the FFT cascades' slopes per fragment, filtered at the pixel's footprint. Before, the near grid took its normal from its 2 m vertices and the far grid from central differences of nearest texels. Drawing only.Builds on #1349, now on master as cdba913. Master is merged into this branch at cbcce82, so the diff against master is this PR's own change: commit 90bbd04, five files.
Also, a CI fix: commit a0f65db changes two test files.
TilerIntrinsicsAriadne.AnActionStartsItUnderTheDefaultLimits(from P3b part 2: cvc tile, pycvc and tiler.tile (the ContourTiler port's surfaces) #1334) now gets the same ctestTIMEOUT 900and 900 s loop that its segmentation twin already has.Why
What
OceanCascades::slopes()is a 2D texture array: layer c holds cascade c's height slopes (∂h/∂x, ∂h/∂y).glGenerateMipmap, with anisotropic filtering up to 16× where available.textureGradat the fragment's own footprint. Waves a pixel can't resolve average away instead of aliasing.oWaterFull'snstepis 0, so nothing coarser than the pixel bounds the normal any more. The ripples and the GGX lobe take whatoUnresolvedMssstill counts as unresolved.wHthelper is removed.vtkOpenGLFramebufferObject::AddColorAttachmentattaches a texture array's layer as if it were a 2D texture, which leaves the attachment empty (the framebuffer reported INCOMPLETE_MISSING_ATTACHMENT). The layers are attached withglFramebufferTextureLayerinstead, andinitfails if the framebuffer isn't complete.What it shows (terrain_lab.ari,
arigl snapshot1280×720,--frames 240)water.lee=0) at 16 m/s, the cascades' slopes draw a short-crested sea, where water: the rings on terrain_lab's lake (aliased glitter ripples), and twelve ripples in place of six #1349 showed mostly ripple ridges. A diagnostic build with the ripples forced off shows the cascades alone carrying that texture.Frame cost (scratch harness, not committed: a full 1280×720 quad, glFinish over 100 quads, old and new alternated 12 times; Intel Arc iGPU, where cvcGL's contexts run; two runs agreed)
Not measured: the vertex shader's savings (12 texel fetches less per near-grid vertex).
Tests run locally (Windows, MSVC Release; pass)
cvcgl_ocean_fft:cvcgl_ariadne_realize(307 checks): the 16-texture-unit scene still draws with no draw short of units.cvcgl_ariadne_physics.Not verified: the browser (WebGL2:
sampler2DArrayandtextureGrad, RG16F rendering andgenerateMipmap,framebufferTextureLayer), Linux and macOS (CI).Not done: a LEAN-style variance from filtered slope moments in place of
oUnresolvedMss's footprint heuristic; lsystem_coast's sea (OceanFFT, its own vertex normal).Docs: the roadmap's A4 notes (OCEAN-AND-WEATHER-ROADMAP.md, "The cascades' slopes per fragment"); the water node's and OceanCascades' header comments.