Skip to content

The output is composed from guides of its own - #310

Merged
wryyx merged 2 commits into
meshy-dev:mainfrom
wryyx:output-guides
Dec 4, 2026
Merged

wryyx merged 2 commits into
meshy-dev:mainfrom
wryyx:output-guides

Conversation

@wryyx

@wryyx wryyx commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

What

Under a render scale of 1 the live frame now has two grids, each given what it is for:

  • The output grid has the camera's rays. A new kernel entry point, guides, traces the camera's ray for every output pixel each frame, at one of eight places in the pixel: the surface's distance, colour and normal, and the light that is the pixel's own (what it sees directly, and the directional lights' direct light with a shadow ray of its own).
  • The traced grid has the lighting. Its samples stand at their pixels' centres. Before, the frame's jitter moved every traced sample over its pixel: at an edge the sample changed surface, under a normal map texel, and its histories started again.
  • gcompose gives an output pixel the denoised lighting of the traced samples on its surface, times its colour, plus its light. gupscale keeps the output's history; track, judge and reject judge it as they judge the upscaler's.
  • Thin things (Thin, gcarry): a thing thinner than two output pixels that a guide saw is recorded with its distance and carried by the two cameras while later frames' guides miss it. Its light moves with it, is spared the clamp in motion, and is dropped where the thing has gone on.

The setting

reconstruction: "builtin" (the default) is the new frame wherever the traced grid is coarser than the output. "builtin-upscaler" is the frame as it was, and what builtin runs at scale 1 and in a diagnostic view. With builtin-upscaler the picture's measures and the frame's time are main's.

Measured

All on an Apple M4 at half resolution, main → this.

main this
Street held still, change of 4 × 4 block means a frame 0.138 0.046
Street, the same after a turn / a strafe / a stop 0.437 / 0.636 / 0.684 0.189 / 0.302 / 0.202
Street, detail of the offline render: still / mid-turn / walking 0.681 / 0.459 / 0.412 0.776 / 0.551 / 0.539
Street, ΔE against offline: still / mid-turn / walking 2.05 / 2.80 / 3.73 1.92 / 2.63 / 3.43
Hall, detail: still / mid-turn / as the camera stops 0.583 / 0.462 / 0.290 0.645 / 0.538 / 0.405
Hall, ΔE: still / mid-turn / as the camera stops 3.87 / 4.76 / 5.61 3.87 / 4.59 / 5.44
bench-object-ghosting, ΔE over sixteen moments 20 % less in the mean
Lamps a third of a pixel wide, the camera sliding: the field's light of what the lamps give 0.33 (0.79 at scale 1) 1.10

Twelve clips against offline (main, this, this, main): ΔE better on six, the same on one, 0.01 to 0.05 worse on four (a home 2.87 → 2.92, metals and gems 2.32 → 2.35, refraction 0.88 → 0.89, a museum 1.28 → 1.29); detail up on nine; whole pixels' change from a frame to the next less on ten.

What it costs

  • A camera ray an output pixel: a frame's GPU time on the twelve clips 7 to 31 % more (rooms 5.43 → 6.62 ms, a crowded street 10.35 → 13.61, the city 18.24 → 20.43). The street at 1280 × 720: 16.3 → 20.5 ms at rest, 18.2 → 22.0 walking.
  • 60 bytes an output pixel more of buffers, 76 where the scene has media (55 MB at 1280 × 720).

Known and not done

  • bench-ghosting --quick --check passes, with more excess than main's (mid-turn 0.79 → 1.10, trail 5 → 10 pixels; a tenth of a second after a stop 1.46 → 1.67). Not explained.
  • In the hall the block means' change a moment after a stop is 13 % more (0.944 → 1.065), and foliage's whole-pixel change 4 % more.
  • A lamp or lit window thinner than a pixel that is part of a larger surface has no record: in motion the clamp cuts its light.
  • The guides are traced. Rasterised they would cost a fraction; that is what is left to gain in frame time.
  • Dynamic resolution pays for the guides with a lower scale: not measured. Not checked on Vulkan, nor in a browser (both of its modules build).

Tests

  • Unit suite 298 pass (one new: a first frame's texture is at the output's resolution, lit by an emitter and by a sun).
  • Render suite 280 pass (three new: the upscaler's three tests at half scale; a render test may now name a scale and a reconstruction).
  • npm run typecheck, npm test (324 pass, 1 skipped), both wasm32 builds.
  • The three new render tests and the street's picture also under software traversal (THREERT_HWRT=0).

docs/ROADMAP.md § 1a has the full measurements and what was tried and not kept; docs/RUNTIME.md "ThreeRT's own: the output composed from its guides" describes the frame.

🤖 Generated with Claude Code

wryyx and others added 2 commits December 4, 2026 15:15
Under a render scale of 1 the frame has two grids. The kernel's `guides` pass traces the camera's ray for every
output pixel each frame, at one of eight places in the pixel: the surface's distance, colour and normal, and the
light that is the pixel's own (what it sees directly, and the directional lights' direct light with a shadow ray).
The traced grid keeps the lighting, its samples at their pixels' centres: the frame's jitter moved every traced
sample over its pixel, a sample changed surface at an edge and texel under a normal map, and its histories
started again each time.

- `gcompose` gives an output pixel the denoised irradiance and specular light of the traced samples on its
  surface, times its colour, plus its light. `gupscale` keeps the output's history; `track`, `judge` and `reject`
  judge it as they judge the upscaler's.
- A thing thinner than two output pixels that a guide saw is recorded with its distance and its place, and
  `gcarry` takes the record on by the two cameras while the guides of the frames after miss it (`Thin`): the
  history moves with the thing, is spared the clamp in motion, and is dropped where the thing has gone on.
- Reconstruction `builtin` (the default) is this where the traced grid is coarser than the output.
  `builtin-upscaler` is the frame as it was, and what `builtin` runs at scale 1 and in a diagnostic view.
- The guides and a medium's record lie after the traced pixels' direct light in the kernel's direct buffer, which
  grows the first time a frame composes its output.
- A render test may name a render scale and a reconstruction method. Three of the upscaler's tests run at half
  scale too; a unit test holds a first frame's texture to the output's resolution under both kinds of light.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
What it is, what was measured against main (two scenes in motion, the benches, twelve clips against offline), what
it costs, what was tried and not kept, and what is not done.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@wryyx
wryyx merged commit d9d97e3 into meshy-dev:main Dec 4, 2026
10 checks passed
@wryyx
wryyx deleted the output-guides branch December 4, 2026 07:31
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