diff --git a/README.md b/README.md index d76f02d..f0ba880 100644 --- a/README.md +++ b/README.md @@ -4,32 +4,61 @@ Aquarium Engine icon

-C# engine core for Aquarium: a native, owned renderer and interaction runtime -for a living Epiphany client. +C# native runtime for Aquarium clients: windowing, D3D12 rendering, input, +reload, persistent state, debug UI, and packageable engine machinery. + +Epiphany is the first serious client in this repo. It is not the engine's +identity. ## Intent -- C# host with renderer architecture kept legible in Rider. -- Vortice/D3D12 renderer spine with the native boundary kept explicit. +- Native C# host with a legible renderer spine and explicit ownership. +- Vortice/D3D12 backend with graphics API details contained inside the engine. +- `Aquarium.Engine.Contracts` as the client-facing boundary. +- `Aquarium.Epiphany` as the current Epiphany Aquarium client. +- `Aquarium.Sample.Minimal` as a small non-Epiphany boundary proof. - DirectWrite/Direct2D overlay text after the scene pass for crisp debug and UI typography. -- Grid-centered camera and world-space interaction invariants as first-class - engine contracts. -- Diegetic UI surfaces driven by Aquarium objects instead of admin chrome. -- CultNet for Epiphany communication. -- CultCache for settings, persistent client state, and reload recovery. +- Diegetic scene/UI surfaces driven by client objects instead of admin chrome. +- CultCache for typed settings, persistent client state, and reload recovery. +- CultNet-ready runtime identity for clients that need Epiphany communication. - Procedural audio and visual state treated as coupled signals. ## Current Shape -The engine opens a Win32 window, owns a D3D12 swapchain, renders the visible -Aquarium world in HLSL, and draws crisp overlay text through DirectWrite. The -camera target is the Grid center. Grid radius follows zoom distance. Body anchors -remain world-space. +The engine opens a Win32 window, owns a D3D12 swapchain, compiles and hot-reloads +HLSL, allocates render targets, preserves last-good shader/runtime state across +failed reloads, hosts the debug overlay, and presents scene-linear HDR through +the current post stack. -The Epiphany client is split behind `Aquarium.Engine.Contracts`, so client code -can reload while the engine host, window, renderer, and D3D device stay alive. -Runtime state is banked through CultCache MessagePack documents instead of loose JSON. +Client code is loaded behind `Aquarium.Engine.Contracts`, so a client can reload +while the engine host, window, renderer, and D3D device stay alive. Runtime state +is banked through CultCache MessagePack documents instead of loose JSON. + +`Aquarium.Epiphany` currently supplies the Grid-centered camera policy, Epiphany +agent SDF shaders, body placement, CultCache documents, and future CultNet +interpretation. Those are client semantics. The engine consumes them as generic +rendering and runtime data. + +## Repository Shape + +This repository intentionally contains both the reusable Aquarium engine and the +Epiphany client while the client API is still being carved into its final shape: + +- `src/Aquarium.Engine.Contracts`: Vortice-free client API and shared data + contracts. +- `src/Aquarium.Engine`: Win32 host, D3D12 backend, reload transport, debug UI, + audio host, and engine-owned assets. +- `src/Aquarium.Epiphany`: Epiphany Aquarium runtime, state interpretation, + render-plan configuration, and agent shaders. +- `src/Aquarium.Sample.Minimal`: tiny non-Epiphany client that proves the host + can run something other than Epiphany. + +Splitting Aquarium and Epiphany into separate repos is plausible, but not owed +yet. The cut becomes clean when the contracts are stable enough that Epiphany can +move out without taking renderer policy, shader include plumbing, or reload +folklore with it. Until then, the repo split would mostly create paperwork and a +new place for confusion to hide. ## Run @@ -53,8 +82,8 @@ dotnet build Aquarium.Engine.sln dotnet run --project src\Aquarium.Engine\Aquarium.Engine.csproj -- --client-assembly src\Aquarium.Epiphany\bin\Debug\net10.0\Aquarium.Epiphany.dll ``` -Open `Aquarium.Engine.sln` in Rider or build it from the CLI. It is the -single solution inventory for the repo. +Open or build `Aquarium.Engine.sln`. It is the single solution inventory for the +repo. `src\Aquarium.Sample.Minimal` is a tiny non-Epiphany client used to keep the engine boundary honest. It references only `Aquarium.Engine.Contracts`, declares @@ -105,12 +134,11 @@ run the watcher with: .\scripts\dev-watch.ps1 -ReopenWhenClosed ``` -Shader edits do not restart the process. The dev reload runner passes the -shader source directory into the live app, and the renderer polls -`D3D12Grid.hlsl`, `D3D12Scene.hlsl`, and `D3D12Post.hlsl`, compiles changed -shaders in the running process, then swaps the D3D shader objects only after -compilation succeeds. A bad shader edit leaves the previous working shaders -bound and writes the compiler failure to stderr. +Shader edits do not restart the process. The dev watcher fingerprints +`.hlsl`/`.hlsli` files under both the engine and Epiphany shader roots, copies +them into the running apphost slot, and lets the renderer rebuild the active +D3D12 pipelines from its current shader source root. A bad shader edit leaves +the previous working shaders bound and writes the compiler failure to stderr. Epiphany client/runtime code is split into `Aquarium.Epiphany` behind `Aquarium.Engine.Contracts`. The host loads that client DLL through a collectible diff --git a/docs/d3d12-best-practices-audit.md b/docs/d3d12-best-practices-audit.md index 59be3e0..6df6595 100644 --- a/docs/d3d12-best-practices-audit.md +++ b/docs/d3d12-best-practices-audit.md @@ -24,9 +24,10 @@ targets, async shader pipeline builds, and a narrow DirectWrite overlay bridge. arenas. Transient arenas reset only after the owning frame fence clears. - D3D12 resources are registered by name, and capacity diagnostics report upload, transient descriptor, static descriptor, and RTV usage. -- The Grid height target is a proper brush pass into scalar `R16_Float`. -- The Grid event lane is direct-traced and temporally inspectable; it is not - alpha-blended over the final frame or allowed to own canonical scene depth. +- The height-field target is a proper brush pass into scalar `R16_Float`. +- Transparent event lanes are not preserved as dormant scaffolding. When Grid + linework, particles, glyph motes, or other coverage events return, they need a + live producer/consumer contract instead of alpha-blended final-frame hacks. - HDR bloom is pre-tonemap, multi-level, and separable. - The D3D11On12 bridge is overlay-only, keeping native hinted text without mixing overlay UI into scene rendering. diff --git a/docs/d3d12-migration.md b/docs/d3d12-migration.md index 39aa89e..5921bc8 100644 --- a/docs/d3d12-migration.md +++ b/docs/d3d12-migration.md @@ -9,14 +9,14 @@ DirectWrite/Direct2D overlay text. - D3D12 owns the device, command queue, flip-discard swapchain, RTV heap, per-backbuffer command allocators, command list, fence-backed present loop, static and transient shader-visible descriptor arenas, upload buffers, - renderer-owned Grid height, HDR scene, bloom, temporal diagnostic targets, + renderer-owned height-field, HDR scene, bloom, temporal diagnostic targets, named objects, command-list events, and explicit tracked transitions. -- The Grid height pass uploads Aquarium frame constants plus a fixed body brush - table, renders a base Grid field, then draws one additive up-facing gravity - quad per body into a 128x128 scalar `R16_Float` target. -- The scene pass traces Self, planets, the cursor locator, and a separate Grid - event lane. Grid line transparency is direct-traced against the height sheet - before the nearest solid and emitted as premultiplied event radiance. +- The height-field pass uploads Aquarium frame constants plus client-authored + brush data, renders a base field, then draws additive brush quads into a + 128x128 scalar `R16_Float` target. +- The fullscreen scene pass traces the background and height-field surface. + Epiphany bodies render afterward through client-declared SDF proxy pipelines + that share engine-owned proxy mechanics and write into the same scene targets. - Presentation is scene-linear until the post pass. The scene renders to `R16G16B16A16_Float`, a three-level bloom pyramid performs firefly-safe downsample plus separable blur, and final presentation applies exposure, @@ -30,10 +30,10 @@ DirectWrite/Direct2D overlay text. draws debug UI, releases it to Present, and never participates in world rendering. - Shader and PSO creation runs off the main thread. Startup holds the splash - until the first pipeline set is ready. Runtime shader edits to - `D3D12Grid.hlsl`, `D3D12Scene.hlsl`, or `D3D12Post.hlsl` trigger a background - rebuild; successful builds swap in after a GPU wait and failures keep the - previous pipeline set. + until the first pipeline set is ready. Runtime shader edits under the engine + or Epiphany shader roots are copied into the running apphost slot and trigger a + background rebuild; successful builds swap in after a GPU wait and failures + keep the previous pipeline set. - Resize waits for the GPU, releases swapchain-dependent resources, rebuilds descriptor arenas, and recreates backbuffer views plus dependent render targets. diff --git a/docs/engine-client-boundary.md b/docs/engine-client-boundary.md index fc6d130..e255164 100644 --- a/docs/engine-client-boundary.md +++ b/docs/engine-client-boundary.md @@ -7,11 +7,19 @@ state, swapchain presentation, resource lifetime, shader compilation, reload transport, input translation, render target allocation, and future render graph execution. +`Aquarium.Engine.Contracts` owns the Vortice-free public boundary clients use to +describe runtime state, render intent, UI, audio patches, and persistent +settings. Contracts may name reusable engine concepts. They may not smuggle +Epiphany policy into the host under a nicer namespace. + `Aquarium.Epiphany` owns the client meaning: CultCache runtime state, CultNet interpretation, camera intent, cursor semantics, agent visual state, diegetic layout rules, and the render graph configuration that turns Epiphany state into world pixels. +`Aquarium.Sample.Minimal` exists to keep the split honest. If a feature cannot +be explained without Epiphany, it is not engine API yet. + ## Hard Rules - Engine code may expose rendering abstractions. It may not know Epiphany roles, @@ -50,3 +58,24 @@ Do not build this by piling adapters around the current monolith. First expose the smallest real engine abstraction that lets `Aquarium.Epiphany` describe one pass without D3D12 details. Then move one client-owned concept through it. Then repeat. + +## Repository Split Line + +Aquarium should eventually be usable without carrying the Epiphany client in the +same repository. That does not mean the repo should be split before the boundary +is mechanically clean. + +Keep both in this repo while the public contracts, graph declarations, shader +include layout, reload transport, and sample-client path are still changing +together. Split Epiphany out only when: + +- `Aquarium.Engine` and `Aquarium.Engine.Contracts` contain no Epiphany role, + CultNet-surface, Grid-policy, or agent-layout semantics. +- A non-Epiphany client can declare cameras, targets, shaders, UI, and + presentation without referencing `Aquarium.Epiphany`. +- Epiphany shaders, state documents, and visual grammar live entirely on the + client side of the contracts. +- The host can load an external client assembly without repo-local path lore. + +Until those are true, a repo split would not simplify ownership. It would just +make the same leak harder to see. diff --git a/docs/epiphany-extraction-render-api-plan.md b/docs/epiphany-extraction-render-api-plan.md index 41f87a6..208c460 100644 --- a/docs/epiphany-extraction-render-api-plan.md +++ b/docs/epiphany-extraction-render-api-plan.md @@ -398,7 +398,7 @@ app.Features.ImageBasedLighting("studio") ```csharp app.Features.SdfBodies("agents") .Buffer("AgentVisuals", maxCount: 64) - .SharedInclude("Shaders/D3D12BodyProxy.hlsli") + .SharedInclude("Shaders/D3D12SdfProxy.hlsli") .Role("Self", "Shaders/SelfBody.hlsl") .Role("Imagination", "Shaders/ImaginationBody.hlsl") .DepthAgainst(scene.Depth) diff --git a/docs/hlsl-renderer.md b/docs/hlsl-renderer.md index 34e98f2..e7d4b0f 100644 --- a/docs/hlsl-renderer.md +++ b/docs/hlsl-renderer.md @@ -5,15 +5,16 @@ explicit frame graph. ## Current Path -1. Engine-owned `D3D12Grid.hlsl` renders a 128x128 scalar Grid height target. +1. Engine-owned `D3D12HeightField.hlsl` renders a 128x128 scalar height-field + target from client-authored brush data. 2. Engine-owned `D3D12Scene.hlsl` traces the background and Grid into scene-linear HDR targets. 3. Epiphany-owned body shaders each get their own proxy pipeline: `D3D12FaceAgent.hlsl`, `D3D12ImaginationAgent.hlsl`, `D3D12EyesAgent.hlsl`, `D3D12BodyAgent.hlsl`, `D3D12HandsAgent.hlsl`, `D3D12SoulAgent.hlsl`, `D3D12LifeAgent.hlsl`, `D3D12SelfBody.hlsl`, and - `D3D12CursorBody.hlsl`. Shared proxy mechanics live in - `D3D12BodyCommon.hlsli` and `D3D12BodyProxy.hlsli`. + `D3D12CursorBody.hlsl`. Shared proxy mechanics live in the engine includes + `D3D12SdfCommon.hlsli`, `D3D12SdfProxy.hlsli`, and `D3D12SdfMath.hlsli`. 4. Engine-owned `D3D12Post.hlsl` builds bloom, resolves diagnostics/history, applies exposure and ACES, then presents. 5. `DirectWriteOverlay` draws crisp final-pixel debug UI after scene rendering. @@ -46,7 +47,7 @@ visibility through the depth target. ## Solids Epiphany uploads Self, Face, Imagination, Eyes, Body, Hands, Soul, Life, and the -cursor through the engine `AquariumBodyVisual` buffer, including current center, +cursor through the engine `AquariumSdfObject` buffer, including current center, previous center, and state scalars. Aquarium owns the D3D12 upload, proxy draw, depth, and presentation machinery; Epiphany owns which bodies exist, where they are, and which shader files describe them. diff --git a/docs/stochastic-transparent-surface-pipeline.md b/docs/stochastic-transparent-surface-pipeline.md index aa14373..97caebf 100644 --- a/docs/stochastic-transparent-surface-pipeline.md +++ b/docs/stochastic-transparent-surface-pipeline.md @@ -13,7 +13,7 @@ self-occlusion, false depth rejection, and temporal history murder. ### Opaque Solids -Examples: Self, planets, later solid SDF bodies. +Examples: Epiphany agent bodies, cursor bodies, and future solid SDF objects. Output: diff --git a/docs/vortice-spine.md b/docs/vortice-spine.md index 3e2da17..a98da08 100644 --- a/docs/vortice-spine.md +++ b/docs/vortice-spine.md @@ -15,18 +15,19 @@ Aquarium starts from a thin native spine: Vortice gives direct access to D3D/DXGI without forcing an engine protocol on top. It is low ceremony enough to build the renderer Aquarium needs while -keeping C# and Rider as the everyday working environment. +keeping C# as the everyday working environment. ## Current Renderer The renderer owns the visible Aquarium frame: 1. Camera and Grid constants come from the client runtime. -2. A Grid-space height pass renders the gravity/terrain height target. -3. A fullscreen D3D12 HLSL pass traces Self, planets, cursor, and the Grid event - lane. -4. HDR bloom and presentation run before the swapchain is handed to the overlay. -5. DirectWrite overlay text and debug UI draw after the scene pass. +2. A height-field pass renders the scalar field target from client brush data. +3. A fullscreen D3D12 HLSL pass traces the background and height-field surface. +4. Client-declared SDF proxy pipelines render Epiphany bodies into the shared + scene targets. +5. HDR bloom and presentation run before the swapchain is handed to the overlay. +6. DirectWrite overlay text and debug UI draw after the scene pass. No framework-owned deferred path or ambient light is hiding under the floor. When richer lighting returns, it enters through an Aquarium-owned renderer diff --git a/state/map.yaml b/state/map.yaml index 8e3de8a..6de3667 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -3,10 +3,12 @@ project: root: E:\Projects\Aquarium-Engine upstream: https://github.com/GameCult/Aquarium-Engine purpose: > - Native C# engine core for the Epiphany Aquarium client. The engine owns the - Win32 host, D3D12 renderer, input loop, client reload boundary, and future - render graph abstractions. The Epiphany client owns frontend intent and - configures those engine abstractions. + Native C# runtime and renderer core for Aquarium clients. The engine owns + the Win32 host, D3D12 renderer, input loop, client reload boundary, debug UI, + audio host, persistent-state transport, and future render graph + abstractions. Epiphany is the current first-party client: it owns frontend + intent, agent visuals, CultCache/CultNet semantics, and render-plan + configuration through the engine contracts. current_model: host: @@ -109,3 +111,4 @@ next_actions: - Follow research/rendering/hdr-pbr-presentation.md before changing HDR exposure, bloom, tonemapping, or display transforms. - Follow docs/tsr-inspired-taa-spec.md when changing current temporal diagnostics. - Promote future runtime knobs into typed CultCache documents before they become process folklore. + - Keep Aquarium and Epiphany in one repo until the contracts and graph API are stable enough for Epiphany to move out without carrying engine policy or reload folklore with it.