Skip to content

A camera hit's resampled lights have a pass of their own - #297

Merged
wryyx merged 1 commit into
meshy-dev:mainfrom
wryyx:frame-passes
Nov 30, 2026
Merged

wryyx merged 1 commit into
meshy-dev:mainfrom
wryyx:frame-passes

Conversation

@wryyx

@wryyx wryyx commented Nov 30, 2026

Copy link
Copy Markdown
Collaborator

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.

  • 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 lights 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.
  • 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).

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).

  • Pictures: ΔE against offline, the change from a frame to the next and the detail are the same on each clip.
  • A frame's GPU time:
clip change
a night street with its crowd −14.3 %
a city into the night −7.2 %
a hall of small emitters, a room of neon tubes, a colour lab, a gallery −4.1 to −4.2 %
a jeweller's window −1.3 %
a still room of 768 lamps +1.4 %
four without such lights, or with theirs off by day 0.0 to +1.5 %
  • Unit suite 292 pass, render suite 273 pass.
  • 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

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>
@wryyx
wryyx merged commit 844381b into meshy-dev:main Nov 30, 2026
8 checks passed
@wryyx
wryyx deleted the frame-passes branch November 30, 2026 04:21
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