Skip to content

The last bounce lit by the directional lights alone: THREERT_LAST_DIRECT=sun - #84

Merged
doodlewind merged 1 commit into
mainfrom
last-sun
Nov 14, 2026
Merged

doodlewind merged 1 commit into
mainfrom
last-sun

Conversation

@doodlewind

Copy link
Copy Markdown
Collaborator

Problem: on a device whose budget cuts paths to one bounce, the last vertex gets only sky and emitter light unless last_direct is on (Android's default). On a Steam Deck, Daylight Home's ceiling was near black: the sunlit floor lit nothing. last_direct fixes it but adds every light's shadow rays at that vertex: on the Deck, OpenStrikeRT went from 21 to 29 ms a frame (40 → 33 fps).

Change: KernelSwitches::last_sun (THREERT_LAST_DIRECT=sun): the last vertex takes the directional lights alone (sun_light, the same sampling and MIS as direct_light's directional loop). Measured on the Deck: Daylight Home lit the same as with last_direct; OpenStrikeRT 22 ms. Off unless set. Everything new sits under @if(last_sun && !last_direct), so every other variant's WGSL is unchanged. Tests cover the option parsing and the variant's shape, and every_kernel_variant_is_valid now includes it.

The ThreeRT clients set it for a one-bounce budget off Android.

🤖 Generated with Claude Code

…ECT=sun (`last_sun`)

A device whose budget cuts paths to one bounce lit that bounce's vertex by the sky and emitters alone unless
`last_direct` was on (Android's default): on a Steam Deck Daylight Home's ceiling was near black, the sunlit floor
lighting nothing. `last_direct` gives it back but costs every light's shadow rays at that vertex: on the Deck
OpenStrikeRT's Foundry went from 21 to 29 ms a frame. `last_sun` takes the directional lights alone there (one shadow
ray a light, `sun_light`, as `direct_light` takes them): Daylight Home lit as with `last_direct`, OpenStrikeRT 22 ms.

- `KernelSwitches::last_sun`, flag `last_sun`; THREERT_LAST_DIRECT=sun sets it in place of `last_direct` (which
  includes it). Off unless set; the ThreeRT clients set it for a one-bounce budget off Android.
- `sun_light` and the last vertex's branch are under `@if(last_sun && !last_direct)`: every other variant's WGSL is as
  it was.
- Tests: the option parses on either platform; the variant has the function and the one branch; every variant stays
  valid WGSL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@doodlewind
doodlewind merged commit 28be24b into main Nov 14, 2026
8 checks passed
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