Render bodies through bounded proxy passes
This commit is contained in:
parent
1f8a9c4132
commit
b65ed9fd9c
6 changed files with 281 additions and 111 deletions
|
|
@ -6,8 +6,8 @@ explicit frame graph.
|
|||
## Current Path
|
||||
|
||||
1. `D3D12Grid.hlsl` renders a 128x128 scalar Grid height target.
|
||||
2. `D3D12Scene.hlsl` traces the Self emitter, CPU-authored agent visuals,
|
||||
cursor locator, and Grid event lane into scene-linear HDR targets.
|
||||
2. `D3D12Scene.hlsl` traces the background and Grid into scene-linear HDR
|
||||
targets, then draws one bounded proxy quad per visible body.
|
||||
3. `D3D12Post.hlsl` builds bloom, resolves diagnostics/history, applies
|
||||
exposure and ACES, then presents.
|
||||
4. `DirectWriteOverlay` draws crisp final-pixel debug UI after scene rendering.
|
||||
|
|
@ -29,17 +29,21 @@ lines stay the same pixel width across zoom distances. Terrain isolines derive
|
|||
from the Grid height field, while field lines quantize terrain gradient angle
|
||||
and fade out on flat surfaces.
|
||||
|
||||
The Grid is not an opaque surface. The scene shader traces it before the nearest
|
||||
solid and emits premultiplied event radiance plus event metadata. The opaque
|
||||
surface packet belongs to Self, agent visuals, cursor, or empty space.
|
||||
The fullscreen scene pass owns environment and Grid only. Bodies are not folded
|
||||
into that pass. After the Grid writes scene color and travel-derived depth,
|
||||
each body gets an instanced proxy quad whose vertex shader computes a
|
||||
conservative screen rectangle from the uploaded body center and bound radius.
|
||||
The proxy pixel shader raymarches only that object and writes travel-derived
|
||||
depth so the Grid and nearer bodies arbitrate visibility through the depth
|
||||
target.
|
||||
|
||||
## Solids
|
||||
|
||||
Self remains an analytic sphere hit. Agent visuals are uploaded through
|
||||
`AgentVisualGpu`, including current center, previous center, role id, activity,
|
||||
heartbeat, pressure, expression, and LOD tier. The first visual slice keeps the
|
||||
fixed orbit fallback, renders Body and Imagination as LOD 1 role SDFs inside
|
||||
bounded per-agent intervals, and keeps the remaining roles as simple distinct
|
||||
Self, the cursor, and role bodies are uploaded through `AgentVisualGpu`,
|
||||
including current center, previous center, role id, activity, heartbeat,
|
||||
pressure, expression, object kind, and LOD tier. The first visual slice keeps
|
||||
the fixed orbit fallback, renders Body and Imagination as LOD 1 role SDFs inside
|
||||
bounded per-object proxy draws, and keeps the remaining roles as simple distinct
|
||||
fallback organs.
|
||||
|
||||
The cursor is a revolved MathWorld teardrop SDF with SDF ripples and brass GGX
|
||||
|
|
|
|||
|
|
@ -23,10 +23,12 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
{
|
||||
private const int BackBufferCount = 2;
|
||||
private const int GridHeightTextureSize = 128;
|
||||
private const int CursorPrimitiveId = AgentVisualCount + 1;
|
||||
private const Format GridHeightFormat = Format.R16_Float;
|
||||
private const int AgentVisualCount = 5;
|
||||
private const int GridHeightBrushCount = AgentVisualCount + 1;
|
||||
private const Format SceneDepthFormat = Format.D32_Float;
|
||||
private const int AgentVisualCount = 7;
|
||||
private const int SelfObjectIndex = AgentVisualCount - 2;
|
||||
private const int CursorObjectIndex = AgentVisualCount - 1;
|
||||
private const int GridHeightBrushCount = AgentVisualCount - 1;
|
||||
private const int BodyLightCount = 8;
|
||||
private const float GridTransparentMinZ = -1.85f;
|
||||
private const float GridTransparentMaxZ = 0.45f;
|
||||
|
|
@ -69,6 +71,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
private readonly IDXGISwapChain3 swapChain;
|
||||
private readonly D3D12ResourceRegistry resourceRegistry = new();
|
||||
private D3D12DescriptorArena renderTargetViewArena;
|
||||
private D3D12DescriptorArena depthStencilViewArena;
|
||||
private D3D12DescriptorArena staticShaderDescriptorArena;
|
||||
private readonly FrameResources[] frames = new FrameResources[BackBufferCount];
|
||||
private readonly ID3D12GraphicsCommandList commandList;
|
||||
|
|
@ -76,6 +79,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
private ID3D12PipelineState? gridHeightBasePipelineState;
|
||||
private ID3D12PipelineState? gridHeightBrushPipelineState;
|
||||
private ID3D12PipelineState? scenePipelineState;
|
||||
private ID3D12PipelineState? agentProxyPipelineState;
|
||||
private ID3D12PipelineState? bloomPrefilterPipelineState;
|
||||
private ID3D12PipelineState? bloomDownsamplePipelineState;
|
||||
private ID3D12PipelineState? bloomBlurHorizontalPipelineState;
|
||||
|
|
@ -92,6 +96,8 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
private D3D12RenderTarget sceneControlRenderTarget;
|
||||
private D3D12RenderTarget sceneEventColorRenderTarget;
|
||||
private D3D12RenderTarget sceneEventMetadataRenderTarget;
|
||||
private D3D12TrackedResource sceneDepthTarget;
|
||||
private D3D12DescriptorSlot sceneDepthStencilView;
|
||||
private readonly D3D12RenderTarget[] historyRenderTargets = new D3D12RenderTarget[2];
|
||||
private readonly D3D12RenderTarget[] historyMetadataRenderTargets = new D3D12RenderTarget[2];
|
||||
private readonly D3D12RenderTarget[] historyControlRenderTargets = new D3D12RenderTarget[2];
|
||||
|
|
@ -175,6 +181,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
frameIndex = (int)swapChain.CurrentBackBufferIndex;
|
||||
|
||||
renderTargetViewArena = CreateRenderTargetViewArena();
|
||||
depthStencilViewArena = CreateDepthStencilViewArena();
|
||||
staticShaderDescriptorArena = CreateStaticShaderDescriptorArena();
|
||||
for (var index = 0; index < frames.Length; index++)
|
||||
{
|
||||
|
|
@ -190,6 +197,8 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
sceneControlRenderTarget = CreateSceneAuxiliaryRenderTarget("scene-control-target", "Aquarium D3D12 Scene Control Target");
|
||||
sceneEventColorRenderTarget = CreateSceneAuxiliaryRenderTarget("scene-event-color-target", "Aquarium D3D12 Scene Event Color Target");
|
||||
sceneEventMetadataRenderTarget = CreateSceneAuxiliaryRenderTarget("scene-event-metadata-target", "Aquarium D3D12 Scene Event Metadata Target");
|
||||
sceneDepthStencilView = depthStencilViewArena.Allocate();
|
||||
sceneDepthTarget = CreateSceneDepthTarget(sceneDepthStencilView);
|
||||
CreateHistoryRenderTargets();
|
||||
CreateBloomRenderTargets();
|
||||
bodyLightBuffer = new D3D12StructuredBuffer(device, BodyLightCount, Marshal.SizeOf<BodyLightGpu>(), "Aquarium D3D12 Body Light Buffer");
|
||||
|
|
@ -461,12 +470,14 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
sceneControlRenderTarget.Dispose();
|
||||
sceneEventColorRenderTarget.Dispose();
|
||||
sceneEventMetadataRenderTarget.Dispose();
|
||||
sceneDepthTarget.Dispose();
|
||||
gridHeightRenderTarget.Dispose();
|
||||
for (var index = 0; index < frames.Length; index++)
|
||||
{
|
||||
frames[index].Dispose();
|
||||
}
|
||||
staticShaderDescriptorArena.Dispose();
|
||||
depthStencilViewArena.Dispose();
|
||||
renderTargetViewArena.Dispose();
|
||||
swapChain.Dispose();
|
||||
commandQueue.Dispose();
|
||||
|
|
@ -588,6 +599,8 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
gridHeightBrush.Name = "Aquarium D3D12 Grid Height Brush Pipeline";
|
||||
var scene = CreateScenePipelineState(paths.Scene);
|
||||
scene.Name = "Aquarium D3D12 Scene Pipeline";
|
||||
var agentProxy = CreateAgentProxyPipelineState(paths.Scene);
|
||||
agentProxy.Name = "Aquarium D3D12 Agent Proxy Pipeline";
|
||||
var bloomPrefilter = CreateBloomPrefilterPipelineState(paths.Post);
|
||||
bloomPrefilter.Name = "Aquarium D3D12 Bloom Prefilter Pipeline";
|
||||
var bloomDownsample = CreateBloomDownsamplePipelineState(paths.Post);
|
||||
|
|
@ -603,6 +616,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
gridHeightBase,
|
||||
gridHeightBrush,
|
||||
scene,
|
||||
agentProxy,
|
||||
bloomPrefilter,
|
||||
bloomDownsample,
|
||||
bloomBlurHorizontal,
|
||||
|
|
@ -628,6 +642,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
resourceRegistry.RemoveRenderTarget("scene-control-target");
|
||||
resourceRegistry.RemoveRenderTarget("scene-event-color-target");
|
||||
resourceRegistry.RemoveRenderTarget("scene-event-metadata-target");
|
||||
resourceRegistry.RemoveResource("scene-depth-target");
|
||||
resourceRegistry.RemoveRenderTarget("grid-height-target");
|
||||
DisposeBloomRenderTargets();
|
||||
DisposeHistoryRenderTargets();
|
||||
|
|
@ -636,6 +651,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
sceneControlRenderTarget.Dispose();
|
||||
sceneEventColorRenderTarget.Dispose();
|
||||
sceneEventMetadataRenderTarget.Dispose();
|
||||
sceneDepthTarget.Dispose();
|
||||
gridHeightRenderTarget.Dispose();
|
||||
for (var index = 0; index < frames.Length; index++)
|
||||
{
|
||||
|
|
@ -646,8 +662,10 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
width = newWidth;
|
||||
height = newHeight;
|
||||
renderTargetViewArena.Dispose();
|
||||
depthStencilViewArena.Dispose();
|
||||
staticShaderDescriptorArena.Dispose();
|
||||
renderTargetViewArena = CreateRenderTargetViewArena();
|
||||
depthStencilViewArena = CreateDepthStencilViewArena();
|
||||
staticShaderDescriptorArena = CreateStaticShaderDescriptorArena();
|
||||
|
||||
swapChain.ResizeBuffers(BackBufferCount, (uint)width, (uint)height, Format.B8G8R8A8_UNorm, SwapChainFlags.None).CheckError();
|
||||
|
|
@ -660,6 +678,8 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
sceneControlRenderTarget = CreateSceneAuxiliaryRenderTarget("scene-control-target", "Aquarium D3D12 Scene Control Target");
|
||||
sceneEventColorRenderTarget = CreateSceneAuxiliaryRenderTarget("scene-event-color-target", "Aquarium D3D12 Scene Event Color Target");
|
||||
sceneEventMetadataRenderTarget = CreateSceneAuxiliaryRenderTarget("scene-event-metadata-target", "Aquarium D3D12 Scene Event Metadata Target");
|
||||
sceneDepthStencilView = depthStencilViewArena.Allocate();
|
||||
sceneDepthTarget = CreateSceneDepthTarget(sceneDepthStencilView);
|
||||
CreateHistoryRenderTargets();
|
||||
CreateBloomRenderTargets();
|
||||
viewport = new Viewport(0.0f, 0.0f, width, height);
|
||||
|
|
@ -701,6 +721,37 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
return target;
|
||||
}
|
||||
|
||||
private D3D12TrackedResource CreateSceneDepthTarget(D3D12DescriptorSlot depthStencilView)
|
||||
{
|
||||
var clearValue = new ClearValue
|
||||
{
|
||||
Format = SceneDepthFormat,
|
||||
DepthStencil = new DepthStencilValue(1.0f, 0),
|
||||
};
|
||||
var resource = device.CreateCommittedResource(
|
||||
HeapType.Default,
|
||||
ResourceDescription.Texture2D(
|
||||
SceneDepthFormat,
|
||||
(uint)width,
|
||||
(uint)height,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
Vortice.Direct3D12.ResourceFlags.AllowDepthStencil),
|
||||
ResourceStates.DepthWrite,
|
||||
clearValue);
|
||||
device.CreateDepthStencilView(resource, new DepthStencilViewDescription
|
||||
{
|
||||
Format = SceneDepthFormat,
|
||||
ViewDimension = DepthStencilViewDimension.Texture2D,
|
||||
Texture2D = new Texture2DDepthStencilView(),
|
||||
}, depthStencilView.Cpu);
|
||||
var target = new D3D12TrackedResource(resource, ResourceStates.DepthWrite, "Aquarium D3D12 Scene Depth Target", true);
|
||||
resourceRegistry.Add("scene-depth-target", target);
|
||||
return target;
|
||||
}
|
||||
|
||||
private void CreateBloomRenderTargets()
|
||||
{
|
||||
for (var level = 0; level < BloomLevelCount; level++)
|
||||
|
|
@ -811,11 +862,13 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
sceneControlRenderTarget.Transition(context.CommandList, ResourceStates.RenderTarget);
|
||||
sceneEventColorRenderTarget.Transition(context.CommandList, ResourceStates.RenderTarget);
|
||||
sceneEventMetadataRenderTarget.Transition(context.CommandList, ResourceStates.RenderTarget);
|
||||
sceneDepthTarget.Transition(context.CommandList, ResourceStates.DepthWrite);
|
||||
context.CommandList.ClearRenderTargetView(sceneRenderTarget.RenderTargetView.Cpu, new Color4(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
context.CommandList.ClearRenderTargetView(sceneMetadataRenderTarget.RenderTargetView.Cpu, new Color4(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
context.CommandList.ClearRenderTargetView(sceneControlRenderTarget.RenderTargetView.Cpu, new Color4(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
context.CommandList.ClearRenderTargetView(sceneEventColorRenderTarget.RenderTargetView.Cpu, new Color4(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
context.CommandList.ClearRenderTargetView(sceneEventMetadataRenderTarget.RenderTargetView.Cpu, new Color4(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
context.CommandList.ClearDepthStencilView(sceneDepthStencilView.Cpu, ClearFlags.Depth, 1.0f, 0);
|
||||
context.CommandList.SetDescriptorHeaps(frameResources.TransientShaderDescriptors.Heap);
|
||||
context.CommandList.SetPipelineState(scenePipelineState!);
|
||||
context.CommandList.SetGraphicsRootSignature(fullscreenRootSignature);
|
||||
|
|
@ -835,9 +888,12 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
sceneEventColorRenderTarget.RenderTargetView.Cpu,
|
||||
sceneEventMetadataRenderTarget.RenderTargetView.Cpu,
|
||||
],
|
||||
null);
|
||||
sceneDepthStencilView.Cpu);
|
||||
context.CommandList.IASetPrimitiveTopology(PrimitiveTopology.TriangleList);
|
||||
context.CommandList.DrawInstanced(3, 1, 0, 0);
|
||||
|
||||
context.CommandList.SetPipelineState(agentProxyPipelineState!);
|
||||
context.CommandList.DrawInstanced(6, AgentVisualCount, 0, 0);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
@ -1038,7 +1094,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
0.82f,
|
||||
1.25f);
|
||||
|
||||
for (var index = 0; index < AgentVisualCount; index++)
|
||||
for (var index = 0; index < SelfObjectIndex; index++)
|
||||
{
|
||||
var radius = AgentRadius(index);
|
||||
var center = AgentAnchor(index, frame.TimeSeconds);
|
||||
|
|
@ -1058,7 +1114,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
private void BuildAgentVisualTable(AquariumFrame frame)
|
||||
{
|
||||
Array.Clear(agentVisuals);
|
||||
for (var index = 0; index < AgentVisualCount; index++)
|
||||
for (var index = 0; index < SelfObjectIndex; index++)
|
||||
{
|
||||
var radius = AgentRadius(index);
|
||||
var center = AgentCenterAtGridHeight(index, frame.TimeSeconds);
|
||||
|
|
@ -1076,6 +1132,24 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
new Vector4(activity, heartbeat, pressure, expression),
|
||||
new Vector4(lod, index, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
var selfCenter = BodyCenterAtGridHeight(frame, Vector2.Zero, SunRadius);
|
||||
agentVisuals[SelfObjectIndex] = new AgentVisualGpu(
|
||||
new Vector4(selfCenter, SunRadius),
|
||||
new Vector4(selfCenter, 0.0f),
|
||||
new Vector4(1.0f, 1.0f, 0.0f, 0.0f),
|
||||
new Vector4(0.0f, SelfObjectIndex, 1.0f, 0.0f));
|
||||
|
||||
var cursorCenter = BodyCenterAtGridHeight(frame, frame.CursorWorld, CursorBodyRadius);
|
||||
var previousCursorCenter = BodyCenterAtGridHeight(
|
||||
new AquariumFrame(frame.Grid, previousCameraPosition, previousTimeSeconds, previousCursorWorld),
|
||||
previousCursorWorld,
|
||||
CursorBodyRadius);
|
||||
agentVisuals[CursorObjectIndex] = new AgentVisualGpu(
|
||||
new Vector4(cursorCenter, CursorBodyBoundRadius),
|
||||
new Vector4(previousCursorCenter, -1.0f),
|
||||
new Vector4(1.0f, 0.5f, 0.0f, 0.0f),
|
||||
new Vector4(0.0f, CursorObjectIndex, 2.0f, 0.0f));
|
||||
}
|
||||
|
||||
private void SetGridHeightBrush(
|
||||
|
|
@ -1348,6 +1422,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
gridHeightBasePipelineState!,
|
||||
gridHeightBrushPipelineState!,
|
||||
scenePipelineState!,
|
||||
agentProxyPipelineState!,
|
||||
bloomPrefilterPipelineState!,
|
||||
bloomDownsamplePipelineState!,
|
||||
bloomBlurHorizontalPipelineState!,
|
||||
|
|
@ -1361,6 +1436,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
gridHeightBasePipelineState = pipelines.GridHeightBase;
|
||||
gridHeightBrushPipelineState = pipelines.GridHeightBrush;
|
||||
scenePipelineState = pipelines.Scene;
|
||||
agentProxyPipelineState = pipelines.AgentProxy;
|
||||
bloomPrefilterPipelineState = pipelines.BloomPrefilter;
|
||||
bloomDownsamplePipelineState = pipelines.BloomDownsample;
|
||||
bloomBlurHorizontalPipelineState = pipelines.BloomBlurHorizontal;
|
||||
|
|
@ -1374,6 +1450,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
gridHeightBasePipelineState = null;
|
||||
gridHeightBrushPipelineState = null;
|
||||
scenePipelineState = null;
|
||||
agentProxyPipelineState = null;
|
||||
bloomPrefilterPipelineState = null;
|
||||
bloomDownsamplePipelineState = null;
|
||||
bloomBlurHorizontalPipelineState = null;
|
||||
|
|
@ -1414,6 +1491,16 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
"Aquarium D3D12 RTV Arena");
|
||||
}
|
||||
|
||||
private D3D12DescriptorArena CreateDepthStencilViewArena()
|
||||
{
|
||||
return new D3D12DescriptorArena(
|
||||
device,
|
||||
DescriptorHeapType.DepthStencilView,
|
||||
8,
|
||||
DescriptorHeapFlags.None,
|
||||
"Aquarium D3D12 DSV Arena");
|
||||
}
|
||||
|
||||
private D3D12DescriptorArena CreateStaticShaderDescriptorArena()
|
||||
{
|
||||
return new D3D12DescriptorArena(
|
||||
|
|
@ -1546,7 +1633,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
new RootParameter(new RootDescriptorTable([historyEventMetadataRange]), ShaderVisibility.Pixel),
|
||||
new RootParameter(new RootDescriptorTable([studioPmremRange]), ShaderVisibility.Pixel),
|
||||
new RootParameter(new RootDescriptorTable([studioIrradianceRange]), ShaderVisibility.Pixel),
|
||||
new RootParameter(new RootDescriptorTable([agentVisualRange]), ShaderVisibility.Pixel),
|
||||
new RootParameter(new RootDescriptorTable([agentVisualRange]), ShaderVisibility.All),
|
||||
};
|
||||
var staticSamplers = new[]
|
||||
{
|
||||
|
|
@ -1589,7 +1676,12 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
|
||||
private ID3D12PipelineState CreateScenePipelineState(string path)
|
||||
{
|
||||
return CreateFullscreenPipelineState(path, "FullscreenTriangleVS", "D3D12ScenePS", [SceneHdrFormat, SceneHdrFormat, SceneHdrFormat, SceneHdrFormat, SceneHdrFormat]);
|
||||
return CreateFullscreenPipelineState(path, "FullscreenTriangleVS", "D3D12ScenePS", [SceneHdrFormat, SceneHdrFormat, SceneHdrFormat, SceneHdrFormat, SceneHdrFormat], enableDepth: true);
|
||||
}
|
||||
|
||||
private ID3D12PipelineState CreateAgentProxyPipelineState(string path)
|
||||
{
|
||||
return CreateFullscreenPipelineState(path, "D3D12AgentProxyVS", "D3D12AgentProxyPS", [SceneHdrFormat, SceneHdrFormat, SceneHdrFormat, SceneHdrFormat, SceneHdrFormat], enableDepth: true);
|
||||
}
|
||||
|
||||
private ID3D12PipelineState CreateBloomPrefilterPipelineState(string path)
|
||||
|
|
@ -1641,14 +1733,16 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
string vertexEntryPoint,
|
||||
string pixelEntryPoint,
|
||||
Format renderTargetFormat,
|
||||
BlendDescription? blendDescription = null)
|
||||
BlendDescription? blendDescription = null,
|
||||
bool enableDepth = false)
|
||||
{
|
||||
return CreateFullscreenPipelineState(
|
||||
path,
|
||||
vertexEntryPoint,
|
||||
pixelEntryPoint,
|
||||
[renderTargetFormat],
|
||||
blendDescription);
|
||||
blendDescription,
|
||||
enableDepth);
|
||||
}
|
||||
|
||||
private ID3D12PipelineState CreateFullscreenPipelineState(
|
||||
|
|
@ -1656,7 +1750,8 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
string vertexEntryPoint,
|
||||
string pixelEntryPoint,
|
||||
IReadOnlyList<Format> renderTargetFormats,
|
||||
BlendDescription? blendDescription = null)
|
||||
BlendDescription? blendDescription = null,
|
||||
bool enableDepth = false)
|
||||
{
|
||||
var vertexShader = CompileShader(path, vertexEntryPoint, "vs_5_0");
|
||||
var pixelShader = CompileShader(path, pixelEntryPoint, "ps_5_0");
|
||||
|
|
@ -1667,14 +1762,30 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
PixelShader = pixelShader,
|
||||
BlendState = blendDescription ?? BlendDescription.Opaque,
|
||||
RasterizerState = RasterizerDescription.CullNone,
|
||||
DepthStencilState = DepthStencilDescription.None,
|
||||
DepthStencilState = enableDepth
|
||||
? new DepthStencilDescription
|
||||
{
|
||||
DepthEnable = true,
|
||||
DepthWriteMask = DepthWriteMask.All,
|
||||
DepthFunc = ComparisonFunction.LessEqual,
|
||||
StencilEnable = false,
|
||||
}
|
||||
: DepthStencilDescription.None,
|
||||
SampleMask = uint.MaxValue,
|
||||
PrimitiveTopologyType = PrimitiveTopologyType.Triangle,
|
||||
RenderTargetFormats = renderTargetFormats.ToArray(),
|
||||
SampleDescription = new SampleDescription(1, 0),
|
||||
DepthStencilFormat = enableDepth ? SceneDepthFormat : Format.Unknown,
|
||||
};
|
||||
|
||||
return device.CreateGraphicsPipelineState(description);
|
||||
try
|
||||
{
|
||||
return device.CreateGraphicsPipelineState(description);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new InvalidOperationException($"Failed to create D3D12 pipeline VS={vertexEntryPoint} PS={pixelEntryPoint} depth={enableDepth}.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static ReadOnlyMemory<byte> CompileShader(string path, string entryPoint, string profile)
|
||||
|
|
@ -1721,7 +1832,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
* MathF.Sin((world.X * -0.04f + world.Y * 0.07f) - timeSeconds * 0.19f)
|
||||
* 0.035f;
|
||||
height += GridBrushHeight(world, Vector2.Zero, SelfGravityRadius, 2.85f, -1.34f, 0.18f, MathF.Tau, 0.82f, 1.25f, timeSeconds);
|
||||
for (var index = 0; index < AgentVisualCount; index++)
|
||||
for (var index = 0; index < SelfObjectIndex; index++)
|
||||
{
|
||||
var radius = AgentRadius(index);
|
||||
height += GridBrushHeight(world, AgentAnchor(index, timeSeconds), 3.8f + radius * 2.5f, 2.1f, -0.42f, 0.022f, 2.4f, 1.35f, 0.0f, timeSeconds);
|
||||
|
|
@ -1906,6 +2017,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
ID3D12PipelineState GridHeightBase,
|
||||
ID3D12PipelineState GridHeightBrush,
|
||||
ID3D12PipelineState Scene,
|
||||
ID3D12PipelineState AgentProxy,
|
||||
ID3D12PipelineState BloomPrefilter,
|
||||
ID3D12PipelineState BloomDownsample,
|
||||
ID3D12PipelineState BloomBlurHorizontal,
|
||||
|
|
@ -1919,6 +2031,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
BloomBlurHorizontal.Dispose();
|
||||
BloomDownsample.Dispose();
|
||||
BloomPrefilter.Dispose();
|
||||
AgentProxy.Dispose();
|
||||
Scene.Dispose();
|
||||
GridHeightBrush.Dispose();
|
||||
GridHeightBase.Dispose();
|
||||
|
|
|
|||
|
|
@ -43,13 +43,15 @@ struct AgentVisual
|
|||
|
||||
StructuredBuffer<AgentVisual> agentVisuals : register(t24);
|
||||
|
||||
static const int AGENT_VISUAL_COUNT = 5;
|
||||
static const int AGENT_VISUAL_COUNT = 7;
|
||||
static const int SELF_OBJECT_INDEX = AGENT_VISUAL_COUNT - 2;
|
||||
static const int CURSOR_OBJECT_INDEX = AGENT_VISUAL_COUNT - 1;
|
||||
static const int ROLE_AGENT_COUNT = AGENT_VISUAL_COUNT - 2;
|
||||
static const float SUN_RADIUS = 1.12;
|
||||
static const float FIELD_ID_SELF = 2.0;
|
||||
static const float FIELD_ID_GRID = 4.0;
|
||||
static const float FIELD_ID_CURSOR = 5.0;
|
||||
static const float FIELD_ID_AGENT_BASE = 10.0;
|
||||
static const int CURSOR_PRIMITIVE_ID = AGENT_VISUAL_COUNT + 1;
|
||||
static const float CURSOR_RADIUS = 0.56;
|
||||
static const float CURSOR_BOUND_RADIUS = 0.72;
|
||||
static const float BODY_GRID_CLEARANCE_RADIUS_SCALE = 2.0;
|
||||
|
|
@ -71,6 +73,12 @@ struct VertexOut
|
|||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct AgentProxyVertexOut
|
||||
{
|
||||
float4 position : SV_Position;
|
||||
nointerpolation float agentIndex : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct SceneOut
|
||||
{
|
||||
float4 colorTravel : SV_Target0;
|
||||
|
|
@ -78,6 +86,7 @@ struct SceneOut
|
|||
float4 control : SV_Target2;
|
||||
float4 eventColor : SV_Target3;
|
||||
float4 eventMetadata : SV_Target4;
|
||||
float depth : SV_Depth;
|
||||
};
|
||||
|
||||
struct SolidHit
|
||||
|
|
@ -111,6 +120,8 @@ struct RayMarchResult
|
|||
float3 eventColor;
|
||||
};
|
||||
|
||||
void cameraBasis(float3 camera, float2 center, out float3 forward, out float3 right, out float3 up);
|
||||
|
||||
VertexOut FullscreenTriangleVS(uint vertexId : SV_VertexID)
|
||||
{
|
||||
float2 uv = float2((vertexId << 1) & 2, vertexId & 2);
|
||||
|
|
@ -120,6 +131,38 @@ VertexOut FullscreenTriangleVS(uint vertexId : SV_VertexID)
|
|||
return output;
|
||||
}
|
||||
|
||||
AgentProxyVertexOut D3D12AgentProxyVS(uint vertexId : SV_VertexID, uint instanceId : SV_InstanceID)
|
||||
{
|
||||
float2 corners[6] =
|
||||
{
|
||||
float2(-1.0, -1.0),
|
||||
float2(1.0, -1.0),
|
||||
float2(1.0, 1.0),
|
||||
float2(-1.0, -1.0),
|
||||
float2(1.0, 1.0),
|
||||
float2(-1.0, 1.0),
|
||||
};
|
||||
|
||||
AgentVisual agent = agentVisuals[instanceId];
|
||||
float3 forward;
|
||||
float3 right;
|
||||
float3 up;
|
||||
cameraBasis(cameraPosition, gridCenter, forward, right, up);
|
||||
float3 delta = agent.centerRadius.xyz - cameraPosition;
|
||||
float z = max(dot(delta, forward), 0.0001);
|
||||
float2 projected = float2(dot(delta, right), dot(delta, up)) / z * 1.6;
|
||||
float clipAspect = resolution.x / max(resolution.y, 1.0);
|
||||
float boundRadius = agent.centerRadius.w * 1.58;
|
||||
float projectedRadius = boundRadius / z * 1.6 + 0.035;
|
||||
float2 clipCenter = float2(projected.x / clipAspect, -projected.y);
|
||||
float2 clipRadius = float2(projectedRadius / clipAspect, projectedRadius);
|
||||
|
||||
AgentProxyVertexOut output;
|
||||
output.position = float4(clipCenter + corners[vertexId] * clipRadius, 0.0, 1.0);
|
||||
output.agentIndex = (float)instanceId;
|
||||
return output;
|
||||
}
|
||||
|
||||
void cameraBasis(float3 camera, float2 center, out float3 forward, out float3 right, out float3 up)
|
||||
{
|
||||
float3 target = float3(center, 0.0);
|
||||
|
|
@ -396,7 +439,20 @@ AgentSurface agentVisualSdf(float3 p, int agentIndex)
|
|||
float3 local = (p - agent.centerRadius.xyz) / radius;
|
||||
float roleId = agent.previousCenterRole.w;
|
||||
AgentSurface surface = agentFallbackSdf(local, agent);
|
||||
if (abs(roleId - 2.0) < 0.25)
|
||||
if (agentIndex == SELF_OBJECT_INDEX)
|
||||
{
|
||||
surface.distanceValue = sdSphere(local, 1.0);
|
||||
surface.materialId = 0.0;
|
||||
surface.costTier = 0.0;
|
||||
}
|
||||
else if (agentIndex == CURSOR_OBJECT_INDEX)
|
||||
{
|
||||
surface.distanceValue = cursorLocatorSdf(p);
|
||||
surface.materialId = 5.0;
|
||||
surface.costTier = 1.0;
|
||||
return surface;
|
||||
}
|
||||
else if (abs(roleId - 2.0) < 0.25)
|
||||
{
|
||||
surface = agentImaginationSdf(local, agent);
|
||||
}
|
||||
|
|
@ -510,77 +566,83 @@ bool traceCursorLocator(float3 origin, float3 direction, float intervalStart, fl
|
|||
|
||||
float3 primitiveCenterAt(int primitiveId, float sampleTime)
|
||||
{
|
||||
if (primitiveId == 0)
|
||||
{
|
||||
return bodyCenterAtGridHeight(0.0, SUN_RADIUS);
|
||||
}
|
||||
|
||||
if (primitiveId == CURSOR_PRIMITIVE_ID)
|
||||
{
|
||||
return bodyCenterAtGridHeight(cursorWorlds.xy, CURSOR_RADIUS);
|
||||
}
|
||||
|
||||
int agentIndex = clamp(primitiveId - 1, 0, AGENT_VISUAL_COUNT - 1);
|
||||
int agentIndex = clamp(primitiveId, 0, AGENT_VISUAL_COUNT - 1);
|
||||
return agentVisuals[agentIndex].centerRadius.xyz;
|
||||
}
|
||||
|
||||
float primitiveRadius(int primitiveId)
|
||||
{
|
||||
if (primitiveId == 0)
|
||||
{
|
||||
return SUN_RADIUS;
|
||||
}
|
||||
|
||||
if (primitiveId == CURSOR_PRIMITIVE_ID)
|
||||
{
|
||||
return CURSOR_BOUND_RADIUS;
|
||||
}
|
||||
|
||||
int agentIndex = clamp(primitiveId - 1, 0, AGENT_VISUAL_COUNT - 1);
|
||||
int agentIndex = clamp(primitiveId, 0, AGENT_VISUAL_COUNT - 1);
|
||||
return agentVisuals[agentIndex].centerRadius.w;
|
||||
}
|
||||
|
||||
float primitiveFieldId(int primitiveId)
|
||||
{
|
||||
if (primitiveId == CURSOR_PRIMITIVE_ID)
|
||||
if (primitiveId == SELF_OBJECT_INDEX)
|
||||
{
|
||||
return FIELD_ID_SELF;
|
||||
}
|
||||
|
||||
if (primitiveId == CURSOR_OBJECT_INDEX)
|
||||
{
|
||||
return FIELD_ID_CURSOR;
|
||||
}
|
||||
|
||||
return primitiveId == 0 ? FIELD_ID_SELF : FIELD_ID_AGENT_BASE + (float)(primitiveId - 1);
|
||||
return FIELD_ID_AGENT_BASE + (float)primitiveId;
|
||||
}
|
||||
|
||||
void considerPrimitiveHit(float3 origin, float3 direction, int primitiveId, float intervalStart, float intervalEnd, inout SolidHit nearest)
|
||||
{
|
||||
if (primitiveId < 0 || primitiveId == CURSOR_PRIMITIVE_ID)
|
||||
if (primitiveId < 0 || primitiveId >= AGENT_VISUAL_COUNT)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (primitiveId > 0 && primitiveId <= AGENT_VISUAL_COUNT)
|
||||
if (primitiveId < SELF_OBJECT_INDEX)
|
||||
{
|
||||
float agentTravel;
|
||||
float3 agentNormal;
|
||||
float materialId;
|
||||
float stepCount;
|
||||
float costTier;
|
||||
if (traceAgentVisual(origin, direction, primitiveId - 1, intervalStart, min(intervalEnd, nearest.travel), agentTravel, agentNormal, materialId, stepCount, costTier))
|
||||
if (traceAgentVisual(origin, direction, primitiveId, intervalStart, min(intervalEnd, nearest.travel), agentTravel, agentNormal, materialId, stepCount, costTier))
|
||||
{
|
||||
nearest.hit = true;
|
||||
nearest.travel = agentTravel;
|
||||
nearest.normal = agentNormal;
|
||||
nearest.fieldId = primitiveFieldId(primitiveId);
|
||||
nearest.primitiveId = primitiveId;
|
||||
nearest.roleId = agentVisuals[primitiveId - 1].previousCenterRole.w;
|
||||
nearest.roleId = agentVisuals[primitiveId].previousCenterRole.w;
|
||||
nearest.materialId = materialId;
|
||||
nearest.stepCount = stepCount;
|
||||
nearest.lodTier = agentVisuals[primitiveId - 1].lodIndexFlags.x;
|
||||
nearest.lodTier = agentVisuals[primitiveId].lodIndexFlags.x;
|
||||
nearest.costTier = costTier;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (primitiveId == CURSOR_OBJECT_INDEX)
|
||||
{
|
||||
float hitTravel;
|
||||
float3 hitNormal;
|
||||
if (traceCursorLocator(origin, direction, intervalStart, min(intervalEnd, nearest.travel), hitTravel, hitNormal))
|
||||
{
|
||||
nearest.hit = true;
|
||||
nearest.travel = hitTravel;
|
||||
nearest.normal = hitNormal;
|
||||
nearest.fieldId = FIELD_ID_CURSOR;
|
||||
nearest.primitiveId = primitiveId;
|
||||
nearest.roleId = 0.0;
|
||||
nearest.materialId = 5.0;
|
||||
nearest.stepCount = 1.0;
|
||||
nearest.lodTier = 0.0;
|
||||
nearest.costTier = 1.0;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
float radius = primitiveRadius(primitiveId);
|
||||
float3 center = primitiveCenterAt(primitiveId, timeSeconds);
|
||||
float hitTravel;
|
||||
|
|
@ -602,28 +664,10 @@ void considerPrimitiveHit(float3 origin, float3 direction, int primitiveId, floa
|
|||
|
||||
void considerAllPrimitiveHits(float3 origin, float3 direction, float intervalStart, float intervalEnd, inout SolidHit nearest)
|
||||
{
|
||||
considerPrimitiveHit(origin, direction, 0, intervalStart, intervalEnd, nearest);
|
||||
|
||||
[unroll]
|
||||
for (int i = 0; i < AGENT_VISUAL_COUNT; i++)
|
||||
{
|
||||
considerPrimitiveHit(origin, direction, i + 1, intervalStart, intervalEnd, nearest);
|
||||
}
|
||||
|
||||
float hitTravel;
|
||||
float3 hitNormal;
|
||||
if (traceCursorLocator(origin, direction, intervalStart, min(intervalEnd, nearest.travel), hitTravel, hitNormal))
|
||||
{
|
||||
nearest.hit = true;
|
||||
nearest.travel = hitTravel;
|
||||
nearest.normal = hitNormal;
|
||||
nearest.fieldId = FIELD_ID_CURSOR;
|
||||
nearest.primitiveId = CURSOR_PRIMITIVE_ID;
|
||||
nearest.roleId = 0.0;
|
||||
nearest.materialId = 5.0;
|
||||
nearest.stepCount = 1.0;
|
||||
nearest.lodTier = 0.0;
|
||||
nearest.costTier = 1.0;
|
||||
considerPrimitiveHit(origin, direction, i, intervalStart, intervalEnd, nearest);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -743,23 +787,9 @@ RayMarchResult traverseRay(float2 uv, float2 screenUv, float3 origin, float3 dir
|
|||
result.eventCoverage = 0.0;
|
||||
result.eventColor = 0.0;
|
||||
|
||||
SolidHit nearestSolid;
|
||||
nearestSolid.hit = false;
|
||||
nearestSolid.travel = farDistance;
|
||||
nearestSolid.normal = 0.0;
|
||||
nearestSolid.fieldId = 0.0;
|
||||
nearestSolid.primitiveId = -1;
|
||||
nearestSolid.roleId = 0.0;
|
||||
nearestSolid.materialId = 0.0;
|
||||
nearestSolid.stepCount = 0.0;
|
||||
nearestSolid.lodTier = 0.0;
|
||||
nearestSolid.costTier = 0.0;
|
||||
considerAllPrimitiveHits(origin, direction, 0.0, farDistance, nearestSolid);
|
||||
|
||||
float stopTravel = nearestSolid.hit ? nearestSolid.travel : farDistance;
|
||||
float3 gridPosition;
|
||||
float gridTravel;
|
||||
bool gridHit = traceGridSurfaceDirect(origin, direction, 0.0, stopTravel, gridPosition, gridTravel);
|
||||
bool gridHit = traceGridSurfaceDirect(origin, direction, 0.0, farDistance, gridPosition, gridTravel);
|
||||
if (gridHit)
|
||||
{
|
||||
float3 gridNormal;
|
||||
|
|
@ -776,22 +806,6 @@ RayMarchResult traverseRay(float2 uv, float2 screenUv, float3 origin, float3 dir
|
|||
return result;
|
||||
}
|
||||
|
||||
if (nearestSolid.hit)
|
||||
{
|
||||
float3 p = origin + direction * nearestSolid.travel;
|
||||
float3 bodyColor = shadeBody(uv, nearestSolid.travel, p, nearestSolid.normal, nearestSolid.primitiveId);
|
||||
result.color = bodyColor;
|
||||
result.travel = nearestSolid.travel;
|
||||
result.fieldId = nearestSolid.fieldId;
|
||||
result.normal = nearestSolid.normal;
|
||||
result.coverage = 1.0;
|
||||
result.roleId = nearestSolid.roleId;
|
||||
result.materialId = nearestSolid.materialId;
|
||||
result.stepCount = nearestSolid.stepCount;
|
||||
result.lodTier = nearestSolid.lodTier;
|
||||
result.costTier = nearestSolid.costTier;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -911,12 +925,12 @@ float3 shadeBody(float2 uv, float travel, float3 p, float3 normal, int primitive
|
|||
{
|
||||
float fieldId = primitiveFieldId(primitiveId);
|
||||
float3 emission = primitiveEmissionRadiance(fieldId);
|
||||
if (primitiveId == 0)
|
||||
if (primitiveId == SELF_OBJECT_INDEX)
|
||||
{
|
||||
return emission;
|
||||
}
|
||||
|
||||
if (primitiveId == CURSOR_PRIMITIVE_ID)
|
||||
if (primitiveId == CURSOR_OBJECT_INDEX)
|
||||
{
|
||||
static const float CursorRoughness = 0.16;
|
||||
float3 cursorF0 = float3(0.95, 0.62, 0.26);
|
||||
|
|
@ -925,7 +939,7 @@ float3 shadeBody(float2 uv, float travel, float3 p, float3 normal, int primitive
|
|||
+ studioPmremSpecularRadiance(p, normal, CursorRoughness, cursorF0);
|
||||
}
|
||||
|
||||
int agentIndex = clamp(primitiveId - 1, 0, AGENT_VISUAL_COUNT - 1);
|
||||
int agentIndex = clamp(primitiveId, 0, ROLE_AGENT_COUNT - 1);
|
||||
float roleId = agentVisuals[agentIndex].previousCenterRole.w;
|
||||
float materialPulse = agentVisuals[agentIndex].state.y;
|
||||
float3 albedo = lerp(float3(0.34, 0.42, 0.18), float3(0.70, 0.76, 0.42), hash21(float2(primitiveId, 6.3)));
|
||||
|
|
@ -963,5 +977,41 @@ SceneOut D3D12ScenePS(VertexOut input)
|
|||
output.control = float4(result.materialId, result.coverage, result.stepCount / 72.0, result.lodTier + result.costTier * 0.1);
|
||||
output.eventColor = float4(result.eventColor, result.eventCoverage);
|
||||
output.eventMetadata = float4(FIELD_ID_GRID, result.eventTravel, result.eventCoverage, 0.0);
|
||||
output.depth = saturate(result.travel / max(farDistance, 0.001));
|
||||
return output;
|
||||
}
|
||||
|
||||
SceneOut D3D12AgentProxyPS(AgentProxyVertexOut input)
|
||||
{
|
||||
float2 pixel = input.position.xy;
|
||||
float2 uv = float2(pixel.x / max(resolution.x, 1.0), 1.0 - pixel.y / max(resolution.y, 1.0));
|
||||
float3 rayDirection = rayDirectionForPixel(pixel, jitterPixels, cameraPosition, gridCenter);
|
||||
|
||||
SolidHit hit;
|
||||
hit.hit = false;
|
||||
hit.travel = farDistance;
|
||||
hit.normal = 0.0;
|
||||
hit.fieldId = 0.0;
|
||||
hit.primitiveId = -1;
|
||||
hit.roleId = 0.0;
|
||||
hit.materialId = 0.0;
|
||||
hit.stepCount = 0.0;
|
||||
hit.lodTier = 0.0;
|
||||
hit.costTier = 0.0;
|
||||
int agentIndex = clamp((int)round(input.agentIndex), 0, AGENT_VISUAL_COUNT - 1);
|
||||
considerPrimitiveHit(cameraPosition, rayDirection, agentIndex, 0.0, farDistance, hit);
|
||||
if (!hit.hit)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
|
||||
float3 p = cameraPosition + rayDirection * hit.travel;
|
||||
SceneOut output;
|
||||
output.colorTravel = float4(shadeBody(uv, hit.travel, p, hit.normal, hit.primitiveId), min(hit.travel, farDistance + 1.0));
|
||||
output.metadata = float4(hit.fieldId, hit.normal);
|
||||
output.control = float4(hit.materialId, 1.0, hit.stepCount / 72.0, hit.lodTier + hit.costTier * 0.1);
|
||||
output.eventColor = float4(0.0, 0.0, 0.0, 0.0);
|
||||
output.eventMetadata = float4(FIELD_ID_GRID, farDistance + 1.0, 0.0, 0.0);
|
||||
output.depth = saturate(hit.travel / max(farDistance, 0.001));
|
||||
return output;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,3 +26,4 @@
|
|||
{"timestamp":"2026-05-11T16:32:00+01:00","topic":"imagination-sdf-connected-lobes","lesson":"Continuous polar harmonics can still behave like a decorative pseudo-distance and leave visible petal gaps. Imagination now uses a central superquadric plus smooth-unioned ellipsoid petals, keeping the bloom continuous enough for bounded sphere tracing while preserving the five-lobed visual character.","files":["src/Aquarium.Engine/Render/Shaders/D3D12Scene.hlsl","state/memory.json"],"source":"visible artifact review"}
|
||||
{"timestamp":"2026-05-11T16:34:00+01:00","topic":"imagination-sdf-march-conservatism","lesson":"Visible missing structure in Imagination came from shallow petal overlap plus a too-brave march through chained smooth unions. Petals now sit deeper into the core, use broader axes and larger union radii, and agent tracing uses 72 steps with smaller hit epsilon and 0.12 step scale.","files":["src/Aquarium.Engine/Render/Shaders/D3D12Scene.hlsl","state/memory.json"],"source":"visible artifact review"}
|
||||
{"timestamp":"2026-05-11T16:39:00+01:00","topic":"imagination-sdf-petal-legibility","lesson":"Overcorrecting Imagination into a continuous blob destroyed the intended petal read. The better LOD 1 shape uses a small central seed, five narrow ellipsoid petals, and intentional negative space with only a tiny smooth union at the seed.","files":["src/Aquarium.Engine/Render/Shaders/D3D12Scene.hlsl","state/memory.json"],"source":"visible artifact review"}
|
||||
{"timestamp":"2026-05-11T21:40:00+00:00","topic":"bounded-body-proxy-pass","lesson":"The fullscreen scene pass should own only background and Grid. Self, cursor, and role bodies now render through AgentVisualGpu-driven bounded proxy draws: one instanced conservative screen rectangle per object, object-local raymarching, and travel-derived depth writes so Grid and body occlusion stay honest.","files":["src/Aquarium.Engine/Render/D3D12Renderer.cs","src/Aquarium.Engine/Render/Shaders/D3D12Scene.hlsl","docs/hlsl-renderer.md","state/map.yaml","state/memory.json"],"source":"user architecture correction"}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,8 @@ renderer_state:
|
|||
- Deferred scalar Grid height target rendered from additive brush passes.
|
||||
- Self Grid brush uses a widened 17-world-unit gravity bowl plus an Aetheria-style radial cosine wave; CPU, Grid shader, scene placement, and temporal reprojection share the same brush equation.
|
||||
- Direct-traced Grid surface is a terminating perfect mirror over the scalar height field, sampling Studio2 PMREM mip 0.
|
||||
- SDF/analytic solids for Self, CPU-authored agent visuals, and the cursor locator. The first agent visual path keeps fixed fallback orbit data, uploads current and previous centers through `AgentVisualGpu`, and renders Body plus Imagination with LOD 1 role SDFs.
|
||||
- Fullscreen scene pass owns background and Grid only; bodies render through one bounded instanced proxy draw per object with travel-derived depth.
|
||||
- SDF/analytic bodies for Self, CPU-authored agent visuals, and the cursor locator upload current and previous centers through `AgentVisualGpu`; Body plus Imagination use LOD 1 role SDFs.
|
||||
- Agent SDF visual language is documented against Epiphany's published CultNet surfaces: identity from agent memory, motion from heartbeat, posture from role/coordinator/result surfaces, pressure from reorient/pressure surfaces, and expression through bounded orbit wandering plus CPU-visible gravity-well pulses.
|
||||
- Body light buffer feeds Self emission and direct body lighting; future other Selves should join this light lane, not a generic field-instance table.
|
||||
- Studio2 PMREM and irradiance DDS cubemaps are loaded as D3D12 TextureCubes; PMREM serves roughness-mip specular, irradiance serves Lambertian diffuse IBL for non-metal bodies.
|
||||
|
|
@ -68,7 +69,7 @@ renderer_state:
|
|||
next:
|
||||
- Extend explicit renderer debug modes for hits, normals, depth, bins, and lighting.
|
||||
- Promote bodies and body lights from fixed renderer tables to CPU-owned registries with typed controls.
|
||||
- Add per-agent proxy rasterization before the role SDFs grow beyond the current fullscreen bounded-march slice.
|
||||
- Replace fixed fallback role motion with real CultNet-derived AgentVisualState.
|
||||
- Add diegetic labels and object-local menus after renderer and text contracts are stable.
|
||||
|
||||
next_actions:
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
"Role-specific Epiphany agent bodies should be driven by published CultNet surfaces, not private React projection folklore: identity and temperament from epiphany.agent_memory, motion from epiphany.agent_heartbeat, posture from epiphany.surface.roles/coordinator/role_result, and continuity pressure from epiphany.surface.pressure/reorient. The first durable renderer seam should be an AgentVisualState contract before adding per-role SDF organs. Orbit slots are home anchors, not cages: agents may wander a bounded distance for expression, and vertical motion should come from CPU-visible gravity-well pulses that also affect Grid placement.",
|
||||
"Epiphany publishes semantic state, not Aquarium world anchors. AgentVisualState may derive local evidence, artifact, work, review, and continuity anchors, but those are Aquarium-owned diegetic layout rules. Do not require Epiphany graph nodes, jobs, or artifacts to publish spatial coordinates.",
|
||||
"Realtime role SDFs must render through per-agent proxy bounds, not a scene-global mega-SDF. Sphere-trace only conservative distance bounds, select one role SDF after proxy hit, give every expensive feature a local bound, compute normals only after hit, and require LOD plus debug views for step count, proxy hits, material id, LOD tier, and SDF cost tier before adding full organ detail.",
|
||||
"The fullscreen scene pass owns background and Grid only. Self, cursor, and role bodies render through bounded per-object proxy draws using AgentVisualGpu, conservative screen rectangles from center plus bound radius, and travel-derived depth writes for Grid/body occlusion.",
|
||||
"The first live AgentVisualState slice uploads current and previous centers, role id, state scalars, and LOD through AgentVisualGpu. Temporal reprojection must use those uploaded centers for agent field ids; do not rederive moving agent centers separately in post.",
|
||||
"Role SDF animation should avoid raw atan2 polar fields for lobe deformation unless the branch cut is explicitly handled. Use continuous harmonic polynomials over normalized XY directions for rotational lobes so sphere tracing does not open visible seams.",
|
||||
"If a role SDF still shows cut-through gaps after removing angular branch cuts, stop using radial pseudo-distance deformation for that organ. Prefer smooth unions of analytic primitives with conservative bounds so the marcher sees connected surfaces instead of decorative distance fiction.",
|
||||
|
|
|
|||
Loading…
Reference in a new issue