Skip to content

A pixel on a mirror has the surface the mirror shows (frame structure, step 2) - #281

Merged
yujiaxu-ops merged 13 commits into
mainfrom
frame-mirror-hit
Nov 26, 2026
Merged

yujiaxu-ops merged 13 commits into
mainfrom
frame-mirror-hit

Conversation

@yujiaxu-ops

@yujiaxu-ops yujiaxu-ops commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

The second step of the frame's structure. A pixel on a mirror has the surface the mirror shows.

  • first_hit follows a camera hit that has a mirror's lobe alone (roughness under 0.025, metalness 1, no glass, no coat), through 8 mirrors at most and all but one of a path's bounces (the surface shown is lit and has its bounce), and records the chain where there is one: the hit the last mirror shows and where its ray starts, the chain's transform, the way to its last mirror, what the mirrors and the segments that end at one leave of the light (Fresnel reflectance; fog's and haze's attenuation) and the light they add (a mirror's emission, fog's and haze's ambient light). It writes the motion vector of the surface shown, as the pixel sees it.
  • main starts its path at the surface shown, in the camera hit's place: the guides (its distance the whole way along the camera ray, its normal turned by the chain, its albedo times the chain's weight), the light seen directly, the signals' split, the path's end in the cache a bounce later. Each mirror takes one of the path's bounces.
  • The camera's own hit stays in the record: the translucency pass and the media read its distance, since a mirror hides what is behind it. The translucency pass binds of group 1 what it reads.

So the filters, the reprojection and the upscaler take a mirror as a window onto what it shows, where its picture was the mirror's specular signal. Glass is as it was; surface_guides stays for it and skips a mirror's pixels.

Which scenes. The material decides: one whose own roughness and metalness say a mirror. A scene with such a material has the kernel feature F_MIRROR and 96 bytes more a traced pixel; another scene's kernel has none of this code.

Cost. Twelve heavy clips, none with a mirror, a frame's GPU time summed: 93.58 ms against main's 93.58. With the feature forced on in all twelve (what a scene with a mirror pays on every pixel): +0.9 %. Two earlier shapes were measured the same way and dropped: main walking the chain itself in its loop, +3.2 %; the chain's record held through main's loop, +5.2 %.

Known limits

  • A material that is a mirror by its texture or its function alone is not followed (the first pass reads a surface's textures only where the material's numbers say a mirror), nor is procedural geometry.
  • A curved mirror's motion vectors are a flat one's, and a mirror's own motion is not in them.
  • A mirror pixel's sampled fog scattering is computed on the segment the mirror shows; its camera segment has the fog's attenuation and ambient light alone.

Checks

  • New test a_pixel_on_a_mirror_has_the_surface_the_mirror_shows: a tinted, faintly glowing mirror at 45 degrees shows a side wall. On its pixels: the distance the whole way, the wall's normal as seen, its albedo under the tint; the light the tint times a white mirror's; the glow in the emission signal; a lamp before the wall lights what the mirror shows; with one bounce a path the wall in the mirror is unlit; the wall moved along the view, its motion vectors go sideways; a translucent card before the mirror is drawn, one behind it is not.
  • Unit suite: 285 pass under hardware traversal, software traversal and the merged layout (main's 284 and the new test).
  • Pictures against main, every render test twice a side, hardware traversal (before main was merged in and before the review's fixes, which touch a mirror's pixels alone): 242 of 272 to the byte, 27 within their run-to-run spread, 3 changed: the three live mirror pictures.
  • Heavy clips: above.
  • The whole suites on another machine, against main's there: unit, both traversals, main's and the new test; render, hardware traversal 273 of 273, software traversal the 24 failures main has and no other.
  • From review, fixed here: a chain as long as a path's bounces left the surface shown unlit; water on the segment a mirror shows was dropped; the merged layout's radiance cache was left behind when the hits' buffer grew; along a chain the fog's start distance and volumetric range were the camera's again on each segment (now what is left of them after the way so far).

🤖 Generated with Claude Code

yujiaxu-ops and others added 3 commits November 25, 2026 20:50
…, step 2): the kernel

The first pass follows a chain of mirrors and leaves its length and transform; the paths walk the chain again and
give the surface it shows the camera hit's place: the guides, the light seen directly, the signals' split.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread renderer/shaders/pathtrace.wgsl Resolved
if (chain > 0u) {
mv = vec4<f32>(xf * mv.xyz, mv.w);
first_xform_store(pix, xf);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving mirrors drop virtual motion

Medium Severity

Motion on a mirror pixel is only the shown surface’s world offset, rotated by this frame’s chain. If the mirror itself moves or rotates, that transform does not include the virtual image’s motion, so a static wall in a moving mirror gets a zero vector and reprojection/upscaling ghost.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 25c60ed. Configure here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Known and now stated in the docs: the motion vector is the shown surface's motion turned by the chain; a mirror's own motion is not in it, nor a curved mirror's curvature. Not addressed in this step.

yujiaxu-ops and others added 3 commits November 25, 2026 21:22
… its weight a Fresnel reflectance

Measured on twelve heavy clips without a mirror: the step cost 5.3 % of a frame in every one, the chain's code
being in every kernel. A material whose own numbers say a mirror makes the feature.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… the light, a translucent card before and behind the mirror

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A step in the middle of main's loop cost 3 to 5 % of a frame wherever a scene had a mirror (measured with the
feature forced on); the first pass's walk 0.2 %. The chain's record: the hit shown, its ray's start, the transform,
the chain's weight and light. The hits' buffer follows the traced size, with a chain's room in a scene with a mirror.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread renderer/src/live/mod.rs Resolved
Comment thread renderer/shaders/pathtrace.wgsl Resolved
yujiaxu-ops and others added 2 commits November 25, 2026 23:02
The chain's record read at the top of the loop's first turn, and again after the loop for the guides' turn and
weight: nothing of it is kept through the loop but its length and its way.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…e bounce; the last vertex's light behind a chain

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread renderer/shaders/pathtrace.wgsl Resolved
yujiaxu-ops and others added 3 commits November 25, 2026 23:19
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… shows; the merged cache after the hits grow

From review: a chain as long as a path's bounces left the surface shown unlit (now all but one of them at most);
homogeneous media on the segment the last mirror shows were dropped (main has them there as on a later segment);
the merged layout's radiance cache is another buffer once the hits' buffer grows, and the view's cache is that one.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
# Conflicts:
#	renderer/src/live/inplace_tests.rs

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 83eec2f. Configure here.

Comment thread renderer/shaders/pathtrace.wgsl Resolved
…shows

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…e what is left of the camera's

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@yujiaxu-ops
yujiaxu-ops merged commit 0d15274 into main Nov 26, 2026
9 checks passed
@yujiaxu-ops
yujiaxu-ops deleted the frame-mirror-hit branch November 26, 2026 08:16
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