Skip to content

Round-2 quick wins: water grazing, backlit trees, fog, shafts, title centering#2

Merged
proggeramlug merged 1 commit into
mainfrom
feat/round2-quickwins
Jul 8, 2026
Merged

Round-2 quick wins: water grazing, backlit trees, fog, shafts, title centering#2
proggeramlug merged 1 commit into
mainfrom
feat/round2-quickwins

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Phase-1 visual fixes from the round-2 audit (report + evidence index included as docs/audit-round2.md; baselines in tools/.testout/audit2/). Every change is anchored to a measured finding and re-validated on the same camera poses at 4K.

Measured results (before → after)

Metric (fixed audit pose, region luma) Audit baseline This PR
Grazing water vs sky above the horizon 1.16–1.23× (river brighter than the sky) 1.00×
Waterline "milk band" fat white sheet spilling over both banks thin plausible haze line
Backlit canopy vs hills behind +35% (flat pale-mint blobs) +26%, and only on sun-struck top facets — sides now shade properly

Water (assets/materials/water.wgsl, audit F2)

  • Re-lands the grazing calibration lost in the round-1 merge, as min(schlick, 0.60).
  • Lifts reflected rays off the horizon (r.y >= 0.08) — the GGX-prefiltered horizon mip is a pale wash that doesn't exist in the real sky.
  • Crest foam fades with view angle (measured ~5% of the stripe).
  • Screen UV now derives from the fragment position; the per-vertex perspective-divided varying landed on the wrong snapshot texel at exactly the grazing distances that looked worst.

Trees (assets/materials/tree.wgsl, audit F3)

  • Crown self-occlusion on the sky fill (sides 35%, tops 100%): env irradiance by normal gave side facets half the sky dome — the core of the washed silhouettes.
  • Rim-gated, shadowed, cloud-modulated leaf transmission (a full-crown first cut measurably brightened the silhouettes — see the audit's v1 vs v2 numbers).
  • Direct term now carries sun_dir.w (the 1.1× sun intensity was silently dropped); leaf shadow floor deepens with distance.

main.ts

  • Fog heightRef 0 → -0.6, density 0.024 → 0.016: the reference sat exactly at water level, so grazing views integrated the densest slab down the whole valley — that was most of the visible band (it spilled over dry banks too).
  • Sun shafts 0.4/0.96 → 0.18/0.90 (up to ~+0.14 HDR additive veil on every sunward silhouette).
  • Title centering uses measureText — verified exact in the current engine down to the binary; the 0.58 hand estimate was the off-centering.
  • The drifted inline water fallback is no longer engaged (stale lighting + mismatched params layout). SH-005 codegen is the durable fix.

Follow-ups tracked

Engine-side siblings (duplicate cutout transmission block, 2D gamma, SSR/IBL crossfade, sharpen knob) land separately; see audit F-numbers in the report.

Summary by CodeRabbit

  • Bug Fixes

    • Improved water rendering, including reflections, foam, and shoreline behavior.
    • Refined tree lighting for more natural shadowing and backlit appearance.
    • Fixed title screen text alignment for the game name and prompt.
  • New Features

    • Updated scene lighting settings for fog and sun shafts to create a cleaner visual look.
  • Documentation

    • Added a new audit note with findings and follow-up recommendations.

… shafts, title

Validated on the audit poses (region-luma vs the round-2 baselines):
- water at grazing: clean-water rect now 1.00x sky luma (was 1.16-1.23x —
  the river measured BRIGHTER than the sky); the fat white band at the
  waterline is gone
- backlit treeline: canopy/background 1.35 (audit) -> 1.26, and crowns
  now read as shaded volumes (lit tops, darker sides, saturated green)
  instead of flat pale-mint blobs; the remainder is sun-struck top facets

water.wgsl (audit F2):
- re-land the lost grazing calibration as min(schlick, 0.60)
- lift reflected rays off the horizon (r.y >= 0.08): the GGX-prefiltered
  horizon mip is a pale wash that does not exist in the real sky
- fade crest foam by view angle (measured ~5% of the milk stripe)
- screen UV from the fragment position, not a per-vertex perspective
  divide (wrong snapshot texel at grazing distances)

tree.wgsl (audit F3):
- crown self-occlusion on the sky fill (sides 35%, tops 100%) — env
  irradiance by normal alone gave side facets half the sky dome
- rim-gated, shadowed, cloud-modulated leaf transmission (a full-crown
  version brightens exactly the silhouettes the audit flagged)
- direct term carries sun_dir.w; leaf shadow floor deepens with distance

main.ts:
- fog heightRef 0 -> -0.6, density 0.024 -> 0.016: the reference sat at
  water level, so grazing views integrated the densest slab down the
  whole valley — that WAS the visible milk band (it spilled over banks)
- sun shafts 0.4/0.96 -> 0.18/0.90 (up to ~+0.14 HDR silhouette veil)
- title centering via measureText (exact in the current engine; the
  0.58 hand estimate was itself the off-centering)
- stop engaging the drifted inline water fallback (stale lighting AND a
  mismatched params layout); SH-005 codegen is the durable fix

Adds docs/audit-round2.md — the full round-2 audit with the evidence
index (tools/.testout/audit2/) these numbers come from.
@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4fc8eabf-ec9e-4a5d-ba1c-ac5de9b7a69a

📥 Commits

Reviewing files that changed from the base of the PR and between af98dbe and aba2ae9.

📒 Files selected for processing (5)
  • .gitignore
  • assets/materials/tree.wgsl
  • assets/materials/water.wgsl
  • docs/audit-round2.md
  • src/main.ts

📝 Walkthrough

Walkthrough

This PR reworks tree shader shadow/backlit/ambient lighting, fixes water shader screen-space UV derivation and reflection/Fresnel/foam calculations, retunes fog and sun-shaft parameters in main.ts, forces file-compiled water material use, corrects title-screen text centering via measureText, adds a Round-2 audit document, and ignores main.pdb.

Changes

Round-2 Audit Fixes

Layer / File(s) Summary
Tree shader lighting rework
assets/materials/tree.wgsl
Adds view direction, distance-gated canopy sun-shadow blending, backlit rim transmission, and crown_ao ambient adjustment feeding into final lit color.
Water shader UV and reflection fixes
assets/materials/water.wgsl
Moves screen_uv computation into fs_main, updates refract_uv, caps Schlick Fresnel at 0.60, and adds grazing-angle foam fade.
Fog/sun-shaft tuning, water material selection, title centering
src/main.ts
Retunes setFog/setSunShafts parameters, forces matWaterFromFile selection, and uses measureText for title/subtitle centering.
Audit doc and gitignore
docs/audit-round2.md, .gitignore
Adds Round-2 audit findings/plan document and ignores main.pdb debug output.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

Not applicable — the changes are shader math tuning, parameter adjustments, and documentation without multi-component orchestration flow.

Related Issues: No related issues were provided in the summary.

Related PRs: No related PRs were provided in the summary.

Suggested labels: shaders, tuning, documentation

Suggested reviewers: Not enough information to suggest specific reviewers.

🐇 A rabbit hopped through leaves and tide,
Fixed the shadows where the trunks reside,
Capped the glare where waters meet the sky,
Measured words so titles center right,
Wrote it down for round two's watchful eye.

🚥 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 accurately summarizes the main visual fixes in the PR, including water, trees, fog, shafts, and title centering.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/round2-quickwins

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

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