Ramp temporal history confidence

This commit is contained in:
Meta Vens 2026-05-08 23:11:46 +01:00
commit b24fb3af61
6 changed files with 24 additions and 2 deletions

View file

@ -173,6 +173,8 @@ future volumetrics arrive.
Gate 3B ping-pongs that control target as history too, so the resolver can
compare previous/current coverage and reserved medium opacity at the reprojected
UV.
Gate 3C stores accepted history age in the control-history `w` channel and
ramps history authority as that age grows.
It deliberately does not pretend to solve general non-rigid field velocity,
volumetric history, or history resurrection yet.

View file

@ -168,6 +168,15 @@ Current Gate 3B implementation:
not write the channel yet
- current temporal control is written into the history set for the next frame
Current Gate 3C implementation:
- temporal-control history `w` stores accepted history age in frames
- validation grows age when reprojected history survives the travel, field,
normal, color, coverage, and medium-opacity checks
- history authority ramps with age, so newly accepted history can contribute but
does not immediately get the same weight as stable history
- age resets to zero on validation failure
This is intentionally still a surface/stochastic coverage contract. It prepares
the resolver for volumetrics without lying that a single hit depth describes a
whole participating medium.

View file

@ -50,6 +50,7 @@ static const int PRIMITIVE_COUNT = PLANET_COUNT + 1;
static const float FIELD_ID_GRID = 1.0;
static const float FIELD_ID_SELF = 2.0;
static const float FIELD_ID_PLANET_BASE = 10.0;
static const float MAX_HISTORY_AGE = 32.0;
static const float GRID_HEIGHT_TEXEL_COUNT = 128.0;
static const int FROXEL_COUNT_X = 8;
static const int FROXEL_COUNT_Y = 8;
@ -1357,6 +1358,7 @@ ResolveOut AquariumResolvePS(VertexOut input)
float currentMediumOpacity = saturate(currentControl.z);
float historyWeight = 0.0;
float historyAge = 0.0;
float3 historyColor = currentColor;
if (frameIndex > 0.5 && currentTravel <= farDistance && currentFieldId > 0.5)
{
@ -1375,6 +1377,7 @@ ResolveOut AquariumResolvePS(VertexOut input)
float3 previousNormal = previousMetadata.yzw;
float previousCoverage = saturate(previousControl.y);
float previousMediumOpacity = saturate(previousControl.z);
float previousHistoryAge = max(previousControl.w, 0.0);
float travelDelta = abs(previousTravel - currentTravel);
float travelTolerance = max(0.045, currentTravel * 0.018);
float travelWeight = 1.0 - smoothstep(travelTolerance, travelTolerance * 4.0, travelDelta);
@ -1395,9 +1398,12 @@ ResolveOut AquariumResolvePS(VertexOut input)
float coverageWeight = currentFieldId == FIELD_ID_GRID ? smoothstep(0.02, 0.55, currentCoverage) : 1.0;
float coverageContinuityWeight = 1.0 - smoothstep(0.10, 0.50, abs(previousCoverage - currentCoverage));
float mediumContinuityWeight = 1.0 - smoothstep(0.04, 0.35, abs(previousMediumOpacity - currentMediumOpacity));
float historyConfidence = smoothstep(0.0, 6.0, previousHistoryAge);
float validationWeight = travelWeight * colorWeight * fieldWeight * normalWeight * reactiveWeight * coverageWeight * coverageContinuityWeight * mediumContinuityWeight;
historyColor = clampedHistory;
historyWeight = 0.82 * travelWeight * colorWeight * fieldWeight * normalWeight * reactiveWeight * coverageWeight * coverageContinuityWeight * mediumContinuityWeight;
historyWeight = 0.82 * lerp(0.35, 1.0, historyConfidence) * validationWeight;
historyAge = validationWeight > 0.01 ? min(previousHistoryAge + 1.0, MAX_HISTORY_AGE) : 0.0;
}
}
@ -1406,7 +1412,7 @@ ResolveOut AquariumResolvePS(VertexOut input)
output.finalColor = float4(aces(resolved), 1.0);
output.historyColor = float4(resolved, currentTravel);
output.historyMetadata = currentMetadata;
output.historyControl = currentControl;
output.historyControl = float4(currentControl.xyz, historyAge);
return output;
}

View file

@ -21,3 +21,4 @@
{"area":"renderer/taa","lesson":"TAA Gate 2B replaces coarse material identity with stable field ids and adds analytic object-motion reprojection for orbiting SDF bodies. Planet hits now move from current planet center to previous planet center before history projection, so history follows rigid body motion instead of relying only on camera reprojection.","files":["docs/tsr-inspired-taa-spec.md","docs/hlsl-renderer.md","src/Aquarium.Engine/Render/Shaders/Aquarium.hlsl","state/memory.json","state/scratch.md"],"verification":["dotnet build Aquarium.Engine.slnx",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4"],"ts":"2026-05-08"}
{"area":"renderer/taa","lesson":"TAA Gate 3A adds a current-frame temporal-control target separate from field/normal metadata. It carries reactive strength, stochastic/composition coverage, a reserved medium-opacity slot, and a spare channel; the resolve now reduces history for low-coverage reactive Grid samples while keeping the volumetric contract explicit for later medium history.","files":["docs/tsr-inspired-taa-spec.md","docs/hlsl-renderer.md","src/Aquarium.Engine/Render/D3D11Renderer.cs","src/Aquarium.Engine/Render/Shaders/Aquarium.hlsl","state/map.yaml","state/memory.json","state/scratch.md"],"verification":["dotnet build Aquarium.Engine.slnx",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4"],"ts":"2026-05-08"}
{"area":"renderer/taa","lesson":"TAA Gate 3B gives temporal-control data its own history ping-pong. Resolve now samples previous control at the reprojected UV and reduces history across stochastic coverage or reserved medium-opacity discontinuities, giving future volumetrics a real continuity signal instead of a one-frame mask.","files":["docs/tsr-inspired-taa-spec.md","docs/hlsl-renderer.md","src/Aquarium.Engine/Render/D3D11Renderer.cs","src/Aquarium.Engine/Render/Shaders/Aquarium.hlsl","state/memory.json","state/scratch.md"],"verification":["dotnet build Aquarium.Engine.slnx",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4"],"ts":"2026-05-08"}
{"area":"renderer/taa","lesson":"TAA Gate 3C stores accepted history age in temporal-control history w. The resolver grows age only when validation passes, resets it on failure, and ramps history authority with age so a newly reprojected sample can contribute without immediately carrying full stable-history weight.","files":["docs/tsr-inspired-taa-spec.md","docs/hlsl-renderer.md","src/Aquarium.Engine/Render/Shaders/Aquarium.hlsl","state/memory.json","state/scratch.md"],"verification":["dotnet build Aquarium.Engine.slnx",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4"],"ts":"2026-05-08"}

View file

@ -52,6 +52,7 @@
"TAA Gate 2B uses stable field ids and analytic object-motion reprojection for orbiting planets: current planet hit positions are offset from current center to previous center before projecting into history.",
"TAA Gate 3A adds a separate current-frame temporal-control target: reactive strength, stochastic/composition coverage, reserved medium opacity, and reserved spare. The resolver reduces history for low-coverage reactive Grid samples; future volumetrics must extend this contract rather than pretending one opaque hit depth is enough.",
"TAA Gate 3B ping-pongs temporal-control history. Resolve now compares previous/current coverage and reserved medium opacity at the reprojected UV, reducing history across composition and future medium discontinuities.",
"TAA Gate 3C stores accepted history age in temporal-control history w. Validation grows age, failed validation resets it, and history authority ramps with age so fresh history can contribute without instantly gaining full trust.",
"Bruneton-style atmospheric scattering is the later sky/planet solution, not the first Grid fog pass. Use LUTs, explicit texture mappings, and unit-tested physical terms when Aquarium reaches ground-to-space atmosphere.",
"GigaVoxels-style ray-guided sparse bricks are only for large sparse field/world storage. Do not turn early fog into a monolithic persistent volume cache."
],

View file

@ -60,3 +60,6 @@ prototype integrated along the camera ray before surface composition.
- Temporal Gate 3B: temporal control now has its own ping-pong history. Resolve
samples previous control at the reprojected UV and reduces history across
coverage or reserved medium-opacity discontinuities.
- Temporal Gate 3C: temporal-control history `w` stores accepted history age.
Validation grows age, failed validation resets it, and history authority ramps
with age instead of fully trusting fresh samples immediately.