Expand height brush table for DSL terrain

This commit is contained in:
Meta Vens 2026-05-18 03:05:24 +01:00
commit fa90f95da7
5 changed files with 72 additions and 7 deletions

View file

@ -13,6 +13,14 @@ internal record struct D3D12HeightFieldBrushConstants(
Vector4 CenterRadius5,
Vector4 CenterRadius6,
Vector4 CenterRadius7,
Vector4 CenterRadius8,
Vector4 CenterRadius9,
Vector4 CenterRadius10,
Vector4 CenterRadius11,
Vector4 CenterRadius12,
Vector4 CenterRadius13,
Vector4 CenterRadius14,
Vector4 CenterRadius15,
Vector4 Shape0,
Vector4 Shape1,
Vector4 Shape2,
@ -21,6 +29,14 @@ internal record struct D3D12HeightFieldBrushConstants(
Vector4 Shape5,
Vector4 Shape6,
Vector4 Shape7,
Vector4 Shape8,
Vector4 Shape9,
Vector4 Shape10,
Vector4 Shape11,
Vector4 Shape12,
Vector4 Shape13,
Vector4 Shape14,
Vector4 Shape15,
Vector4 Wave0,
Vector4 Wave1,
Vector4 Wave2,
@ -28,9 +44,17 @@ internal record struct D3D12HeightFieldBrushConstants(
Vector4 Wave4,
Vector4 Wave5,
Vector4 Wave6,
Vector4 Wave7)
Vector4 Wave7,
Vector4 Wave8,
Vector4 Wave9,
Vector4 Wave10,
Vector4 Wave11,
Vector4 Wave12,
Vector4 Wave13,
Vector4 Wave14,
Vector4 Wave15)
{
public const int MaxBrushCount = 8;
public const int MaxBrushCount = 16;
public static D3D12HeightFieldBrushConstants FromBrushes(IReadOnlyList<AquariumHeightFieldBrush> brushes)
{
@ -94,6 +118,46 @@ internal record struct D3D12HeightFieldBrushConstants(
Shape7 = shape;
Wave7 = wave;
break;
case 8:
CenterRadius8 = centerRadius;
Shape8 = shape;
Wave8 = wave;
break;
case 9:
CenterRadius9 = centerRadius;
Shape9 = shape;
Wave9 = wave;
break;
case 10:
CenterRadius10 = centerRadius;
Shape10 = shape;
Wave10 = wave;
break;
case 11:
CenterRadius11 = centerRadius;
Shape11 = shape;
Wave11 = wave;
break;
case 12:
CenterRadius12 = centerRadius;
Shape12 = shape;
Wave12 = wave;
break;
case 13:
CenterRadius13 = centerRadius;
Shape13 = shape;
Wave13 = wave;
break;
case 14:
CenterRadius14 = centerRadius;
Shape14 = shape;
Wave14 = wave;
break;
case 15:
CenterRadius15 = centerRadius;
Shape15 = shape;
Wave15 = wave;
break;
default:
throw new ArgumentOutOfRangeException(nameof(index), index, "Height Field brush index is outside the fixed brush table.");
}

View file

@ -22,9 +22,9 @@ cbuffer AquariumFrame : register(b0)
cbuffer HeightFieldBrushes : register(b1)
{
float4 brushCenterRadius[8];
float4 brushShape[8];
float4 brushWave[8];
float4 brushCenterRadius[16];
float4 brushShape[16];
float4 brushWave[16];
};
struct VertexOut

View file

@ -13,7 +13,7 @@ public static class ZyphosFractalTerrain
# 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 2 2 -5 3 6 2.5 0.48 2.6 0.42 4 0.85 -0.10 19 crater
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
""";

View file

@ -133,3 +133,4 @@
{"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"}
{"timestamp":"2026-05-18T06:18:00+01:00","topic":"fractal-debug-dump","lesson":"Fractal worlds now have a text debug dump that reports domain, nodes, claims, summaries, and selected cuts. Zyphos exposes this through the `zyphos-fractal` command so the rendered DSL terrain can be inspected as authored semantic rows and LOD decisions instead of inferred from pixels alone.","files":["src/Aquarium.Engine.Fractal/Debug/FractalDebugDump.cs","src/Aquarium.Zyphos/ZyphosFractalTerrain.cs","src/Aquarium.Zyphos/ZyphosRuntime.cs","tests/Aquarium.Engine.Fractal.Tests/FractalDebugDumpTests.cs"],"source":"observability pass after wiring Zyphos to the fractal DSL renderer path"}
{"timestamp":"2026-05-18T06:29:00+01:00","topic":"zyphos-height-brush-table-budget","lesson":"Zyphos' first DSL terrain grammar must currently emit no more than eight height brushes because `D3D12HeightFieldBrushConstants.MaxBrushCount` is still 8. Do not let the demo silently author more claims than the renderer draws; either keep the visible grammar within the fixed table or make the height brush table dynamic before increasing recursive density.","files":["src/Aquarium.Zyphos/ZyphosFractalTerrain.cs","tests/Aquarium.Engine.Fractal.Tests/ZyphosFractalTerrainTests.cs","src/Aquarium.Engine/Render/Features/D3D12HeightFieldBrushConstants.cs"],"source":"runtime proof pass noticed the DSL emitted 12 claims while the current height brush constant table renders only 8"}
{"timestamp":"2026-05-18T06:43:00+01:00","topic":"height-brush-table-sixteen","lesson":"The fixed D3D12 height-field brush table now carries 16 brushes, so Zyphos can render its 12-claim DSL terrain without silent truncation. This is still a bounded interim table, not the final streaming brush backend; before raising recursive density further, move height brush packets to a structured buffer or selected-cut page stream.","files":["src/Aquarium.Engine/Render/Features/D3D12HeightFieldBrushConstants.cs","src/Aquarium.Engine/Render/Shaders/D3D12HeightField.hlsl","src/Aquarium.Zyphos/ZyphosFractalTerrain.cs","tests/Aquarium.Engine.Fractal.Tests/ZyphosFractalTerrainTests.cs"],"source":"follow-up after detecting the fixed eight-brush table clipped the first Zyphos DSL terrain"}

View file

@ -10,7 +10,7 @@ public sealed class ZyphosFractalTerrainTests
var tree = ZyphosFractalTerrain.OwnershipTree;
var brushes = ZyphosFractalTerrain.HeightBrushes;
Assert.Equal(8, tree.Claims.Count);
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");