R-12 + glacial relief-fix: terragen preview + Option-A moraine (NOT for master merge)#428
Merged
Conversation
…aptive chunks, material coloring Standalone render could not show a 512x512 diverse-relief map. Three fixes, all presentation-only / golden-neutral: 1. u16-safe drawcall batching. gl_set_drawcall_buffer_capacity(200_000, ...) raised macroquad's batch cap ABOVE u16::MAX, but macroquad indexes a batch as local_index + draw_call.vertices_count as u16 (quad_gl.rs:949). Past 65535 batched verts the as-u16 cast wrapped and the + overflowed (debug: panic "attempt to add with overflow"; release: silent geometry corruption). Bit any map with >65k visible terrain verts (dim>=256 + landforms). Cap -> 60_000 (<= u16) so macroquad auto-flushes each batch. 2. Adaptive chunk height. Fixed ROWS_PER_CHUNK=8 produced >u16 single-chunk meshes at 512. rows_per_chunk(world_dim)=clamp(50000/(dim*30),1,8) keeps each chunk mesh under the cap (8 at dim=64, ~3 at 512). Shared by hex + cube terrain. 3. Color terrain by MATERIAL, not biome. The render coloured by biome, whose palette covered ids 0..=12 - but the coastal landform adds Ocean=13, which fell off the table to the magenta "unknown" fallback (the magenta sea). Biome also can't distinguish landform substrates (sand/till/basalt/tuff/water). New WorldView::surface_material() (defaulted to 0=Air so stubs need no impl; ProcgenWorld overrides with the real byte) + render material_color() ported from world/src/bin/map_dump.rs, so the interactive 3D view and the headless PPM preview read identically. Greedy cube-mesh now merges on (height, material); tests updated accordingly (9/9 green locally). Landforms (tectonics/aeolian/volcanic/glacial/coastal) are enabled in STANDALONE only - the sim path keeps them off (pinned-param contract with the sim worker's world). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KSFzwj8cXU3wLePgNZWAra
branch-guard blocks feature-branch commits (reads the PM main checkout's branch) and no-local-sim's .sim-allow must live at PM/.claude/, not the worktree root — both because kit_project_dir returns CLAUDE_PROJECT_DIR = the main checkout. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KSFzwj8cXU3wLePgNZWAra
…erse-relief terragen Full-HMAX (200) column now 40 world-Y vs hex circumradius 1 (was 80:1); high relief still reads on the tectonic/volcanic peaks without towers. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KSFzwj8cXU3wLePgNZWAra
F52–F58: production wrapper run_glacial(…) calls run_glacial_with(…, &PROFILE, K_BAND) with pinned consts from Phase-0b GATE PASS: d_peak=40, k_band=5. F17 same-commit restated (coupled to struct/contract changes): - slab_ledger_conserves_*: identity (excavated == deposited+exported) holds EXACTLY - post_glacial_height: ≥0 ∧ ≤max(hmax−1, max(incised)) [unclamped erosion tail] - glacial_off_leaves_*: non-ice OUTSIDE k_band untouched (AMENDS #416 ТЗ — F40/F46) - till_marks_at_least_one_local_height_maximum: still holds, profile is margin-peaked - u_trough: wall-drop measured POST-deposit (incision property) or can use pre-deposit F14/F25/F30/F44/F51/F54/F57/F60: added Ledger acceptance clause tests: (ii) hard `exported_till==0` on moraine-absorbing dim64/seed2/mask00010 (iii) non-trivial moraine (deposited>0 ∧ ≥1 local-max Till cell) (iv) plateau tooth: `truncated==0` on pinned profile, `truncated>0` on scaled(K_CTRL=4) F45/step9: deleted throwaway Phase-0/0b instrumentation: - phase0_glacial_stats struct + function - ice_incision_pass_with_split - ice_incision_iteration_scaled, flatten_interior_components_scaled - deposit_thin_band (OLD ∝excavated — replaced by budget-drain in seam) - Phase0bSweepStats struct + phase0b_sweep_cell function - height_stats.rs bin (Phase-0 measurement tool) Kept production: run_glacial_with (the seam), fill_holes_in_ice_mask (P2), deposit_moraine_budget_drain (budget-drain deposit). compile-check.sh: PASS. F21 projection: landform-ON world-gen goldens move (new geometry); OFF/sim goldens stay byte-identical (glacial default-off, erosion untouched). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KSFzwj8cXU3wLePgNZWAra
CI pass 1 revealed: golden_vector_matches_pinned_glacial_fixture failed on index 0. Left (actual from Option-A moraine): [77, 59, 95, 99] Right (old, from v1 moraine): [106, 59, 95, 99] Indices 500/1500/4000 stable — only index 0 changed due to margin-peaked moraine profile geometry at that location. Budget-drain deposition model is working correctly. Re-pinned EXPECTED from [106,59,95,99] to [77,59,95,99]. compile-check.sh: PASS. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KSFzwj8cXU3wLePgNZWAra
…ncised field F1: Delete unused deposit_till function (~glacial.rs:400-412) and its doc comment— the budget-drain deposit_moraine_budget_drain replaced it; zero callers, clippy dead_code. F2: Fix u_trough_structural_signature_on_at_least_3_valley_segments test to measure wall_drop on the PRE-deposit incised field, not post-deposit (F42/F46 ТЗ requirement). Moraine deposit on non-ice cells was falsely steepening the wall metric. Compute incised_height using the same hole-filled mask as production, and pass it to wall_drop instead of on_state.height. Delete the rationalization comment claiming post-till was correct. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KSFzwj8cXU3wLePgNZWAra
… production incision field (re-critic F2) The u_trough_structural_signature_on_at_least_3_valley_segments test was computing margin and interior from the BASE mask, then passing filled_mask to ice_incision_pass. Since fill_holes_in_ice_mask adds cells, base-mask interior != filled-mask interior, causing the test's incised_height to diverge from production's. This made the wall_drop measurement read the wrong field. Fix: Move filled_mask computation before select_valley_segments, recompute margin and interior from filled_mask (matching production exactly), and use the filled_mask consistently for wall_drop closure and all subsequent computations. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KSFzwj8cXU3wLePgNZWAra
Owner
Author
Pre-merge self-review (code-critic, PM-authoritative) — VERDICT: PASSCold
Final: VERDICT: PASS. CI GREEN on HEAD 5ba182b (run #29235149701, all 4 jobs). This branch is NOT for master merge (roadmap-on-branch, per owner). |
Implement a final landform post-processing pass that clips isolated spike artifacts (>NEEDLE_MARGIN above neighbors) and redistributes material downhill via Jacobi gather. Determinism-locked using same discipline as talus_step. Single pass sufficient for the 3 measured needles (excess +94, +47, +45 on seed=1). Gated to run only when at least one landform enabled, preserving all-OFF golden path byte-identity. Mechanism (integer-only, gather): - Pass 1: for each cell v, find max neighbor height and D8 receiver (lowest neighbor, deterministic tie-break by linear index). Compute excess = h[v] - (nmax + NEEDLE_MARGIN). - Pass 2: each cell gathers redistributions from neighbors whose receiver targets it. NEEDLE_MARGIN=40 calibrated to measured relief on hmax=200 fBm (typical 1-cell overhangs on smooth terrain). Tests: conservation (zero-sum), spike-clipping (>nmax+margin clipped ≤margin), non-spike preservation (≤margin unchanged), determinism/order-independence. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KSFzwj8cXU3wLePgNZWAra
…p [p2,p98] normalized ramp 'C' toggles Height<->Material (default Height). height_color normalizes by the map's observed relief band [p2,p98] (not fixed hmax=200): real terrain is bottom-heavy (p50~2, p98~109 at seed=1/512), so the fixed datum crammed all relief into the ramp's low green third. Per-map stretch spreads green->brown->snow over the relief that exists; sparse >p98 peaks clamp to the snow top. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KSFzwj8cXU3wLePgNZWAra
Census (seed1/512) after the 40-clip still left a smooth continuum of thin 1-cell columns at excess +30..40 (17 cells) that read as needle towers on the 3D render. 30 also clips those (lone_peaks(margin>30): 17->0) while staying above the fBm-roughness continuum (excess <30 is legitimate relief texture; below ~25 starts smoothing genuine roughness). Tests + doc updated. Landform-ON path only (gated) -> v2 goldens unaffected, as with the original de-needle pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KSFzwj8cXU3wLePgNZWAra
Exploratory comparison tooling, both directions: - v1_map_dump bin + --v1-dump loader in v2 render (v1 map in v2 viewer) - v2 terrain_dump bin + ANIMATA_TERRAIN_DUMP env branch in v1 streamer (reverse dir) - height_stats throwaway measurement bin (Phase-0 style, reused by W-9) compile-check PASS in all 3 workspaces. Not for master as-is. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KSFzwj8cXU3wLePgNZWAra
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.
What
Terragen diverse-relief render preview (512²) + the plan-consensus'd Option-A glacial relief fix. Roadmap-on-branch — do NOT merge to master (per owner).
Render preview (initial)
quad_gloverflow at 512²), adaptiverows_per_chunk, material coloring (not biome),HEIGHT_SCALE 0.4→0.2.Glacial relief fix (Option A — 17-fork plan-consensus)
Root (Phase-0 measured): glacial
deposit_tilldumped AREA-scale excavated mass (~627–859 units/cell, 3–4× the [0,hmax] range) onto a 1-cell margin → clamp rim (the "ceiling plateau"); ice_mask needles (459–583). Excavated ≫ in-range capacity ⇒ un-placeable by any geometry.K_ICE/flattenUNCHANGED (Route-1 excavation-reduction DROPPED).run_glacial_with(…,&PROFILE,k_band)seam (budget-drain),PROFILE{d_peak=40},K_BAND=5; hard cap≤hmax−1⇒ plateau impossible by construction.exported_till~91–99% — faithful glacial physics; the ≤1% ε was withdrawn as physically wrong).S_max=16de-needles (needles → 0 at 512).:445ON-path clamp dropped (tail matches OFF path, F21/F22).Acceptance
truncated==0(no plateau),needles==0(was 459–583),median_resource≥1,solid_frac∈[0.15,0.50], ledger identityexcavated==deposited+exported_tillexact.exported_till==0on dim64/s2/mask00010; (iii) non-trivial moraine (deposited>0∧ Till local-max); (iv) deposit-referenced plateau toothtruncated==0+ positive controlPROFILE.scaled(4)⇒truncated>0(K_CTRL=4)._scaled/olddeposit_thin_band/height_statsbin);run_glacial_withpromoted to production.golden_vector_matches_pinned_glacial_fixturemoved (index 0: →77; CI-measured, arch-agree); all other gen goldens + simv2_golden_conserved_*byte-identical (F21).Plan + Phase-0b numbers: animata-pm
reports/terragen-height-contract-plan.md(+ PHASE0*).🤖 Generated with Claude Code
https://claude.ai/code/session_01KSFzwj8cXU3wLePgNZWAra