Skip to content

A camera ray's fog light is seen directly - #286

Merged
yujiaxu-ops merged 16 commits into
mainfrom
fog-ambient-direct
Nov 26, 2026
Merged

yujiaxu-ops merged 16 commits into
mainfrom
fog-ambient-direct

Conversation

@yujiaxu-ops

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

Copy link
Copy Markdown
Collaborator

The first step of taking fog out of the path's signals.

The ambient light height fog scatters towards the camera on a camera ray joins the emission signal, as the aerial haze already does. It was part of the surface's diffuse light, which the filters divide by the surface's albedo (floored at 0.02) and filter with the surface: fog before a black surface was lost, and fog was blurred with what stood behind it.

Not in this step: the fog's attenuation stays the path's, and so does its sampled scattering from lights (outside the diffuse signal it would be unfiltered noise). Both leave with a volume of their own, the next step.

Checks

  • New test the_fogs_ambient_light_is_seen_directly: a black surface in fog with no light in the scene: the diffuse signal is empty, the emission signal holds the fog's light by the distance, and the picture shows it.
  • Unit suite: 286 pass under hardware traversal, software traversal and the merged layout.
  • Heavy clips, a frame's GPU time summed over twelve: 93.53 ms against 93.45 without the change (+0.1 %), their quality scores the same. None of the twelve has height fog: they show the change costs a scene without fog nothing, not what it does to one with.
  • The whole suites on another machine, against main's there: unit, both traversals, main's and the two new tests; render, hardware traversal 273 of 273 (the live fog tests among them), software traversal the 24 failures main has and no other. (Before main was merged in; the tree against main is the same change.)

🤖 Generated with Claude Code


Note

Medium Risk
Touches live path-tracing signal layout and denoiser inputs for foggy camera rays; behaviour change is targeted and covered by a new inplace GPU test, with small reported GPU cost.

Overview
First step of separating fog from path signals: ambient height-fog scattered toward the camera on the primary ray is recorded as directly seen light in the emission signal (e0), the same way aerial haze already is—not mixed into diffuse irradiance that denoisers divide by surface albedo.

In pathtrace.wgsl, fog along the camera march still adds to path radiance, but when depth == 0 the ambient term thr * (1.0 - tr) * P.fog_color.rgb is also accumulated into e0. That fixes black (or very dark) surfaces in fog: fog colour was effectively lost when folded into diffuse and filtered with albedo.

Still on the path for later work: fog attenuation and light-sampled scattering remain path signals; docs note a future volume pass for those.

Adds GPU live test the_fogs_ambient_light_is_seen_directly (no scene lights, black quad in fog: empty diffuse, emission matches fog by hit distance, framebuffer shows fog tint). ROADMAP and RUNTIME live-architecture notes updated.

Reviewed by Cursor Bugbot for commit 4df89f2. Bugbot is set up for automated code reviews on this repo. Configure here.

yujiaxu-ops and others added 15 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>
… 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>
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>
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
…shows

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The ambient light height fog scatters towards the camera joins the emission signal, as the aerial haze does. As
the surface's diffuse light it was divided by the surface's albedo and filtered with it: fog before a black
surface was lost.

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 changed the base branch from frame-mirror-hit to main November 26, 2026 08:16
@yujiaxu-ops
yujiaxu-ops merged commit b5615c6 into main Nov 26, 2026
9 checks passed
@yujiaxu-ops
yujiaxu-ops deleted the fog-ambient-direct branch November 26, 2026 10:51
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