Skip to content

EN-021: SSR + IBL specular exclusive ownership (env-miss fallback)#78

Closed
proggeramlug wants to merge 1 commit into
fix/round2-stabilityfrom
feat/en021-ssr-ibl-ownership
Closed

EN-021: SSR + IBL specular exclusive ownership (env-miss fallback)#78
proggeramlug wants to merge 1 commit into
fix/round2-stabilityfrom
feat/en021-ssr-ibl-ownership

Conversation

@proggeramlug

Copy link
Copy Markdown
Contributor

Stacked on #75. Implements the ticket filed during round-2 (audit F10) — the double-count fix paired with the env-miss fallback that made a one-liner unshippable.

Design: ownership, not subtraction

Within SSR's active roughness range, SSR now owns specular outright:

  • Scene shader: ibl_spec ×= 1 − ssr_share, where ssr_share = dir_light_count.z × (1 − smoothstep(0.5, 0.85, roughness)) — the exact complement of the SSR shader's own fade. The .z lane is written every frame in clear_additional_lights (SSR strength, or 0 when SSR is off — full IBL returns automatically).
  • SSR march: misses (no hit, off-screen exit, camera-facing rays) return the env panorama sampled by the world-space reflection direction — same equirect mapping as sample_env, roughness × 6 mip ramp, × env intensity (camera_pos.w), × the identical fresnel/fade/strength weighting as a hit. Previously: black, which is why scaling IBL down alone would have darkened every off-screen reflection.
  • Plumbing: SsrParams gains the view→world rotation + env LOD/intensity; the SSR bind group binds the panorama at 9/10 and its cache invalidates on every env-source swap (HDR upload, panorama/procedural swaps).

Expected visual delta

Metals (in the shooter: alien carapaces, weapon) stop popping brighter when their reflected content scrolls on-screen; hit vs miss luma converges. Dielectrics gain coherent hit-or-env behaviour at grazing angles.

Validation

  • Suite green: 99 lib + 7 golden — goldens unchanged within tolerance (the affected metal areas in the golden scenes are small).
  • Boot-smoked on the shooter at 4K (runtime WGSL compile is the real gate for shader edits): clean.
  • The audit's metal-ROI protocol (on-hit vs panned-off luma) is the acceptance test to run once merged into a play build.

Round-2 audit F10: compose is `hdr + ssr` and fs_main_scene already
adds IBL specular into hdr, so SSR-hit pixels double-counted specular
for roughness ~0.05-0.85 (worst on metals at r~0.55-0.75).

The fix is ownership, not subtraction:
- fs_main_scene scales ibl_spec by the complement of SSR's OWN
  roughness fade x its strength. The share rides the free
  dir_light_count.z lane (written per frame; 0 when SSR is disabled,
  so the full IBL term returns automatically).
- The SSR march no longer returns black on a miss: camera-facing rays
  and off-screen/no-hit marches fall back to the env panorama sampled
  by the world-space reflection direction at the material path's
  roughness x 6 mip ramp, x env intensity (camera_pos.w), x the same
  fresnel/fade/strength weighting as a hit. Without this, reducing
  ibl_spec would darken every off-screen reflection - the reason the
  ticket deferred the one-line version.
- SsrParams gains the view->world rotation (transpose of the view 3x3)
  + env LOD/intensity; SSR bind group gains the env panorama at
  bindings 9/10 and its cache invalidates wherever the env source
  swaps (HDR upload, panorama/procedural lighting-bg swaps).

Suite green (99 lib + 7 golden; goldens unchanged within tolerance).
Boot-smoked on the shooter at 4K - no WGSL errors, clean frames.
Closes EN-021.
@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: cae377fb-3621-4e19-aec3-a1b63351189d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/en021-ssr-ibl-ownership

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

@proggeramlug

Copy link
Copy Markdown
Contributor Author

Landed in main via the round-2 consolidation merge (#83). All commits from this branch are now on main; closing as merged-through-integration.

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