From f65547aa5b7dc41e1887653a34c5792fd623c4d4 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 9 May 2026 00:16:36 +0100 Subject: [PATCH] Expose temporal control debug views --- docs/hlsl-renderer.md | 7 ++-- docs/tsr-inspired-taa-spec.md | 3 ++ .../Input/InputState.cs | 2 + src/Aquarium.Engine.Live/AquariumRuntime.cs | 2 +- src/Aquarium.Engine/AquariumHost.cs | 8 ++++ src/Aquarium.Engine/Platform/Win32Window.cs | 8 ++++ src/Aquarium.Engine/Render/D3D11Renderer.cs | 4 +- .../Render/DirectWriteOverlay.cs | 2 +- .../Render/Shaders/Aquarium.hlsl | 39 ++++++++++++++++++- state/evidence.jsonl | 1 + state/memory.json | 3 +- state/scratch.md | 9 ++++- 12 files changed, 77 insertions(+), 11 deletions(-) diff --git a/docs/hlsl-renderer.md b/docs/hlsl-renderer.md index e33349b..8a3ea82 100644 --- a/docs/hlsl-renderer.md +++ b/docs/hlsl-renderer.md @@ -206,10 +206,11 @@ Grid retrace has been removed; with jitter disabled, Grid analytic color uses the existing current hit. Temporal debug modes are available in the running window: `F1` cycles modes and -number keys `0` through `4` select them directly. Mode `0` is final resolve, +number keys `0` through `6` select them directly. Mode `0` is final resolve, `1` is raw current scene, `2` is the reprojected history sample, `3` is history -age, and `4` is history weight. The startup mode can still be set with -`--render-debug` or `AQUARIUM_RENDER_DEBUG_MODE`. +age, `4` is history weight, `5` is current temporal control, and `6` is current +field identity. The startup mode can still be set with `--render-debug` or +`AQUARIUM_RENDER_DEBUG_MODE`. It deliberately does not pretend to solve general non-rigid field velocity, volumetric history, or history resurrection yet. diff --git a/docs/tsr-inspired-taa-spec.md b/docs/tsr-inspired-taa-spec.md index 2b06c84..c22d7f6 100644 --- a/docs/tsr-inspired-taa-spec.md +++ b/docs/tsr-inspired-taa-spec.md @@ -282,4 +282,7 @@ Current debug view controls: - `2` reprojected history color used by the resolver - `3` accepted history age - `4` history weight +- `5` current temporal control: reactive in red, Grid support/coverage in green, + reserved medium opacity in blue +- `6` current field identity palette for Grid, Self, and planets - `--render-debug` and `AQUARIUM_RENDER_DEBUG_MODE` set the startup mode diff --git a/src/Aquarium.Engine.Contracts/Input/InputState.cs b/src/Aquarium.Engine.Contracts/Input/InputState.cs index 9c21fd3..415ad09 100644 --- a/src/Aquarium.Engine.Contracts/Input/InputState.cs +++ b/src/Aquarium.Engine.Contracts/Input/InputState.cs @@ -87,5 +87,7 @@ public enum KeyCode Digit2, Digit3, Digit4, + Digit5, + Digit6, RenderDebugCycle, } diff --git a/src/Aquarium.Engine.Live/AquariumRuntime.cs b/src/Aquarium.Engine.Live/AquariumRuntime.cs index ba7f786..046553d 100644 --- a/src/Aquarium.Engine.Live/AquariumRuntime.cs +++ b/src/Aquarium.Engine.Live/AquariumRuntime.cs @@ -39,7 +39,7 @@ public sealed class AquariumRuntime : IAquariumRuntime Console.WriteLine($"Grid center: {gridFrame.Center}, radius: {gridFrame.Radius:0.00}"); Console.WriteLine($"CultCache: {stateStore.CachePath}"); Console.WriteLine($"CultNet hello: {stateStore.Hello.RuntimeKind} / {stateStore.Hello.DisplayName}"); - Console.WriteLine("Vortice D3D11 is present as the host shell; Aquarium owns the invariants. Live reload probe armed."); + Console.WriteLine("Vortice D3D11 is present as the host shell; Aquarium owns the invariants."); } public void Update(float deltaSeconds, InputState input) diff --git a/src/Aquarium.Engine/AquariumHost.cs b/src/Aquarium.Engine/AquariumHost.cs index 9fe668b..4cb890a 100644 --- a/src/Aquarium.Engine/AquariumHost.cs +++ b/src/Aquarium.Engine/AquariumHost.cs @@ -161,5 +161,13 @@ public static class AquariumHost { renderer.RenderDebugMode = 4; } + else if (input.IsKeyPressed(KeyCode.Digit5)) + { + renderer.RenderDebugMode = 5; + } + else if (input.IsKeyPressed(KeyCode.Digit6)) + { + renderer.RenderDebugMode = 6; + } } } diff --git a/src/Aquarium.Engine/Platform/Win32Window.cs b/src/Aquarium.Engine/Platform/Win32Window.cs index 9ae324b..58389c5 100644 --- a/src/Aquarium.Engine/Platform/Win32Window.cs +++ b/src/Aquarium.Engine/Platform/Win32Window.cs @@ -53,6 +53,8 @@ public sealed class Win32Window : IDisposable private const int VK_2 = 0x32; private const int VK_3 = 0x33; private const int VK_4 = 0x34; + private const int VK_5 = 0x35; + private const int VK_6 = 0x36; private const int VK_F1 = 0x70; private const int WHEEL_DELTA = 120; @@ -634,6 +636,12 @@ public sealed class Win32Window : IDisposable case VK_4: input.SetKey(KeyCode.Digit4, isDown); break; + case VK_5: + input.SetKey(KeyCode.Digit5, isDown); + break; + case VK_6: + input.SetKey(KeyCode.Digit6, isDown); + break; case VK_F1: input.SetKey(KeyCode.RenderDebugCycle, isDown); break; diff --git a/src/Aquarium.Engine/Render/D3D11Renderer.cs b/src/Aquarium.Engine/Render/D3D11Renderer.cs index a44d501..3af33bc 100644 --- a/src/Aquarium.Engine/Render/D3D11Renderer.cs +++ b/src/Aquarium.Engine/Render/D3D11Renderer.cs @@ -93,7 +93,7 @@ public sealed class D3D11Renderer : IDisposable { this.width = width; this.height = height; - RenderDebugMode = Math.Clamp(renderDebugMode, 0, 4); + RenderDebugMode = Math.Clamp(renderDebugMode, 0, 6); this.shaderPath = shaderPath ?? Path.Combine(AppContext.BaseDirectory, ShaderRelativePath); startupProgress?.Invoke("Creating D3D11 device and swapchain"); @@ -271,7 +271,7 @@ public sealed class D3D11Renderer : IDisposable public void CycleRenderDebugMode() { - RenderDebugMode = (RenderDebugMode + 1) % 5; + RenderDebugMode = (RenderDebugMode + 1) % 7; } public void Dispose() diff --git a/src/Aquarium.Engine/Render/DirectWriteOverlay.cs b/src/Aquarium.Engine/Render/DirectWriteOverlay.cs index 323929d..721c483 100644 --- a/src/Aquarium.Engine/Render/DirectWriteOverlay.cs +++ b/src/Aquarium.Engine/Render/DirectWriteOverlay.cs @@ -76,7 +76,7 @@ internal sealed class DirectWriteOverlay : IDisposable if (renderDebugMode > 0) { renderTarget.DrawText( - $"render debug {renderDebugMode} F1 cycle 0-4 select", + $"render debug {renderDebugMode} F1 cycle 0-6 select", smallFormat, new Rect(18, 56, Math.Min(width - 18, 420), 80), quietTextBrush, diff --git a/src/Aquarium.Engine/Render/Shaders/Aquarium.hlsl b/src/Aquarium.Engine/Render/Shaders/Aquarium.hlsl index 3a12871..7f53b38 100644 --- a/src/Aquarium.Engine/Render/Shaders/Aquarium.hlsl +++ b/src/Aquarium.Engine/Render/Shaders/Aquarium.hlsl @@ -1259,6 +1259,35 @@ float3 aces(float3 color) return saturate((color * (a * color + b)) / (color * (c * color + d) + e)); } +float3 debugFieldIdColor(float fieldId) +{ + if (fieldId < 0.5) + { + return float3(0.0, 0.0, 0.0); + } + + if (abs(fieldId - FIELD_ID_GRID) < 0.25) + { + return float3(0.0, 0.9, 1.0); + } + + if (abs(fieldId - FIELD_ID_SELF) < 0.25) + { + return float3(1.0, 0.92, 0.25); + } + + if (fieldId >= FIELD_ID_PLANET_BASE) + { + float phase = frac((fieldId - FIELD_ID_PLANET_BASE) * 0.37); + return 0.35 + 0.65 * float3( + 0.5 + 0.5 * sin(phase * 6.28318 + 0.0), + 0.5 + 0.5 * sin(phase * 6.28318 + 2.1), + 0.5 + 0.5 * sin(phase * 6.28318 + 4.2)); + } + + return float3(1.0, 0.0, 1.0); +} + struct SceneOut { float4 colorTravel : SV_Target0; @@ -1307,7 +1336,7 @@ SceneOut AquariumScenePS(VertexOut input) outputMaterialId = FIELD_ID_GRID; outputNormal = terrainNormal(gridHitPosition); outputCoverage = gridSupport; - outputReactive = 1.0 - smoothstep(0.06, 0.48, gridSupport); + outputReactive = 0.0; if (stochasticTransparency(screenUv, gridOverlay.a) > 0.0) { color = gridOverlay.rgb; @@ -1490,6 +1519,14 @@ ResolveOut AquariumResolvePS(VertexOut input) { finalColor = historyWeight.xxx; } + else if (renderDebugMode >= 4.5 && renderDebugMode < 5.5) + { + finalColor = float3(currentReactive, currentCoverage, currentMediumOpacity); + } + else if (renderDebugMode >= 5.5 && renderDebugMode < 6.5) + { + finalColor = debugFieldIdColor(currentFieldId); + } ResolveOut output; output.finalColor = float4(finalColor, 1.0); diff --git a/state/evidence.jsonl b/state/evidence.jsonl index fa983a7..b5f9c5f 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -35,3 +35,4 @@ {"area":"renderer/taa","lesson":"Removed the abandoned unjittered Grid retrace after projection jitter was disabled. The retrace was a temporary splint that solved the Grid surface twice; with live jitter at zero, Grid analytic final color can reconstruct from the existing current hit without adding renderer Jenga.","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":"dev-loop/reload","lesson":"Live runtime reload must be end-to-end acknowledged. dev-watch now treats live-current.txt as a request, not success: after building a live slot and updating the pointer, it waits for the running host stdout to report the exact live DLL path or marks the reload failed. Visible dev windows can use dev-watch -ReopenWhenClosed to reopen the last good slot without rebuilding after the window is closed.","files":["scripts/dev-watch.ps1","README.md","state/map.yaml","state/memory.json","state/scratch.md"],"verification":["dotnet build Aquarium.Engine.slnx",".\\scripts\\dev-watch.ps1 -NoInitialLaunch -Once -IntervalMilliseconds 10 -DebounceMilliseconds 10 -RetainSlots 4",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4"],"ts":"2026-05-08"} {"area":"dev-loop/reload","lesson":"dev-watch was not reaching its poll loop because Start-Process -Wait around dev-reload could remain attached to the long-lived launched Aquarium process after initial launch. The watcher now invokes dev-reload synchronously, leaving app process ownership inside dev-reload, and a live-only Aquarium.Engine.Live cosmetic change produced a live slot plus host acknowledgement without rebuilding the host.","files":["scripts/dev-watch.ps1","src/Aquarium.Engine.Live/AquariumRuntime.cs","state/memory.json","state/scratch.md"],"verification":["watch.log: Live reload requested, pointer updated, and acknowledged for artifacts/dev-reload/live-slots/20260509-000855-c3f6310c/Aquarium.Engine.Live.dll","latest.out.log: Live reload probe armed and Live runtime reload applied"],"ts":"2026-05-09"} +{"area":"renderer/debug","lesson":"Temporal debug modes now expose the resolver's control data directly. Modes 5 and 6 show current temporal control channels and current field identity, so Grid support, reactive strength, medium opacity, and field ownership can be inspected without inferring them from final color or history artifacts.","files":["src/Aquarium.Engine/Render/Shaders/Aquarium.hlsl","src/Aquarium.Engine/Render/D3D11Renderer.cs","src/Aquarium.Engine/Render/DirectWriteOverlay.cs","src/Aquarium.Engine/AquariumHost.cs","src/Aquarium.Engine/Platform/Win32Window.cs","src/Aquarium.Engine.Contracts/Input/InputState.cs","docs/tsr-inspired-taa-spec.md","docs/hlsl-renderer.md","state/memory.json","state/scratch.md"],"verification":["dotnet build Aquarium.Engine.slnx","Shader hot reload applied after Grid reactive channel fix","Mode 5 screenshot showed stale full-Grid reactive red; Grid reactive now zero and support remains coverage"],"ts":"2026-05-09"} diff --git a/state/memory.json b/state/memory.json index 0f9f44c..c39cd84 100644 --- a/state/memory.json +++ b/state/memory.json @@ -60,8 +60,9 @@ "Grid temporal coverage must mean current line/contour/field-line support, not broad overlay alpha. Broad low-alpha tint can render, but it must not keep history age alive across the Grid surface or stale stochastic hits billow into smoke.", "Grid TAA must not use the raw stochastic hit/miss scene color as the current radiance truth. The resolve should reconstruct analytic Grid overlay color at the current world hit and use premultiplied color as the current estimate, then use history for stability rather than reconstructing alpha from binary noise alone.", "For the current Grid renderer, final Grid color should not blend previous color history. Use analytic current Grid color for the final pixel and write it into history; keep history age/weight/debug as diagnostics until a real transparent/volumetric composition contract needs color history again.", + "Grid temporal control coverage is the line/support signal. Do not mark the whole low-support Grid surface reactive; that turns debug control mode red everywhere and reintroduces stale history-murder logic.", "Projection jitter is currently scaled to zero. If Self or planet surfaces visibly judder, the resolve is not hiding jitter and the correct live choice is no jitter until opaque and Grid paths both prove stable.", - "Temporal debug views are live keys: F1 cycles, 0 final, 1 raw current scene, 2 reprojected history, 3 history age, 4 history weight. Use these before guessing whether TAA is sampling, validating, or presenting the wrong signal.", + "Temporal debug views are live keys: F1 cycles, 0 final, 1 raw current scene, 2 reprojected history, 3 history age, 4 history weight, 5 current temporal control, 6 current field identity. Use these before guessing whether TAA is sampling, validating, or presenting the wrong signal.", "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." ], diff --git a/state/scratch.md b/state/scratch.md index 45df35e..6367c15 100644 --- a/state/scratch.md +++ b/state/scratch.md @@ -74,8 +74,9 @@ prototype integrated along the camera ray before surface composition. and color-delta rejection. A current dither miss is not evidence that the true Grid color is background. - Temporal debug keys: F1 cycles, 0 final, 1 raw current scene, 2 reprojected - history, 3 history age, 4 history weight. Use these to prove whether the - presented frame is resolved and whether history is alive. + history, 3 history age, 4 history weight, 5 current temporal control, 6 + current field identity. Use these to prove whether the presented frame is + resolved and whether history is alive. - Temporal Gate 3F: Grid stochastic coverage now uses high-retention history without coverage/reactive authority penalties. Coverage remains a continuity signal, not a reason to throw away the accumulation low-alpha lines require. @@ -92,6 +93,10 @@ prototype integrated along the camera ray before surface composition. - Temporal Gate 3J: debug mode 1 is raw scene again. Final Grid pixels use the analytic current estimate directly instead of blending previous Grid color history; history debug surfaces remain diagnostics. +- Temporal debug correction: mode 5 exposes current temporal control. The first + look showed the entire Grid red because stale Grid logic marked low support as + reactive. Grid reactive is now zero; support/coverage remains the green + signal. - Temporal Gate 3L: projection jitter is scaled to zero because Self/planet surfaces visibly juddered. Keep jitter disabled until opaque and Grid resolve both hide the offset. Removed the abandoned unjittered Grid retrace; Grid