Apply reservoir contribution weight

This commit is contained in:
Meta Vens 2026-05-29 16:06:07 +01:00
commit c1cfa026fe
4 changed files with 57 additions and 4 deletions

View file

@ -64,6 +64,9 @@ old occluded tubes leak through nearby missed tube samples.
before merge.
- Spatial reuse validates neighboring current reservoirs by field id, travel,
normal, support, and domain before merge.
- Row-3 final color uses the reservoir contribution weight. Intermediate
current-frame proposal MRTs stay raw so proposal normalization is not
double-weighted before reuse.
- TubeField writes previous history UV and expected previous travel from
rolling-buffer offset motion.
- TubeField metadata includes physical rolling-column identity, so different
@ -109,7 +112,9 @@ old occluded tubes leak through nearby missed tube samples.
packets and reject invalid proposal weights.
7. Done: expose rebuilt reservoir diagnostics as named UI labels. Modes 13-15
now mean rejection, stats, and proposal; invalid final reservoirs render as
unsupported instead of masquerading as accepted history.
unsupported instead of masquerading as accepted history. Rejection mode now
separates temporal rejection, disocclusion/no previous support, spatial
reuse, missing explicit motion, occlusion, and field-id mismatch.
8. Partial: tune occlusion/disocclusion thresholds against fresh captures after
this architecture cut.
9. Next: capture final color and row-3 debug views against the noisy/occlusion

View file

@ -106,6 +106,16 @@ float fieldReservoirContributionWeight(FieldReservoirSample sample)
: sample.stats.y / max(sample.stats.z * sample.stats.x, FieldReservoirEpsilon);
}
float3 fieldReservoirResolvedColor(FieldReservoirSample sample, float farTravel)
{
if (!fieldReservoirSampleValid(sample, farTravel))
{
return 0.0;
}
return sample.colorTravel.rgb * fieldReservoirContributionWeight(sample);
}
FieldReservoirSample scaleFieldReservoirSampleWeight(FieldReservoirSample sample, float scale)
{
float safeScale = saturate(scale);

View file

@ -457,6 +457,35 @@ float reservoirTemporalValidationWeight(
return travelWeight * fieldWeight * normalWeight * colorWeight * coverageWeight * coverageContinuityWeight * detailWeight * confidenceWeight * domainWeight;
}
float reservoirTemporalRejectionCode(
FieldReservoirSample currentSample,
FieldReservoirSample previousSample,
float expectedPreviousTravel)
{
if (!fieldReservoirSampleValid(previousSample, farDistance))
{
return 1.0;
}
float travelTolerance = max(0.045, expectedPreviousTravel * 0.018);
if (previousSample.colorTravel.w < expectedPreviousTravel - travelTolerance * 2.0)
{
return 5.0;
}
if (previousSample.colorTravel.w > expectedPreviousTravel + travelTolerance * 2.0)
{
return 2.0;
}
if (abs(previousSample.metadata.x - currentSample.metadata.x) >= 0.001)
{
return 6.0;
}
return 1.0;
}
float reservoirSpatialValidationWeight(FieldReservoirSample currentSample, FieldReservoirSample neighborSample, float pixelDistance)
{
if (!fieldReservoirSampleValid(currentSample, farDistance) ||
@ -551,7 +580,7 @@ FieldReservoirSample temporallyReuseReservoirSample(FieldReservoirSample current
neighborhoodMax);
if (validationWeight <= 0.0)
{
temporal.guide.w = 1.0;
temporal.guide.w = reservoirTemporalRejectionCode(current, previous, expectedPreviousTravel);
return temporal;
}
@ -633,10 +662,18 @@ float4 reservoirDebugOrColor(FieldReservoirSample candidate)
{
color = float3(0.2, 0.55, 1.0);
}
else
else if (invalidation < 4.5)
{
color = float3(1.0, 0.0, 0.85);
}
else if (invalidation < 5.5)
{
color = float3(0.0, 1.0, 1.0);
}
else
{
color = float3(0.9, 0.0, 1.0);
}
return float4(color, candidate.colorTravel.w);
}
@ -669,7 +706,7 @@ float4 reservoirDebugOrColor(FieldReservoirSample candidate)
candidate.colorTravel.w);
}
return candidate.colorTravel;
return float4(fieldReservoirResolvedColor(candidate, farDistance), candidate.colorTravel.w);
}
FieldReservoirResolveOut D3D12FieldReservoirResolvePS(VertexOut input)

View file

@ -285,3 +285,4 @@
{"timestamp":"2026-05-29T14:59:04.4120372+01:00","type":"decision","status":"ok","note":"Explicit-motion reservoir candidates now track represented sample count separately from history age in the motion lane. TubeField history confidence can ramp from accumulated validated evidence, and reservoir debug mode 14 exposes history age, represented count, and confidence."}
{"timestamp":"2026-05-29T15:45:00+01:00","type":"decision","status":"ok","note":"Hard-rebuilt the live field reservoir into a shared seven-lane FieldReservoirSample ABI with proposal and stats lanes. Rows now mean current, temporal, spatial, and final; TubeField proxy rasterization emits one-sample RIS proposals into row 0; scene/SDF MRT evidence normalizes into the same proposal shape; temporal reuse validates previous row-3 final reservoirs; spatial reuse validates neighboring current reservoirs; old nearest-travel-minus-coverage slot replacement is cut from TubeField injection and final resolve. Proposal policy now survives field evidence lowering/backend packets and invalid zero/NaN target/sourcePdf is rejected before backend emission. Verified with Aquarium.Engine.Tests, dotnet build Fensalir.sln, headless dev reload, and Mimir --mimir-spectrum-upload-smoke."}
{"timestamp":"2026-05-29T16:01:00+01:00","type":"verification","status":"ok","note":"Completed the reservoir diagnostics cut after the rebuild: render debug options 13-15 now name row-3 reservoir rejection, stats, and proposal views; invalid final reservoirs render as unsupported instead of accepted green/proposal mass; CPU RIS tests now pin sourcePdf, represented count, merge probability, selected target, weight sum, candidate count, and contribution weight. Verified with Aquarium.Engine.Tests, Aquarium.Engine.Fractal.Tests, dotnet build Fensalir.sln, headless dev reload, Mimir --mimir-spectrum-upload-smoke, and captures artifacts/fensalir-captures/reservoir-rebuild-fixed-mode13.png, mode14.png, and mode15.png."}
{"timestamp":"2026-05-29T16:06:00+01:00","type":"decision","status":"ok","note":"Row-3 final reservoir color now applies the RIS contribution weight via fieldReservoirResolvedColor; intermediate current-frame proposal MRTs remain raw to avoid double-weighting before temporal/spatial reuse. Reservoir rejection debug now distinguishes unsupported final rows, temporal rejection, disocclusion/no previous support, spatial reuse, missing explicit motion, occlusion, and field-id mismatch. Verified with headless dev reload and captures artifacts/fensalir-captures/reservoir-rebuild-weighted-final.png, reservoir-rebuild-weighted-proposal.png, and reservoir-rebuild-rejection-codes.png."}