Cut spectrum reservoir splat path
This commit is contained in:
parent
b2e0392931
commit
060a6d0855
5 changed files with 18 additions and 159 deletions
|
|
@ -1,13 +0,0 @@
|
|||
# Fensalir field DSL: bind rolling spectrum texture, derive spline-field intent,
|
||||
# shade by surface graph, and let the engine choose the backend plus LOD.
|
||||
texture id=spectrumHistory
|
||||
|
||||
surface id=amplitude op=texture.sample value=0,0,0,0
|
||||
surface id=derivative op=dFdx inputs=amplitude value=0,0,0,0
|
||||
surface id=curvature op=d2Fdx2 inputs=amplitude value=0,0,0,0
|
||||
surface id=emission op=mix inputs=amplitude,derivative,curvature value=1.0,0.72,0.22,1.0
|
||||
surface id=coverage op=sdf.tube inputs=amplitude,derivative,curvature value=0.74,0.20,0.0,0.0
|
||||
|
||||
splinefield id=asioSpectrumWaterfall texture=spectrumHistory frequencyAxis=x firstColumn=0 columns=$ROW_COUNT columnStride=1 rollingModulo=$ROW_COUNT subdivisions=6 density=1.0 minimumContribution=0.004 origin=-6.0,0.0,0.0 axisStep=$BAND_STEP,0.0,0.0 columnStep=0.0,0.0,0.18 columnGroupSize=$HISTORY_COUNT columnGroupStep=0.0,1.75,0.0 amplitudeScale=1.1 radius=0.028 alpha=0.92 zeroThreshold=0.68 feather=0.10 tangent=1.0 curvature=0.68 normal=0.34 derivative=0.88 emission=1.0,0.72,0.22,3.2 seed=2971668797
|
||||
|
||||
lowering mode=ReservoirSplats maxSplines=384 maxControlPoints=32768 maxSplats=131072 lodBias=1.0
|
||||
|
|
@ -106,12 +106,10 @@ a named invariant that the native runtime cannot protect yet.
|
|||
service and can emit live sync telemetry with
|
||||
`MIMIR_SYNC_TELEMETRY_SECONDS`. UI and telemetry read cached reports/states;
|
||||
they do not run synchronization analysis.
|
||||
- `MimirRuntime` publishes live ASIO spectrum history to Fensalir in two layers:
|
||||
`AquariumBufferFieldFrame` carries the real buffer-field intent for spectrum
|
||||
windows as spline-domain tube fields with tangent/curvature/normal/derivative
|
||||
appearance and probe policy, while `AquariumSplineFrame` is the temporary
|
||||
Catmull-Rom tube preview so the buffer contents remain visible before GPU
|
||||
reservoir lowering owns the draw.
|
||||
- `MimirRuntime` publishes live ASIO spectrum history to Fensalir as direct
|
||||
`AquariumSplineFrame` tube trails. The spectrum dashboard is a debug/runtime
|
||||
surface, not a reservoir-splat field; no `AquariumBufferFieldFrame` is
|
||||
submitted for it.
|
||||
- `MimirRuntime` queues bioacoustic timeline PCM through Fensalir audio when the
|
||||
active timing witness is allowed. `MimirAudioSynchronizationSettings.Mode`
|
||||
selects `chirp-only`, `passive`, or `hybrid`; passive disables active
|
||||
|
|
@ -244,11 +242,9 @@ a named invariant that the native runtime cannot protect yet.
|
|||
with probe durations long enough to keep loopback and mic windows live.
|
||||
6. Bind Fensalir UI to the synchronization hub so buffer depth, stream cadence,
|
||||
source timestamps, and output settings are visible and adjustable.
|
||||
7. Lower `AquariumBufferFieldFrame` spline tube fields into Fensalir compute:
|
||||
sample buffer-domain paths stochastically by visual contribution, emit SDF
|
||||
splat probes, write them into the spatiotemporal splat reservoir, and sample
|
||||
that reservoir in the temporally antialiased scene pass. The direct spline
|
||||
preview must stay a witness until this path owns rendering.
|
||||
7. Keep the spectrum dashboard on direct spline-tube rendering. Future buffer
|
||||
fields may exist for other volumetric surfaces, but this debug surface must
|
||||
not submit reservoir splats.
|
||||
8. Move GPU feature extraction, fusion, material fitting, render budgeting, and
|
||||
Spout2 publication into Fensalir.
|
||||
9. Move mic alignment, room suppression, voice separation, spatialization, and
|
||||
|
|
|
|||
|
|
@ -309,23 +309,15 @@ Visual fusion belongs in Fensalir over current reservoir claims. Native capture
|
|||
workers provide frames; Fensalir owns feature extraction, matching, material
|
||||
fitting, render budgeting, and publication.
|
||||
|
||||
The live debug spectrum view now has two separate authorities:
|
||||
The live debug spectrum view is direct spline-tube rendering. Mimir submits an
|
||||
`AquariumSplineFrame` only: each rolling audio spectrum window becomes a
|
||||
Catmull-Rom tube trail with frequency on X, amplitude on Y, history on Z, and
|
||||
channels stacked along Y. Fensalir owns the shader-side tube SDF coverage for
|
||||
those splines.
|
||||
|
||||
- `AquariumBufferFieldFrame` is the real Fensalir contract. Mimir expresses
|
||||
each rolling audio spectrum window as a buffer-backed spline tube field:
|
||||
frequency lives in the spline domain, amplitude shapes the tube path, and
|
||||
appearance/probe policy can reference tangent, curvature, normal, derivative,
|
||||
object domain, and parent-space transforms. This is the surface the future
|
||||
compute lowering consumes.
|
||||
- `AquariumSplineFrame` is only the immediate preview witness. It renders the
|
||||
same spectrum windows as camera-facing Catmull-Rom tube ribbons so humans can
|
||||
sanity-check ASIO loopback and mic buffers before the reservoir path owns the
|
||||
draw. It must not become the final visual authority.
|
||||
|
||||
The intended Fensalir lowering is buffer field expression -> compute-generated
|
||||
stochastic SDF splat probes -> spatiotemporal splat reservoir -> reservoir
|
||||
sampling for temporally antialiased surface contribution. Splat density is a
|
||||
function of visual contribution, not uniform polyline tessellation.
|
||||
`AquariumBufferFieldFrame`/reservoir splats are not part of this spectrum
|
||||
dashboard. That previous path made the debug surface look like point/probe
|
||||
dust and split visual authority between reservoir dots and direct tubes.
|
||||
|
||||
## Known Risks
|
||||
|
||||
|
|
|
|||
|
|
@ -31,18 +31,6 @@ public sealed class MimirRuntime : IAquariumRuntime
|
|||
private const float SpectrumCameraFitPadding = 1.12f;
|
||||
private const float SpectrumFrustumMinimumNear = 0.01f;
|
||||
private const float SpectrumSplineTubePadding = 0.18f;
|
||||
private const string SpectrumFieldScriptPath = "config/mimir-spectrum-field.aquafield";
|
||||
private const string DefaultSpectrumFieldScript = """
|
||||
# Fensalir field DSL fallback for deployed Mimir layouts.
|
||||
texture id=spectrumHistory
|
||||
surface id=amplitude op=texture.sample value=0,0,0,0
|
||||
surface id=derivative op=dFdx inputs=amplitude value=0,0,0,0
|
||||
surface id=curvature op=d2Fdx2 inputs=amplitude value=0,0,0,0
|
||||
surface id=emission op=mix inputs=amplitude,derivative,curvature value=1.0,0.72,0.22,1.0
|
||||
surface id=coverage op=sdf.tube inputs=amplitude,derivative,curvature value=0.74,0.20,0.0,0.0
|
||||
splinefield id=asioSpectrumWaterfall texture=spectrumHistory frequencyAxis=x firstColumn=0 columns=$ROW_COUNT columnStride=1 rollingModulo=$ROW_COUNT subdivisions=6 density=1.0 minimumContribution=0.004 origin=-6.0,0.0,0.0 axisStep=$BAND_STEP,0.0,0.0 columnStep=0.0,0.0,0.18 columnGroupSize=$HISTORY_COUNT columnGroupStep=0.0,1.75,0.0 amplitudeScale=1.1 radius=0.028 alpha=0.92 zeroThreshold=0.68 feather=0.10 tangent=1.0 curvature=0.68 normal=0.34 derivative=0.88 emission=1.0,0.72,0.22,3.2 seed=2971668797
|
||||
lowering mode=ReservoirSplats maxSplines=384 maxControlPoints=32768 maxSplats=131072 lodBias=1.0
|
||||
""";
|
||||
private readonly MimirSynchronizationHub synchronization;
|
||||
private readonly MimirAudioSpectrumAnalyzer spectrumAnalyzer;
|
||||
private readonly IReadOnlyList<MimirStreamSourceFactory> sourceFactories;
|
||||
|
|
@ -146,7 +134,6 @@ lowering mode=ReservoirSplats maxSplines=384 maxControlPoints=32768 maxSplats=13
|
|||
private AquariumFrame CreateFrame()
|
||||
{
|
||||
var channelCount = Math.Max(1, lastAudioSpectra.Count);
|
||||
var bufferFieldFrame = BuildSpectrumBufferFieldFrame();
|
||||
var windowCount = Math.Max(1, spectrumHistory.Count);
|
||||
var (splineMin, splineMax) = SpectrumSplineAabb(channelCount, windowCount);
|
||||
var cameraTarget = (splineMin + splineMax) * 0.5f;
|
||||
|
|
@ -171,8 +158,8 @@ lowering mode=ReservoirSplats maxSplines=384 maxControlPoints=32768 maxSplats=13
|
|||
{
|
||||
TraceHeightFieldSurface = false,
|
||||
UseStarfieldBackground = false,
|
||||
BufferFieldFrame = bufferFieldFrame,
|
||||
SplineFrame = ShouldRenderSpectrumPreviewSplines() ? BuildSpectrumSplineFrame() : AquariumSplineFrame.Empty,
|
||||
BufferFieldFrame = AquariumBufferFieldFrame.Empty,
|
||||
SplineFrame = BuildSpectrumSplineFrame(),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -893,110 +880,6 @@ lowering mode=ReservoirSplats maxSplines=384 maxControlPoints=32768 maxSplats=13
|
|||
return new AquariumSplineFrame { Splines = splines };
|
||||
}
|
||||
|
||||
private AquariumBufferFieldFrame BuildSpectrumBufferFieldFrame()
|
||||
{
|
||||
if (!sceneReady || spectrumHistory.Count == 0)
|
||||
{
|
||||
return AquariumBufferFieldFrame.Empty;
|
||||
}
|
||||
|
||||
var windows = spectrumHistory.ToArray();
|
||||
var latest = windows[^1];
|
||||
var sourceIds = latest
|
||||
.Select(spectrum => spectrum.SourceId)
|
||||
.OrderBy(sourceId => sourceId, StringComparer.Ordinal)
|
||||
.ToArray();
|
||||
if (sourceIds.Length == 0)
|
||||
{
|
||||
return AquariumBufferFieldFrame.Empty;
|
||||
}
|
||||
|
||||
var bandCount = latest.FirstOrDefault(spectrum => spectrum.BandDecibels.Count > 0)?.BandDecibels.Count ?? 0;
|
||||
if (bandCount <= 1)
|
||||
{
|
||||
return AquariumBufferFieldFrame.Empty;
|
||||
}
|
||||
|
||||
var rowCount = SpectrumHistoryWindowCount * sourceIds.Length;
|
||||
var samples = new float[bandCount * rowCount];
|
||||
for (var windowIndex = 0; windowIndex < windows.Length; windowIndex++)
|
||||
{
|
||||
var ageFromNewest = windows.Length - 1 - windowIndex;
|
||||
var spectraBySource = windows[windowIndex].ToDictionary(spectrum => spectrum.SourceId, StringComparer.Ordinal);
|
||||
for (var channelIndex = 0; channelIndex < sourceIds.Length; channelIndex++)
|
||||
{
|
||||
if (!spectraBySource.TryGetValue(sourceIds[channelIndex], out var spectrum) || spectrum.BandDecibels.Count != bandCount)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var row = channelIndex * SpectrumHistoryWindowCount + ageFromNewest;
|
||||
WriteSpectrumRow(samples, row * bandCount, spectrum);
|
||||
}
|
||||
}
|
||||
|
||||
var texture = new AquariumTextureFieldBinding(
|
||||
"spectrumHistory",
|
||||
bandCount,
|
||||
rowCount,
|
||||
1,
|
||||
RollingOffset: 0,
|
||||
AquariumRollingModuloMode.Rows,
|
||||
samples);
|
||||
return AquariumFieldScriptCompiler.Compile(
|
||||
LoadSpectrumFieldScript(rowCount, bandCount),
|
||||
new Dictionary<string, AquariumTextureFieldBinding>(StringComparer.Ordinal)
|
||||
{
|
||||
[texture.Id] = texture,
|
||||
},
|
||||
reservoirRadius: 10.0f);
|
||||
}
|
||||
|
||||
private static void WriteSpectrumRow(float[] samples, int offset, MimirAudioSpectrumSnapshot spectrum)
|
||||
{
|
||||
var bands = spectrum.BandDecibels;
|
||||
var floor = Math.Min(spectrum.NoiseFloorDb, bands.Min());
|
||||
var ceiling = Math.Max(-24.0, bands.Max());
|
||||
var span = Math.Max(18.0, ceiling - floor);
|
||||
for (var index = 0; index < bands.Count; index++)
|
||||
{
|
||||
samples[offset + index] = (float)Math.Clamp((bands[index] - floor) / span, 0.0, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
private static bool ShouldRenderSpectrumPreviewSplines() =>
|
||||
string.Equals(Environment.GetEnvironmentVariable("MIMIR_SPECTRUM_PREVIEW_SPLINES"), "1", StringComparison.Ordinal);
|
||||
|
||||
private static string LoadSpectrumFieldScript(int rowCount, int bandCount)
|
||||
{
|
||||
var bandStep = SpectrumWidth / Math.Max(1, bandCount - 1);
|
||||
string Expand(string script) => script
|
||||
.Replace("$ROW_COUNT", rowCount.ToString(System.Globalization.CultureInfo.InvariantCulture), StringComparison.Ordinal)
|
||||
.Replace("$HISTORY_COUNT", SpectrumHistoryWindowCount.ToString(System.Globalization.CultureInfo.InvariantCulture), StringComparison.Ordinal)
|
||||
.Replace("$BAND_STEP", bandStep.ToString("0.#######", System.Globalization.CultureInfo.InvariantCulture), StringComparison.Ordinal);
|
||||
|
||||
foreach (var basePath in AncestorDirectories(Environment.CurrentDirectory).Concat(AncestorDirectories(AppContext.BaseDirectory)))
|
||||
{
|
||||
var candidate = Path.Combine(basePath, SpectrumFieldScriptPath);
|
||||
if (File.Exists(candidate))
|
||||
{
|
||||
return Expand(File.ReadAllText(candidate));
|
||||
}
|
||||
}
|
||||
|
||||
return Expand(DefaultSpectrumFieldScript);
|
||||
}
|
||||
|
||||
private static IEnumerable<string> AncestorDirectories(string path)
|
||||
{
|
||||
var current = new DirectoryInfo(path);
|
||||
while (current is not null)
|
||||
{
|
||||
yield return current.FullName;
|
||||
current = current.Parent;
|
||||
}
|
||||
}
|
||||
|
||||
private static IReadOnlyList<AquariumSplineVertex> BuildSpectrumWindowSpline(
|
||||
MimirAudioSpectrumSnapshot spectrum,
|
||||
float channelBaseY,
|
||||
|
|
|
|||
|
|
@ -125,3 +125,4 @@
|
|||
{"ts": "2026-05-25T20:32:20+01:00", "type": "decision", "status": "ok", "note": "Spectrum spline camera fit now uses a CultMath/HLSL-shaped projection invariant: camera targets the spline-history AABB center, distance/angle are polar YZ controls, frustum near/far and symmetric FOV planes are fitted from AABB corner slopes, and telemetry reports CPU-projected clip bounds. Fensalir frame constants required explicit C# padding before float4 fields to match HLSL cbuffer packing; without it shaders read shifted frustum values."}
|
||||
{"ts": "2026-05-25T22:44:59+01:00", "type": "implementation", "status": "ok", "note": "Eve dashboard path now uses Fensalir shared D3D12 program texture -> Mimir.EveRelay H.264 Annex-B WebSocket -> EveCanvas native AVSampleBufferDisplayLayer. Local Windows firewall blocked direct inbound TCP 8792, so launch script opens an SSH reverse tunnel and EveCanvas tries localhost before LAN. Live health reported h264-annexb 1264x681 with one connected client."}
|
||||
{"ts": "2026-05-25T23:02:30+01:00", "type": "implementation", "status": "ok", "note": "Mimir local spectrum dashboard now forces Fensalir texture-spline field lowering to ReservoirSplats instead of auto direct tubes. Auto mode chose direct tubes for 160 columns, so the screen was not the final sampled reservoir. Spectrum rows now map age-from-newest explicitly: newest/front at z=0, older windows recede +Z. Live run shows 131,072 visible reservoir splats and four 192 kHz ASIO lanes."}
|
||||
{"status":"ok","note":"Spectrum dashboard authority cut: Mimir no longer submits AquariumBufferFieldFrame/reservoir splats for the live audio spectrum view. The surface is direct AquariumSplineFrame tube trails only; config/mimir-spectrum-field.aquafield was deleted so the old ReservoirSplats path cannot reappear through configuration.","type":"correction","ts":"2026-05-26T10:08:18+01:00"}
|
||||
|
|
|
|||
Loading…
Reference in a new issue