feat(renderer): Henyey-Greenstein cloud phase function (ADR-0038) #103

Merged
akadmin merged 1 commit from feat/cloud-phase-function into main 2026-07-10 03:35:12 +00:00
Owner

Implements #26: anisotropic forward scattering for the volumetric clouds.

  • Single Henyey-Greenstein lobe on the direct sun term, 4pi-normalized so g = 0 reproduces the isotropic ADR-0037 lighting bit-for-bit; evaluated once per ray (view/sun angle is constant along the march). Ambient stays isotropic so anti-sun clouds keep their fill.
  • Tunable g as CloudParams::phase_g (default 0.7 per the ticket), packed into the reserved misc.z push lane — CloudPush stays 48 bytes, no descriptor or serialization changes.
  • Forward peak capped at PHASE_MAX = 4.0: screenshot verification showed the raw ~19x peak clipping a wide cone around the sun to pure white after Reinhard + 8-bit; the cap keeps the halo bright but preserves cloud structure near the sun.
  • ADR-0038 records the decision (dual-lobe HG, powder term, sun color stay deferred); CLAUDE.md atmosphere section updated.

Verified visually at a low sun: silver lining around the sun, brightness falls off with view angle, sun-facing clouds brighter. cargo test / fmt / clippy -D warnings clean.

🤖 Generated with Claude Code

Implements #26: anisotropic forward scattering for the volumetric clouds. - Single Henyey-Greenstein lobe on the direct sun term, 4pi-normalized so `g = 0` reproduces the isotropic ADR-0037 lighting bit-for-bit; evaluated once per ray (view/sun angle is constant along the march). Ambient stays isotropic so anti-sun clouds keep their fill. - Tunable `g` as `CloudParams::phase_g` (default 0.7 per the ticket), packed into the reserved `misc.z` push lane — `CloudPush` stays 48 bytes, no descriptor or serialization changes. - Forward peak capped at `PHASE_MAX = 4.0`: screenshot verification showed the raw ~19x peak clipping a wide cone around the sun to pure white after Reinhard + 8-bit; the cap keeps the halo bright but preserves cloud structure near the sun. - ADR-0038 records the decision (dual-lobe HG, powder term, sun color stay deferred); CLAUDE.md atmosphere section updated. Verified visually at a low sun: silver lining around the sun, brightness falls off with view angle, sun-facing clouds brighter. `cargo test` / `fmt` / `clippy -D warnings` clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(renderer): Henyey-Greenstein cloud phase function (ADR-0038)
All checks were successful
CI / build (pull_request) Successful in 3m20s
9382dadee6
Anisotropic forward scattering for the volumetric clouds (#26): the
direct sun term is scaled by a single HG lobe, 4pi-normalized so g = 0
reproduces the isotropic ADR-0037 lighting, evaluated once per ray.
Silver lining appears around the sun; brightness falls off with view
angle. Tunable g rides CloudParams::phase_g (default 0.7) through the
reserved misc.z push lane -- CloudPush stays 48 bytes. Forward peak
capped at PHASE_MAX = 4.0 after screenshot verification showed the raw
~19x peak clipping a wide cone around the sun to white.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
akadmin deleted branch feat/cloud-phase-function 2026-07-10 03:35:12 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
akadmin/NemesisEngine!103
No description provided.