Skip to content

cockpit/GeoHelix: tame the Iceland needle field (4.2× cap) + terrain atmosphere (drifting clouds + sun-glint)#96

Merged
AdaWorldAPI merged 2 commits into
mainfrom
claude/geo-iceland-dequantize
Jul 8, 2026
Merged

cockpit/GeoHelix: tame the Iceland needle field (4.2× cap) + terrain atmosphere (drifting clouds + sun-glint)#96
AdaWorldAPI merged 2 commits into
mainfrom
claude/geo-iceland-dequantize

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Fixes the /garmin/iceland needle field and adds atmosphere to the terrain scenes. Client-side only (GeoHelix.tsx) — no asset regeneration, no new parser. Two commits.

1 — The needle field was over-exaggeration, not quantization

The "dequantize" framing turned out to be a misnomer. I decoded the live v8-grid and measured it:

  • 16,515,072 verts (the full DEM, not downsampled)
  • 10,192 distinct height levels (median step ~0.02% — fine, not stair-stepped)
  • ~zero isolated spikes (0 cells poke >5% of span above their neighbours)

So the height data is fine. The needles were the client's auto-exaggeration: 0.11/span drives Iceland's tiny true-scale span (~0.0067) to ~16×, versus the canyon's 2.2× — and at 16× Iceland's genuinely rugged ~100 m fjord/ridge detail frays into needle-hair.

Fix: cap the auto-exaggeration at 4.2×. Iceland clamps 16×→4.2× and reads as a clean island with real relief (mountains, glacier caps, fjords, highland valleys); the canyon (2.2×) sits below the cap so it is unchanged — verified by re-render (walls still read as walls, drape intact). No .DEM reparse needed — rebaking from a different DEM source would have given the same rugged data.

2 — Terrain atmosphere: drifting clouds + KIND-gated sun-glint / ice-sheen

The "Fresnel/specular for ice caps + waves" direction, layered on the crisp relief:

  • Drifting cloud shadows — a world-fixed 2-octave value-noise field scrolled by uTime dapples soft moving shade over the terrain (atmosphere + a real sense of scale). Terrain scenes redraw for the motion, throttled to ~15 fps so the continuous redraw of a heavy DEM stays cheap; anatomy/buildings stay fully on-demand (zero idle cost).
  • Sun-glint + ice-sheen — a Blinn specular term gated by KIND on the raw aColor (not the hypsometric render): ocean (blue-dominant, [26,62,104]) → tight bright sun-glitter that brightens where clouds part; ice/snow (near-white, [238,244,252]) → broad soft sheen. The canyon's grey terrain KIND ([150,150,150]) triggers neither, so its hypsometric-white peaks stay matte — no false glacier shine.

Verify

  • npx tsc --noEmit — clean.
  • Canyon (864 K verts, headless render): cloud shadows visibly dapple the plateau; the rim stays matte (KIND-gating works); the OSM⊕Garmin drape overlay is intact; 2.2× relief unchanged.
  • Iceland (16.5 M verts): the animated scene is too heavy for headless swiftshader, so captured static — the 4.2× relief reads crisp (no needles) and the cloud shadows dapple ocean + land. The ocean sun-glitter is view-angle-dependent (subtle at the aerial default); its gating mechanism is confirmed on the canyon. Honest note: the animated Iceland scene was not headless-verified in motion — it needs a real GPU (the deploy) to confirm the drift + glitter live.

The third of the Garmin terrain arc (after #93 shader, #94 surfel, #95 drape).

🤖 Generated with Claude Code

https://claude.ai/code/session_012jEwwaT5JZ5x8qWvcnaMYC


Generated by Claude Code

Summary by CodeRabbit

  • New Features
    • Added subtle drifting cloud shadows and enhanced lighting effects across terrain views, including improved highlights on water and snow.
  • Bug Fixes
    • Adjusted terrain exaggeration limits to prevent extremely flat landscapes from appearing unnaturally sharp.
    • Improved terrain scene update behavior so animated effects refresh smoothly without affecting non-terrain views.

claude added 2 commits July 8, 2026 11:21
…Iceland needle field

Diagnosis (not a data problem): the /garmin/iceland v8-grid is the full 16.5 M-vert
DEM — 10,192 distinct height levels, ~zero isolated spikes — so the height data is
NOT quantized. The needle-hair on Iceland's steep coasts/ridges is real rugged
~100 m fjord/ridge detail amplified by the auto-exaggeration: 0.11/span drives
Iceland (true-scale span ~0.0067) to ~16×, versus the canyon's ~2.2×. At 16× every
real thin ridge becomes a needle.

Fix: cap the auto-exaggeration at a modest 4.2×. Iceland clamps 16×→4.2× and reads
as a clean island with real relief (mountains, glacier caps, fjords, highland
valleys) instead of a hairball; the canyon sits at 2.2× (below the cap) so it is
UNCHANGED — verified by re-render (walls still read as walls, the drape overlay
intact). Client-side only: no asset regeneration, no new .DEM parser — the
"dequantize" framing was a misnomer, the real lever was the exaggeration.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012jEwwaT5JZ5x8qWvcnaMYC
…gated sun-glint/ice-sheen

Magic pass on the geo terrain shader, the "Fresnel/specular for ice caps + waves"
direction made real, layered onto the 4.2× relief:

- DRIFTING CLOUD SHADOWS — a world-fixed 2-octave value-noise field scrolled by
  uTime dapples soft moving shade across the terrain (atmosphere + a real sense of
  scale). Terrain scenes advance uTime and redraw, THROTTLED to ~15 fps (slow clouds
  need no more) so the continuous redraw of a heavy DEM stays cheap on battery;
  anatomy/buildings never enter this branch and stay fully on-demand (zero idle cost).
- SUN-GLINT + ICE-SHEEN — a Blinn specular term gated by KIND on the RAW aColor
  (not the hypsometric render): ocean (blue-dominant, Iceland Ocean [26,62,104]) →
  a tight bright sun-glitter that brightens where the clouds part; ice/snow
  (near-white, Iceland Ice [238,244,252]) → a broad soft sheen. The canyon's grey
  terrain KIND ([150,150,150]) triggers NEITHER, so its hypsometric-white peaks stay
  matte — no false glacier shine. The vertex shader now computes the relief +
  view-space position up front so the glint has a correct view vector; vColor gains
  headroom (→1.8) so the glitter pops toward white.

Verified by render: on the canyon (864 K verts) the cloud shadows visibly dapple the
plateau, the rim stays matte (KIND-gating), the drape overlay is intact, and the 2.2×
relief is unchanged. On Iceland (16.5 M verts, captured static — the animated scene is
too heavy for headless swiftshader) the clouds dapple ocean + land and the 4.2× relief
reads crisp. The ocean sun-glitter is view-angle-dependent (subtle at the aerial
default) but the gating mechanism is confirmed on the canyon.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012jEwwaT5JZ5x8qWvcnaMYC
@cursor

cursor Bot commented Jul 8, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_079b093a-c189-4d4f-8eb5-f4661acd1c69)

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR extends the terrain vertex shader in GeoHelix.tsx with GLSL value-noise functions to generate drifting cloud shadows, adds specular-like highlights for water and snow, lowers the terrain exaggeration cap to 4.2, and throttles uTime updates to drive cloud animation only for terrain scenes.

Changes

Terrain Cloud Shadows and Rendering Adjustments

Layer / File(s) Summary
Cloud-shadow noise helpers and vertex setup
cockpit/src/GeoHelix.tsx
Adds hash21, vnoise, and clouds GLSL functions; restructures geo path in main() to compute dpos/mvp earlier for view-dependent effects.
Lighting pipeline and color headroom
cockpit/src/GeoHelix.tsx
Replaces single lighting assignment with staged pipeline computing cloud shadow coverage and blending water glint/snow sheen highlights into lit; raises final color clamp headroom; uses precomputed mvp for gl_Position.
Exaggeration cap and uTime throttling
cockpit/src/GeoHelix.tsx
Lowers terrain relief exaggeration cap to EXAG_CAP = 4.2; adds lastCloud timestamp and throttles uniforms.uTime updates for terrain scenes while keeping non-terrain scenes on-demand.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • AdaWorldAPI/q2#92: Both PRs modify cockpit/src/GeoHelix.tsx directly, one setting up the Geo renderer scaffold and the other extending its terrain shader and uniform update logic.

Poem

A rabbit hops beneath the peaks so tall,
Watching drifting clouds cast shadows small. 🐇☁️
Snow now gleams, and water glints with light,
Iceland's spikes are tamed, no longer needle-sharp and tight.
Hop, hop, hooray for terrain done right!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: the 4.2× terrain cap and the added cloud-shadow/sun-glint atmosphere effects.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
cockpit/src/GeoHelix.tsx (1)

657-666: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cap logic is correct; the preceding comment block is now stale.

Math.min(EXAG_CAP, Math.max(1.5, 0.11 / span)) correctly clamps to [1.5, 4.2], and the drape lift at Line 690 reuses uExagVal, so the cap propagates consistently. However, the unchanged comment just above (Lines 652-653) still claims a "consistent vertical presence (~0.11 of the frame) regardless of its true-scale span" and "Iceland … → ~15 (matches the hand-tuned value)". With the 4.2× cap, Iceland now lands at ~4.2×0.0067 ≈ 0.028 of the frame, so both the "~0.11 regardless of span" invariant and the "~15" figure are no longer accurate. Please refresh that comment so the rationale matches the new cap.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cockpit/src/GeoHelix.tsx` around lines 657 - 666, Update the stale
explanatory comment in GeoHelix.tsx near the EXAG_CAP and uExagVal logic so it
matches the current clamp behavior. The comment should no longer claim a fixed
~0.11 frame presence or ~15x exaggeration for Iceland; instead, describe that
the terrain exaggeration is now capped at 4.2x via Math.min(EXAG_CAP,
Math.max(1.5, 0.11 / span)) and that uExagVal is reused consistently for the
drape lift.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@cockpit/src/GeoHelix.tsx`:
- Around line 657-666: Update the stale explanatory comment in GeoHelix.tsx near
the EXAG_CAP and uExagVal logic so it matches the current clamp behavior. The
comment should no longer claim a fixed ~0.11 frame presence or ~15x exaggeration
for Iceland; instead, describe that the terrain exaggeration is now capped at
4.2x via Math.min(EXAG_CAP, Math.max(1.5, 0.11 / span)) and that uExagVal is
reused consistently for the drape lift.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ae7f6e4a-f41d-40fa-822b-d42b2a1c70f2

📥 Commits

Reviewing files that changed from the base of the PR and between 48bf521 and 8faeb5d.

📒 Files selected for processing (1)
  • cockpit/src/GeoHelix.tsx

@AdaWorldAPI AdaWorldAPI merged commit e304207 into main Jul 8, 2026
5 checks passed
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.

2 participants