Repository navigation
A camera hit's resampled lights have a pass of their own - #297
Merged
Merged
Conversation
The lights a live path's camera hit resamples (the emitters, and the local lights past those it sums exactly) are lit after the paths, in a pass of the kernel of their own (`direct`), at the surface the paths leave there. - `main` leaves the surface it evaluated at the camera hit in the first pass's buffer, after the hits and the chains: 64 bytes a traced pixel (its place, its colour and the path's weight as they are; its normals and its material's numbers in fewer bits). It takes the rest of the hit's direct light itself: the directional lights, the local lights summed exactly, the sky (`direct_light` by part: `dl_part`). - `direct` lights that surface with the same estimators and the sample's own numbers, and adds the diffuse and the specular part to the pixel's signals; it writes the light tiles' report. - The frame says when the pass runs (`Params::jitter.w`): in a scene with emitters or with more shadow-casting local lights than a camera hit sums exactly. While none of them is on, the paths leave no surface and the pass returns at once. No buffer more, both layouts. THREERT_DIRECT_PASS=0: the paths light the hit themselves (A/B). Measured against main on twelve clips, the two builds alternated (an M4, 960 x 540): the pictures as they were (ΔE against offline, the change from a frame to the next, the detail: the same on each); a frame's GPU time -14.3 % on a night street with its crowd, -7.2 % on a city into the night, -4.1 to -4.2 % on four more clips of many emitters, -1.3 % and +1.4 % on two more, 0.0 to +1.5 % on the four without such lights or with theirs off by day. Unit suite 292, render suite 273; bench-ghosting --quick --check, bench-object-ghosting and bench-temporal --shot edit as before. Tried first with every sampled light in the pass and the surface as 112 bytes: a sunlit garden +8.8 %, a house by day +8.6 %, a softbox over glass +5.8 %. The split of all of a camera hit's direct light was tried and left on 2026-11-07 (docs/ROADMAP.md § 1). Test: a_camera_hits_lights_in_their_own_pass_are_the_paths (the pass's picture 0.02 steps of 255 from the paths' own, at the view's size and at half of it). docs/ROADMAP.md § 1a also records where the samples' noise that is left was found (direct light: at the camera hit on the street, at the vertices after it in the hall) and a change that was measured and not merged (more of the light tree's candidates at those vertices). Not checked on Vulkan, nor in a browser. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The lights a live path's camera hit resamples (the emitters, and the local lights past those it sums exactly) are lit after the paths, in a pass of the kernel of their own (
direct), at the surface the paths leave there.mainleaves the surface it evaluated at the camera hit in the first pass's buffer, after the hits and the chains: 64 bytes a traced pixel (its place, its colour and the path's weight as they are; its normals and its material's numbers in fewer bits). It takes the rest of the hit's direct light itself: the directional lights, the local lights summed exactly, the sky.directlights that surface with the same estimators and the sample's own numbers, adds the diffuse and the specular part to the pixel's signals, and writes the light tiles' report.Params::jitter.w): in a scene with emitters, or with more shadow-casting local lights than a camera hit sums exactly. While none of them is on, the paths leave no surface and the pass returns at once.THREERT_DIRECT_PASS=0: the paths light the hit themselves (A/B).The picture does not change. The pass is where the lights that are resampled are now lit together, and where anything that keeps or shares their samples would run.
Measured
Against main on twelve clips, the two builds alternated (an M4, 960 × 540).
bench-ghosting --quick --check,bench-object-ghosting --scene all,bench-temporal --shot edit: as before.What it took
Tried first with every sampled light in the pass and the surface as 112 bytes: a sunlit garden +8.8 % of its frame (no such light at all), a house by day +8.6 % (its lamps off), a softbox over glass +5.8 % (one light, summed exactly). So: only the resampled lights, only while some are on, and the surface in 64 bytes.
A mistake of mine on the way, found by the A/B switch and held by the test now: the kernel took the buffer's length for "the pass runs", and a view traced at half its size has that room unasked. The frame says it in a parameter.
The split of all of a camera hit's direct light was tried and left on 2026-11-07 (docs/ROADMAP.md § 1), when it cost a district of signs 4 %.
Also in docs/ROADMAP.md § 1a
Where the samples' noise that is left in two night clips was found (direct light: at the camera hit on the street, at the vertices after it in the hall), and a change that was measured and not merged (more of the light tree's candidates at those vertices: the hall's change −19 %, three other clips' frames +4 to +6 % for nothing).
Test
a_camera_hits_lights_in_their_own_pass_are_the_paths: a wall under thirty-six small lamps and fifteen point lights, lit by the pass and by the paths themselves: 0.02 steps of 255 apart, at the view's size and at half of it; also run under software traversal.Not checked
Vulkan, DX12; a browser (the merged layout's WGSL and its buffer count are held by the unit suite, not a run).
🤖 Generated with Claude Code