Expose Zyphos fractal resource plan

This commit is contained in:
Meta Vens 2026-05-19 13:45:03 +01:00
commit 11737febc1
4 changed files with 55 additions and 0 deletions

View file

@ -71,6 +71,7 @@ public static class ZyphosFractalTerrain
var plan = new ZyphosFractalRenderPlan(
brushes,
selectedCut,
resourcePlan,
bucketPixelsPerWorld,
$"{selectedCut.Length}/{Summaries.Value.Length} cuts / {brushes.Length}/{OwnershipTree.Claims.Count} brushes / {resourcePlan.UpdateNodes.Length}/{DefaultBudget.MaxCpuUpdates} cpu updates / {resourcePlan.GpuEstimatedCost:0.0}/{DefaultBudget.MaxGpuEstimatedCost:0.0} gpu cost / {resourcePlan.Residency.ResidentNodes.Count}/{DefaultBudget.MaxResidentPayloads} resident / {resourcePlan.Residency.RequestedNodes.Count}/{DefaultBudget.MaxSsdRequests} ssd requests / {bucketPixelsPerWorld:0.00} px-wu");
@ -85,6 +86,39 @@ public static class ZyphosFractalTerrain
public static string Summary =>
$"{Path.GetFileName(PatchPath)} / {OwnershipTree.Claims.Count} DSL claims / {OwnershipTree.Nodes.Count} tile nodes / {SelectedCut.Value.Length} cuts / {HeightBrushes.Length} shaped brushes";
public static string BuildPlanDebugDump(ZyphosFractalRenderPlan plan)
{
var budget = plan.ResourcePlan.Budget;
var lines = new List<string>
{
"Zyphos fractal resource plan",
$" pixelsPerWorld: {plan.PixelsPerWorld:0.000}",
$" selectedCut: {plan.SelectedCuts.Length}/{Summaries.Value.Length}",
$" brushes: {plan.HeightBrushes.Length}/{OwnershipTree.Claims.Count}",
$" cpuUpdates: {plan.ResourcePlan.UpdateNodes.Length}/{budget.MaxCpuUpdates}",
$" gpuEstimatedCost: {plan.ResourcePlan.GpuEstimatedCost:0.000}/{budget.MaxGpuEstimatedCost:0.000}",
$" ramResident: {plan.ResourcePlan.Residency.ResidentNodes.Count}/{budget.MaxResidentPayloads}",
$" ssdRequests: {plan.ResourcePlan.Residency.RequestedNodes.Count}/{budget.MaxSsdRequests}",
"selected:",
};
foreach (var cut in plan.SelectedCuts)
{
lines.Add($" {cut.NodeKey.Value} score={cut.Score:0.000} fade={cut.Fade:0.000} requestChildren={cut.RequestedChildren}");
}
if (plan.ResourcePlan.UpdateNodes.Length > 0)
{
lines.Add("updates:");
foreach (var key in plan.ResourcePlan.UpdateNodes)
{
lines.Add($" {key.Value}");
}
}
return string.Join(Environment.NewLine, lines);
}
private static float ScoreForState(AquariumContributionState state, float pixelsPerWorld)
{
foreach (var summary in Summaries.Value)
@ -116,5 +150,6 @@ public static class ZyphosFractalTerrain
public readonly record struct ZyphosFractalRenderPlan(
AquariumHeightFieldBrush[] HeightBrushes,
AquariumSelectedCut[] SelectedCuts,
FractalResourcePlan ResourcePlan,
float PixelsPerWorld,
string Summary);

View file

@ -110,6 +110,7 @@ public sealed class ZyphosRuntime : IAquariumRuntime
})
.Command("zyphos", _ => $"Zyphos: {ZyphosFractalTerrain.Summary}", "Report Zyphos demo status.")
.Command("zyphos-fractal", _ => ZyphosFractalTerrain.DebugDump, "Dump the compiled Zyphos fractal terrain grammar.")
.Command("zyphos-fractal-plan", _ => ZyphosFractalTerrain.BuildPlanDebugDump(ZyphosFractalTerrain.BuildRenderPlan(CurrentShot())), "Dump the current Zyphos fractal selected cut and resource budget.")
.Command("zyphos-system", _ => $"Zyphos-Umbros: separation {ZyphosUmbrosSystem.SeparationInZyphosRadii:0.0} Zyphos radii, Umbros radius {ZyphosUmbrosSystem.UmbrosRadiusRatio:0.00} Zyphos, apparent diameter {ZyphosUmbrosSystem.UmbrosAngularDiameterDegrees:0.0} degrees.", "Report the modeled Zyphos/Umbros/star baseline.");
}

View file

@ -151,3 +151,4 @@
{"timestamp":"2026-05-18T18:09:50+01:00","topic":"temporal-sdf-gaussian-renderer-boundary","lesson":"Live sensor-fusion splats now enter Aquarium through an engine-owned temporal SDF Gaussian field instead of client-side renderer folklore. The contract carries stable keyed world-space Gaussians; `TemporalGaussianAccumulator` buffers observations with presentation delay and history weights; D3D12 uploads structured packets and renders an instanced compact-kernel splat pass into the existing scene/metadata/control targets. Scaling beyond 4096 splats belongs to Aquarium residency/binning, not LocalCastBridge.","files":["src/Aquarium.Engine.Contracts/Render/AquariumRenderPlan.cs","src/Aquarium.Engine.Fractal/Temporal/TemporalGaussianAccumulator.cs","src/Aquarium.Engine/Render/Shaders/D3D12TemporalGaussian.hlsl","src/Aquarium.Engine/Render/D3D12Renderer.cs","docs/temporal-sdf-gaussian-field.md"],"source":"user directed the point-cloud/TAA renderer feature to be implemented on the Aquarium side for clean client consumption"}
{"timestamp":"2026-05-19T13:38:00+01:00","topic":"fractal-resource-budget-and-flame-dsl","lesson":"The fractal DSL now has a compact `flame` primitive for deterministic curled recursive brush emission, and Zyphos exercises it in a leaf microdetail domain without exceeding the 64-brush stress table. Fractal render planning now coordinates CPU stochastic update count, GPU selected-cut estimated cost, RAM resident payload budget, and SSD request budget before packet compilation. This budget vocabulary should remain compatible with Mimir-style sensor fusion because both pipelines accumulate confidence-weighted spatial samples into temporal reservoirs before rendering a resolved field.","files":["src/Aquarium.Engine.Fractal/Grammar/FractalDslCompiler.cs","src/Aquarium.Engine.Fractal/Lod/FractalResourceBudget.cs","src/Aquarium.Engine.Fractal/Lod/FractalResourceBudgetPlanner.cs","src/Aquarium.Engine.Fractal/Lod/FractalResidencyPlanner.cs","src/Aquarium.Zyphos/ZyphosFractalTerrain.cs","src/Aquarium.Zyphos/Worlds/zyphos-first-fractal-terrain.aquageo","tests/Aquarium.Engine.Fractal.Tests/FractalResourceBudgetPlannerTests.cs"],"source":"user demanded full fractal SDF rendering and noted Mimir sensor fusion shares the same temporal spatial evidence shape"}
{"timestamp":"2026-05-19T14:04:00+01:00","topic":"temporal-spatial-evidence-reservoir","lesson":"Temporal Gaussian accumulation now uses `TemporalSpatialEvidenceReservoir`, which owns stable-keyed spatial tracks, smoothing, delayed presentation, velocity prediction, confidence-weighted history, expiry, and max-track eviction. This pulls the common reservoir shape out from under Gaussian rendering so fractal SDF probes and Mimir sensor-fusion features can converge through the same evidence machinery before backend lowering.","files":["src/Aquarium.Engine.Fractal/Temporal/TemporalSpatialEvidenceObservation.cs","src/Aquarium.Engine.Fractal/Temporal/TemporalSpatialEvidenceReservoir.cs","src/Aquarium.Engine.Fractal/Temporal/TemporalGaussianAccumulator.cs","tests/Aquarium.Engine.Fractal.Tests/TemporalSpatialEvidenceReservoirTests.cs","docs/temporal-sdf-gaussian-field.md"],"source":"user pointed out fractal rendering and Mimir sensor fusion both accumulate surface/volume confidence into temporal reservoirs"}
{"timestamp":"2026-05-19T14:20:00+01:00","topic":"zyphos-fractal-resource-observability","lesson":"Zyphos exposes `zyphos-fractal-plan`, a command-level dump of the current fractal selected cut and resource plan. Keep this kind of budget/cut observability alongside renderer work: pixels alone are not enough to validate stochastic LOD, residency, or cache behavior.","files":["src/Aquarium.Zyphos/ZyphosFractalTerrain.cs","src/Aquarium.Zyphos/ZyphosRuntime.cs","tests/Aquarium.Engine.Fractal.Tests/ZyphosFractalTerrainTests.cs"],"source":"third implementation slice after adding resource planning; the machine needs to explain itself without screenshot divination"}

View file

@ -49,5 +49,23 @@ public sealed class ZyphosFractalTerrainTests
Assert.Equal(ZyphosFractalTerrain.SelectedCuts.Length, near.SelectedCuts.Length);
Assert.Equal(ZyphosFractalTerrain.HeightBrushes.Length, near.HeightBrushes.Length);
Assert.Contains("px-wu", near.Summary, StringComparison.Ordinal);
Assert.Contains("cpu updates", near.Summary, StringComparison.Ordinal);
Assert.Contains("gpu cost", near.Summary, StringComparison.Ordinal);
Assert.Contains("resident", near.Summary, StringComparison.Ordinal);
Assert.Empty(near.ResourcePlan.Residency.RequestedNodes);
}
[Fact]
public void ZyphosFractalPlanDebugDumpReportsResourceBudgets()
{
var shot = ZyphosCameraComposer.Compose(ZyphosSpatialDomainCatalog.CanopyLeaf, 0.1f, 0.4f, 0.1f, 0.0f);
var dump = ZyphosFractalTerrain.BuildPlanDebugDump(ZyphosFractalTerrain.BuildRenderPlan(shot));
Assert.Contains("Zyphos fractal resource plan", dump, StringComparison.Ordinal);
Assert.Contains("cpuUpdates:", dump, StringComparison.Ordinal);
Assert.Contains("gpuEstimatedCost:", dump, StringComparison.Ordinal);
Assert.Contains("ramResident:", dump, StringComparison.Ordinal);
Assert.Contains("ssdRequests:", dump, StringComparison.Ordinal);
Assert.Contains("selected:", dump, StringComparison.Ordinal);
}
}