Skip to content

PT-5 + PT-4: specular NEE, fight-perf protocol, ReSTIR DI (experimental)#93

Merged
proggeramlug merged 1 commit into
mainfrom
feat/pt5-integration
Jul 14, 2026
Merged

PT-5 + PT-4: specular NEE, fight-perf protocol, ReSTIR DI (experimental)#93
proggeramlug merged 1 commit into
mainfrom
feat/pt5-integration

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes out the path-tracing roadmap (docs/pt/pt-roadmap.md).

  • Specular NEE at every path vertex: direct_light evaluates the GGX highlight (same D/F/V as sample_brdf) for the sun and the sampled point light - the shadow ray is already paid, so it rides free. Closes the documented PT-2 gap; the primary-only sun specular block is deleted.
  • Progressive + combat = skip, not burn: tlas_version bumps every combat frame; the accumulation reset now also skips the dispatch (it used to trace at full res while showing raster). Measured PROG-in-fight cost: raster + 0.2 ms.
  • PT-4 ReSTIR DI, experimental (BLOOM_PT_RESTIR=1): RIS over 8 candidates + temporal reservoir reuse through the shared SVGF reprojection basis (M-cap 20x, target re-evaluated at the current shading point, one shadow ray for the winner; bounce vertices keep plain NEE, progressive stays the pure-NEE oracle). Validated at parity vs plain NEE - delta inside the scene noise floor, no energy shift, no cost delta - exactly what the roadmap predicted for a 5-light arena. The payoff arrives with emissive-particle lights. Reservoirs raise the kernel to 9 storage buffers; max_storage_buffers_per_shader_stage is now requested from the adapter on both platforms.
  • Fight-scene perf protocol (perf-round-3 rule) run and recorded, 760M / 4K / rs 0.75: raster ~45 fps light combat, 32-36 heavy; RT 27.5 / 20-23; PROG rides raster. Full matrix + hardware-verified fallback table in docs/pt/PT-5-integration-and-restir.md.

Shooter-side settings row: Bloom-Engine/shooter PR.

https://claude.ai/code/session_018574BdCfSjdpNK3WLgx1hP

Summary by CodeRabbit

  • New Features
    • Added experimental ReSTIR direct-lighting support for realtime path tracing, improving point-light sampling and temporal reuse.
    • Enhanced path-traced lighting with GGX specular highlights from sunlight and point lights.
  • Performance
    • Reduced unnecessary rendering work when path-tracing accumulation resets during scene or combat changes.
  • Compatibility
    • Improved support across graphics adapters by accommodating path-tracing storage requirements and providing fallback behavior where advanced features are unavailable.

…perimental)

- direct_light gains a GGX specular term (nee_spec) for the sun AND the
  sampled point light at every path vertex - the shadow ray is already
  paid, so specular NEE rides free. Closes the documented PT-2 gap;
  the primary-only sun specular block is deleted.
- Progressive mode skips the dispatch when the tlas_version reset
  invalidated accumulation (every combat frame): it used to pay the
  full-res trace cost while displaying raster. Measured: PROG during a
  fight now costs raster +0.2ms GPU.
- PT-4 ReSTIR DI behind BLOOM_PT_RESTIR=1: RIS (8 candidates) +
  temporal reservoir reuse through the shared SVGF reprojection basis,
  M-cap 20x, target re-evaluated at the current shading point, one
  shadow ray for the winner. Validated at parity vs plain NEE (delta
  inside the scene noise floor, no energy shift, no cost delta) -
  the architecture for future emissive-particle lights, as the roadmap
  scoped it. Reservoirs raise the kernel to 9 storage buffers;
  max_storage_buffers_per_shader_stage is now requested from the
  adapter on both platforms.
- Fight-scene perf protocol run and recorded (760M, 4K, rs 0.75):
  raster 45/32-36 fps, RT 27.5/20-23 fps, PROG rides raster. Full
  matrix + verified fallback table in docs/pt/PT-5-integration-and-restir.md.

Claude-Session: https://claude.ai/code/session_018574BdCfSjdpNK3WLgx1hP
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: deb657db-bba5-4b30-a40e-c09814c01458

📥 Commits

Reviewing files that changed from the base of the PR and between 1f6f090 and 5d2b9b5.

📒 Files selected for processing (6)
  • docs/pt/PT-5-integration-and-restir.md
  • native/shared/src/attach.rs
  • native/shared/src/renderer/mod.rs
  • native/shared/src/renderer/pt_pass.rs
  • native/shared/src/renderer/shaders/pt.rs
  • native/windows/src/lib.rs

📝 Walkthrough

Walkthrough

Adds experimental PT-4 ReSTIR DI with reservoir buffers, reprojection, temporal reuse, and single-winner shadow testing. Unifies GGX specular NEE, skips progressive dispatch after TLAS resets, raises storage-buffer limits, and documents PT-5 integration and validation.

Changes

Path tracing integration

Layer / File(s) Summary
GPU resource and capability contracts
native/shared/src/attach.rs, native/windows/src/lib.rs, native/shared/src/renderer/mod.rs, native/shared/src/renderer/pt_pass.rs
Adds PT-4 reservoir fields, storage bindings, buffer allocation and resize invalidation, the BLOOM_PT_RESTIR flag, uniform wiring, and adapter storage-buffer limit configuration.
Direct lighting and ReSTIR shader pipeline
native/shared/src/renderer/shaders/pt.rs
Adds GGX specular NEE for sun and point lights, reprojection state, RIS candidate selection, temporal reservoir reuse, and selected-light shadow testing.
Progressive dispatch and accumulation integration
native/shared/src/renderer/pt_pass.rs, native/shared/src/renderer/shaders/pt.rs
Skips progressive dispatch after TLAS rebuilds, routes realtime PT-4 point lighting, and reuses reprojection state for SVGF accumulation and fallback history.
PT-5 integration record
docs/pt/PT-5-integration-and-restir.md
Documents lighting integration, combat performance behavior, measurement results, settings and fallback gates, ReSTIR validation, and completed roadmap tickets.

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

Sequence Diagram(s)

sequenceDiagram
  participant Renderer
  participant PTKernel
  participant ReSTIRReservoir
  participant ShadowRay
  Renderer->>PTKernel: dispatch realtime path-tracing pass
  PTKernel->>PTKernel: compute reprojection state
  PTKernel->>ReSTIRReservoir: read previous reservoir
  PTKernel->>ReSTIRReservoir: write selected reservoir
  PTKernel->>ShadowRay: test selected point light
  ShadowRay-->>PTKernel: return visibility
  PTKernel-->>Renderer: accumulate weighted lighting
Loading

Possibly related PRs

✨ 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/pt5-integration

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.

@proggeramlug proggeramlug merged commit eebf2f2 into main Jul 14, 2026
8 of 10 checks passed
@proggeramlug proggeramlug deleted the feat/pt5-integration branch July 16, 2026 07:35
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