Render Zyphos height field from fractal DSL

This commit is contained in:
Meta Vens 2026-05-18 02:59:28 +01:00
commit ad254bae30
8 changed files with 56 additions and 18 deletions

View file

@ -359,9 +359,9 @@ Goal: replace spherical terrain demo path with cube-sphere domain proof.
Tasks:
- [ ] Add Zyphos cube-sphere domain root.
- [ ] Add first tile grammar: ridges, craters, and material bands.
- [ ] Lower selected cut to shaped 2D height/material brush packets.
- [x] Add Zyphos cube-sphere domain root.
- [x] Add first tile grammar: ridges, craters, and material bands.
- [x] Lower selected cut to shaped 2D height/material brush packets.
- [ ] Feed planet shader from tile-local domain.
- [ ] Add face/tile/LOD/cache debug modes.
- [ ] Remove or quarantine old spherical noise path as baseline fixture.
@ -369,7 +369,7 @@ Tasks:
Tests:
- face seams render continuously;
- tile keys remain stable under camera movement;
- [x] tile keys remain stable under camera movement;
- debug modes show selected depth and cache state;
- headless Zyphos smoke render passes.

View file

@ -11,6 +11,7 @@
<ItemGroup>
<ProjectReference Include="..\Aquarium.Engine.Contracts\Aquarium.Engine.Contracts.csproj" />
<ProjectReference Include="..\Aquarium.Engine.Fractal\Aquarium.Engine.Fractal.csproj" />
</ItemGroup>
<ItemGroup>

View file

@ -0,0 +1,26 @@
using Aquarium.Engine.Fractal.Brushes;
using Aquarium.Engine.Fractal.Grammar;
using Aquarium.Engine.Render;
namespace Aquarium.Zyphos;
public static class ZyphosFractalTerrain
{
public const string Grammar = """
# Zyphos first Aquarium fractal terrain DSL proof.
tile PositiveZ 0 0 0 zyphos/first-fractal-terrain
height basin 0 0 30 30 0 3 1 -0.12 7 basin
ifs crater 3 2 -5 3 6 2.5 0.48 2.6 0.42 4 0.85 -0.10 19 crater
ifs ridge 2 3 6 -4 5 1.35 0.45 3.2 -0.27 3.6 0.72 0.075 31 ridge
""";
private static readonly Lazy<FractalOwnershipTree> Tree = new(() => FractalDslCompiler.Compile(Grammar));
private static readonly Lazy<AquariumHeightFieldBrush[]> Brushes = new(() => FractalHeightBrushCompiler.CompileMany(Tree.Value.Claims));
public static FractalOwnershipTree OwnershipTree => Tree.Value;
public static AquariumHeightFieldBrush[] HeightBrushes => Brushes.Value;
public static string Summary =>
$"{OwnershipTree.Claims.Count} DSL claims / {OwnershipTree.Nodes.Count} node / {HeightBrushes.Length} shaped brushes";
}

View file

@ -47,9 +47,10 @@ public sealed class ZyphosRuntime : IAquariumRuntime
panel.Slider("Orbit Distance", () => orbitDistance, value => orbitDistance = value, 9.0f, 24.0f, "0.0");
panel.Readout("Runtime", () => $"{timeSeconds:0.0}s");
panel.Readout("Camera", () => $"{orbitDistance:0.0} wu / yaw {orbitYaw:0.00}");
panel.Readout("Objects", () => "spherical terrain, atmosphere, moon");
panel.Readout("Terrain DSL", () => ZyphosFractalTerrain.Summary);
panel.Readout("Objects", () => "fractal height DSL, atmosphere, moon");
})
.Command("zyphos", _ => "Zyphos: planetary-scale client demo loaded.", "Report Zyphos demo status.");
.Command("zyphos", _ => $"Zyphos: {ZyphosFractalTerrain.Summary}", "Report Zyphos demo status.");
}
public AquariumFrame ComposeFrame(AquariumFrame frame, AquariumFrameInput input)

View file

@ -22,18 +22,7 @@ public static class ZyphosSceneBuilder
private static AquariumHeightFieldBrush[] BuildHeightFieldBrushes()
{
return
[
new AquariumHeightFieldBrush(
Vector2.Zero,
30.0f,
2.6f,
-0.18f,
0.03f,
1.9f,
0.22f,
1.1f)
];
return ZyphosFractalTerrain.HeightBrushes;
}
private static AquariumSdfObject[] BuildSdfObjects(float timeSeconds, float previousTimeSeconds)

View file

@ -130,3 +130,4 @@
{"timestamp":"2026-05-18T05:20:00+01:00","topic":"fractal-residency-simulation-first-slice","lesson":"Selected cuts now pass through a residency planner with an `IFractalPayloadStore` mock boundary. Resident nodes render directly; missing nodes render their parent summary fallback and enqueue payload requests only when the selected cut asks for children. This keeps frame traversal nonblocking and makes SSD/GPU residency a replaceable resource policy instead of hidden renderer state.","files":["src/Aquarium.Engine.Fractal/Lod/IFractalPayloadStore.cs","src/Aquarium.Engine.Fractal/Lod/FractalResidencyPlanner.cs","tests/Aquarium.Engine.Fractal.Tests/FractalResidencyPlannerTests.cs","research/rendering/fractal-brush-implementation-roadmap.md"],"source":"tenth fractal implementation slice simulated missing/resident payload behavior before real streaming"}
{"timestamp":"2026-05-18T05:31:00+01:00","topic":"fractal-pipeline-fixture","lesson":"The first fractal architecture spine now composes end to end in a test fixture: cube tile stable key -> semantic domain/claim -> ownership tree -> conservative summary -> selected cut -> residency fallback/request -> shaped height brush compiler. Keep extending this fixture as the interview-grade proof that module boundaries are real and not prose taped to unrelated helpers.","files":["tests/Aquarium.Engine.Fractal.Tests/FractalPipelineFixtureTests.cs"],"source":"eleventh fractal implementation slice added an end-to-end composition test for the new module network"}
{"timestamp":"2026-05-18T05:49:00+01:00","topic":"fractal-dsl-first-slice","lesson":"Aquarium now has a first line-oriented fractal DSL that compiles into semantic ownership trees instead of renderer packets. The DSL declares a cube tile domain, direct shaped `height` claims, and recursive `ifs` emitters with deterministic seeded branching. Keep this syntax small until Zyphos proves it visually; the language authority is semantic claims, not shader-side brush bags.","files":["src/Aquarium.Engine.Fractal/Grammar/FractalDslCompiler.cs","tests/Aquarium.Engine.Fractal.Tests/FractalDslCompilerTests.cs","research/rendering/fractal-brush-implementation-roadmap.md"],"source":"user explicitly wanted to express a fractal world in Aquarium's own DSL and see it rendered"}
{"timestamp":"2026-05-18T06:04:00+01:00","topic":"zyphos-fractal-dsl-render-proof","lesson":"Zyphos now renders its height field from Aquarium's fractal DSL instead of a hand-authored circular brush. `ZyphosFractalTerrain` owns the demo grammar, compiles it through `FractalDslCompiler` into a semantic ownership tree, and lowers claims to shaped height brushes through `FractalHeightBrushCompiler`. This is the first visible proof path for authoring a fractal world in Aquarium's own DSL and seeing it inside the engine.","files":["src/Aquarium.Zyphos/ZyphosFractalTerrain.cs","src/Aquarium.Zyphos/ZyphosSceneBuilder.cs","src/Aquarium.Zyphos/ZyphosRuntime.cs","tests/Aquarium.Engine.Fractal.Tests/ZyphosFractalTerrainTests.cs"],"source":"user emphasized wanting to express a fractal world in the DSL and see it rendered in engine"}

View file

@ -21,6 +21,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Aquarium.Engine.Fractal\Aquarium.Engine.Fractal.csproj" />
<ProjectReference Include="..\..\src\Aquarium.Engine.Contracts\Aquarium.Engine.Contracts.csproj" />
<ProjectReference Include="..\..\src\Aquarium.Zyphos\Aquarium.Zyphos.csproj" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,19 @@
using Aquarium.Zyphos;
namespace Aquarium.Engine.Fractal.Tests;
public sealed class ZyphosFractalTerrainTests
{
[Fact]
public void ZyphosTerrainCompilesDslIntoRenderableBrushes()
{
var tree = ZyphosFractalTerrain.OwnershipTree;
var brushes = ZyphosFractalTerrain.HeightBrushes;
Assert.Equal(12, tree.Claims.Count);
Assert.Equal(tree.Claims.Count, brushes.Length);
Assert.Contains(tree.Claims, claim => claim.Tags == "crater");
Assert.Contains(tree.Claims, claim => claim.Tags == "ridge");
Assert.Contains(brushes, brush => brush.EnvelopeFalloff > 0.0f && brush.RadiusY > 0.0f);
}
}