Add field medium diagnostics
This commit is contained in:
parent
980eb23609
commit
135404986b
13 changed files with 293 additions and 4 deletions
|
|
@ -218,13 +218,19 @@ fit. This is not a thresholded glow pass; bright energy spreads without turning
|
|||
the frame into a 2000s bloom accident.
|
||||
|
||||
Temporal debug modes are available in the running window: `F1` cycles modes and
|
||||
number keys `0` through `8` select them directly. Mode `0` is final resolve,
|
||||
number keys `0` through `9` select the first ten modes directly. Mode `0` is final resolve,
|
||||
`1` is raw current scene, `2` is the reprojected history sample, `3` is history
|
||||
age, `4` is history weight, `5` is current temporal control, `6` is current
|
||||
field identity, `7` is bloom contribution, and `8` is exposed luminance. The
|
||||
startup mode can still be set with `--render-debug` or
|
||||
`AQUARIUM_RENDER_DEBUG_MODE`.
|
||||
|
||||
Fog work has started behind diagnostics rather than final-frame haze. The host
|
||||
packs stable field instances into a structured buffer shared with HLSL. Modes
|
||||
`9` and `10` show registered medium density and transmittance from that field
|
||||
contract; the signals are deliberately debug-only until the explicit low-res
|
||||
volume pass and composition path exist.
|
||||
|
||||
The running window also has a Direct2D debug panel toggled with `F2`. It follows
|
||||
the CultLib code-first composition style rather than an immediate-mode toolkit:
|
||||
controls are retained rows bound to `Func<T>`/`Action<T>` pairs. The first panel
|
||||
|
|
|
|||
|
|
@ -98,6 +98,11 @@ Define the field instance ABI before adding more visual tricks:
|
|||
Hard-coded shader field loops are temporary scaffolding only. Do not extend them
|
||||
except to replace them.
|
||||
|
||||
Current status: the renderer now packs a first fixed-size field instance buffer
|
||||
for Self, planets, and local cloud/medium ellipsoids. HLSL consumes that buffer
|
||||
for medium diagnostics, while final scene color remains unchanged. This is the
|
||||
contract foothold, not the final volume renderer.
|
||||
|
||||
### Gate 2: Broad Phase
|
||||
|
||||
Move field selection out of brute-force pixel loops:
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ public readonly record struct GraphicsSettings(
|
|||
float BloomVeilIntensity)
|
||||
{
|
||||
public const int MinRenderDebugMode = 0;
|
||||
public const int MaxRenderDebugMode = 8;
|
||||
public const int MaxRenderDebugMode = 10;
|
||||
public const float MinSceneExposure = 0.02f;
|
||||
public const float MaxSceneExposure = 1.2f;
|
||||
public const float MinBloomIntensity = 0.0f;
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ public enum KeyCode
|
|||
Digit6,
|
||||
Digit7,
|
||||
Digit8,
|
||||
Digit9,
|
||||
RenderDebugCycle,
|
||||
DebugUiToggle,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -195,5 +195,9 @@ public static class AquariumHost
|
|||
{
|
||||
renderer.RenderDebugMode = 8;
|
||||
}
|
||||
else if (input.IsKeyPressed(KeyCode.Digit9))
|
||||
{
|
||||
renderer.RenderDebugMode = 9;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ public sealed class Win32Window : IDisposable
|
|||
private const int VK_6 = 0x36;
|
||||
private const int VK_7 = 0x37;
|
||||
private const int VK_8 = 0x38;
|
||||
private const int VK_9 = 0x39;
|
||||
private const int VK_F1 = 0x70;
|
||||
private const int VK_F2 = 0x71;
|
||||
private const int WHEEL_DELTA = 120;
|
||||
|
|
@ -661,6 +662,9 @@ public sealed class Win32Window : IDisposable
|
|||
case VK_8:
|
||||
input.SetKey(KeyCode.Digit8, isDown);
|
||||
break;
|
||||
case VK_9:
|
||||
input.SetKey(KeyCode.Digit9, isDown);
|
||||
break;
|
||||
case VK_F1:
|
||||
input.SetKey(KeyCode.RenderDebugCycle, isDown);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ public sealed class D3D11Renderer : IDisposable
|
|||
private const int FroxelSlotCount = 2;
|
||||
private const int FroxelBufferElementCount = FroxelCountX * FroxelCountY * FroxelCountZ * FroxelSlotCount;
|
||||
private const int PlanetCount = 5;
|
||||
private const int FieldInstanceCount = PlanetCount + 5;
|
||||
private const float SunRadius = 1.12f;
|
||||
private const float FroxelMinZ = -2.0f;
|
||||
private const float FroxelMaxZ = 6.0f;
|
||||
|
|
@ -82,6 +83,9 @@ public sealed class D3D11Renderer : IDisposable
|
|||
private readonly ID3D11Buffer froxelPrimitiveBuffer;
|
||||
private readonly ID3D11ShaderResourceView froxelPrimitiveShaderResourceView;
|
||||
private readonly Int4[] froxelPrimitiveIds = new Int4[FroxelBufferElementCount];
|
||||
private readonly ID3D11Buffer fieldInstanceBuffer;
|
||||
private readonly ID3D11ShaderResourceView fieldInstanceShaderResourceView;
|
||||
private readonly FieldInstanceGpu[] fieldInstances = new FieldInstanceGpu[FieldInstanceCount];
|
||||
private readonly int width;
|
||||
private readonly int height;
|
||||
private readonly string shaderPath;
|
||||
|
|
@ -243,6 +247,17 @@ public sealed class D3D11Renderer : IDisposable
|
|||
froxelPrimitiveShaderResourceView = device.CreateShaderResourceView(
|
||||
froxelPrimitiveBuffer,
|
||||
new ShaderResourceViewDescription(froxelPrimitiveBuffer, Format.Unknown, 0, FroxelBufferElementCount));
|
||||
fieldInstanceBuffer = device.CreateBuffer(
|
||||
fieldInstances,
|
||||
BindFlags.ShaderResource,
|
||||
ResourceUsage.Default,
|
||||
CpuAccessFlags.None,
|
||||
ResourceOptionFlags.BufferStructured,
|
||||
0,
|
||||
(uint)Marshal.SizeOf<FieldInstanceGpu>());
|
||||
fieldInstanceShaderResourceView = device.CreateShaderResourceView(
|
||||
fieldInstanceBuffer,
|
||||
new ShaderResourceViewDescription(fieldInstanceBuffer, Format.Unknown, 0, FieldInstanceCount));
|
||||
previousCameraPosition = Vector3.Zero;
|
||||
previousGridCenter = Vector2.Zero;
|
||||
previousGridRadius = 0.001f;
|
||||
|
|
@ -285,8 +300,10 @@ public sealed class D3D11Renderer : IDisposable
|
|||
(float2)Vector2.Zero);
|
||||
|
||||
BuildFroxelPrimitiveTable(frame);
|
||||
BuildFieldInstanceTable(frame);
|
||||
context.UpdateSubresource(in constants, frameConstantBuffer);
|
||||
context.UpdateSubresource(froxelPrimitiveIds, froxelPrimitiveBuffer);
|
||||
context.UpdateSubresource(fieldInstances, fieldInstanceBuffer);
|
||||
RenderGridHeight();
|
||||
RenderScene();
|
||||
RenderBloom();
|
||||
|
|
@ -356,6 +373,8 @@ public sealed class D3D11Renderer : IDisposable
|
|||
public void Dispose()
|
||||
{
|
||||
overlay.Dispose();
|
||||
fieldInstanceShaderResourceView.Dispose();
|
||||
fieldInstanceBuffer.Dispose();
|
||||
froxelPrimitiveShaderResourceView.Dispose();
|
||||
froxelPrimitiveBuffer.Dispose();
|
||||
frameConstantBuffer.Dispose();
|
||||
|
|
@ -489,6 +508,7 @@ public sealed class D3D11Renderer : IDisposable
|
|||
context.PSUnsetShaderResource(9);
|
||||
context.PSUnsetShaderResource(10);
|
||||
context.PSUnsetShaderResource(11);
|
||||
context.PSUnsetShaderResource(12);
|
||||
context.OMSetRenderTargets(gridHeightRenderTargetView);
|
||||
context.RSSetViewport(0.0f, 0.0f, GridHeightTextureSize, GridHeightTextureSize, 0.0f, 1.0f);
|
||||
context.ClearRenderTargetView(gridHeightRenderTargetView, new Color4(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
|
|
@ -524,6 +544,7 @@ public sealed class D3D11Renderer : IDisposable
|
|||
context.PSSetShaderResource(0, gridHeightShaderResourceView);
|
||||
context.PSSetShaderResource(1, froxelPrimitiveShaderResourceView);
|
||||
context.PSSetShaderResource(2, ditherShaderResourceView);
|
||||
context.PSSetShaderResource(12, fieldInstanceShaderResourceView);
|
||||
context.PSSetSampler(0, gridSampler);
|
||||
context.PSSetSampler(1, ditherSampler);
|
||||
context.Draw(3, 0);
|
||||
|
|
@ -534,6 +555,7 @@ public sealed class D3D11Renderer : IDisposable
|
|||
context.PSUnsetShaderResource(9);
|
||||
context.PSUnsetShaderResource(10);
|
||||
context.PSUnsetShaderResource(11);
|
||||
context.PSUnsetShaderResource(12);
|
||||
|
||||
for (var level = 0; level < BloomLevelCount; level++)
|
||||
{
|
||||
|
|
@ -826,6 +848,70 @@ public sealed class D3D11Renderer : IDisposable
|
|||
return a + (b - a) * t;
|
||||
}
|
||||
|
||||
private void BuildFieldInstanceTable(AquariumFrame frame)
|
||||
{
|
||||
fieldInstances[0] = FieldInstanceGpu.Sphere(
|
||||
fieldId: 2.0f,
|
||||
flags: FieldFlags.Solid | FieldFlags.Emitter,
|
||||
center: new Vector3(0.0f, 0.0f, 2.2f),
|
||||
radius: SunRadius,
|
||||
materialId: 1.0f,
|
||||
mediumId: 0.0f,
|
||||
color: new Vector3(10.0f, 8.7f, 4.2f),
|
||||
medium: Vector4.Zero);
|
||||
|
||||
for (var i = 0; i < PlanetCount; i++)
|
||||
{
|
||||
var radius = PlanetRadius(i);
|
||||
fieldInstances[i + 1] = FieldInstanceGpu.Sphere(
|
||||
fieldId: 10.0f + i,
|
||||
flags: FieldFlags.Solid | FieldFlags.ShadowCaster | FieldFlags.Receiver,
|
||||
center: PlanetCenter(i, frame.TimeSeconds, radius),
|
||||
radius: radius,
|
||||
materialId: 10.0f + i,
|
||||
mediumId: 0.0f,
|
||||
color: Vector3.One,
|
||||
medium: Vector4.Zero);
|
||||
}
|
||||
|
||||
fieldInstances[6] = FieldInstanceGpu.Ellipsoid(
|
||||
fieldId: 32.0f,
|
||||
flags: FieldFlags.Cloud | FieldFlags.Receiver,
|
||||
center: new Vector3(frame.Grid.Center.X - 3.8f, frame.Grid.Center.Y + 1.8f, 1.15f),
|
||||
radius: new Vector3(3.4f, 1.25f, 0.92f),
|
||||
angle: frame.TimeSeconds * 0.055f,
|
||||
mediumId: 1.0f,
|
||||
color: new Vector3(0.50f, 0.72f, 0.86f),
|
||||
medium: new Vector4(0.030f, 0.018f, 0.0f, 0.45f));
|
||||
fieldInstances[7] = FieldInstanceGpu.Ellipsoid(
|
||||
fieldId: 33.0f,
|
||||
flags: FieldFlags.Cloud | FieldFlags.Receiver,
|
||||
center: new Vector3(frame.Grid.Center.X + 4.1f, frame.Grid.Center.Y - 1.4f, -0.45f),
|
||||
radius: new Vector3(4.5f, 1.55f, 0.78f),
|
||||
angle: -0.62f + frame.TimeSeconds * 0.033f,
|
||||
mediumId: 1.0f,
|
||||
color: new Vector3(0.34f, 0.58f, 0.72f),
|
||||
medium: new Vector4(0.024f, 0.015f, 0.0f, 0.38f));
|
||||
fieldInstances[8] = FieldInstanceGpu.Ellipsoid(
|
||||
fieldId: 34.0f,
|
||||
flags: FieldFlags.Cloud | FieldFlags.Receiver,
|
||||
center: new Vector3(frame.Grid.Center.X + 0.8f, frame.Grid.Center.Y + 3.7f, 2.7f),
|
||||
radius: new Vector3(2.2f, 1.1f, 0.62f),
|
||||
angle: 1.15f,
|
||||
mediumId: 1.0f,
|
||||
color: new Vector3(0.75f, 0.70f, 0.52f),
|
||||
medium: new Vector4(0.020f, 0.014f, 0.0f, 0.32f));
|
||||
fieldInstances[9] = FieldInstanceGpu.Ellipsoid(
|
||||
fieldId: 35.0f,
|
||||
flags: FieldFlags.Cloud | FieldFlags.Receiver,
|
||||
center: new Vector3(frame.Grid.Center.X - 0.4f, frame.Grid.Center.Y - 3.9f, -1.35f),
|
||||
radius: new Vector3(5.2f, 1.8f, 0.88f),
|
||||
angle: 0.46f,
|
||||
mediumId: 1.0f,
|
||||
color: new Vector3(0.30f, 0.50f, 0.68f),
|
||||
medium: new Vector4(0.018f, 0.012f, 0.0f, 0.35f));
|
||||
}
|
||||
|
||||
private static Vector2 HaltonJitter(int index)
|
||||
{
|
||||
return new Vector2(Halton(index & 1023, 2) - 0.5f, Halton(index & 1023, 3) - 0.5f) * TemporalJitterScale;
|
||||
|
|
@ -902,6 +988,65 @@ public sealed class D3D11Renderer : IDisposable
|
|||
[StructLayout(LayoutKind.Sequential)]
|
||||
private readonly record struct Int4(int X, int Y, int Z, int W);
|
||||
|
||||
[Flags]
|
||||
private enum FieldFlags
|
||||
{
|
||||
Solid = 1,
|
||||
Cloud = 2,
|
||||
Hybrid = 4,
|
||||
Emitter = 8,
|
||||
ShadowCaster = 16,
|
||||
Receiver = 32,
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private readonly record struct FieldInstanceGpu(
|
||||
Vector4 CenterRadius,
|
||||
Vector4 RadiusAngle,
|
||||
Vector4 FieldFlags,
|
||||
Vector4 MaterialMedium,
|
||||
Vector4 ColorIntensity,
|
||||
Vector4 MediumTerms)
|
||||
{
|
||||
public static FieldInstanceGpu Sphere(
|
||||
float fieldId,
|
||||
FieldFlags flags,
|
||||
Vector3 center,
|
||||
float radius,
|
||||
float materialId,
|
||||
float mediumId,
|
||||
Vector3 color,
|
||||
Vector4 medium)
|
||||
{
|
||||
return new FieldInstanceGpu(
|
||||
new Vector4(center, radius),
|
||||
new Vector4(radius, radius, radius, 0.0f),
|
||||
new Vector4(fieldId, (float)flags, 1.0f, 0.0f),
|
||||
new Vector4(materialId, mediumId, 0.0f, 0.0f),
|
||||
new Vector4(color, 1.0f),
|
||||
medium);
|
||||
}
|
||||
|
||||
public static FieldInstanceGpu Ellipsoid(
|
||||
float fieldId,
|
||||
FieldFlags flags,
|
||||
Vector3 center,
|
||||
Vector3 radius,
|
||||
float angle,
|
||||
float mediumId,
|
||||
Vector3 color,
|
||||
Vector4 medium)
|
||||
{
|
||||
return new FieldInstanceGpu(
|
||||
new Vector4(center, MathF.Max(MathF.Max(radius.X, radius.Y), radius.Z)),
|
||||
new Vector4(radius, angle),
|
||||
new Vector4(fieldId, (float)flags, 2.0f, 0.0f),
|
||||
new Vector4(0.0f, mediumId, 0.0f, 0.0f),
|
||||
new Vector4(color, 1.0f),
|
||||
medium);
|
||||
}
|
||||
}
|
||||
|
||||
private readonly record struct ShaderSet(
|
||||
ID3D11VertexShader VertexShader,
|
||||
ID3D11PixelShader GridHeightPixelShader,
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ internal sealed class DirectWriteOverlay : IDisposable
|
|||
if (renderDebugMode > 0)
|
||||
{
|
||||
renderTarget.DrawText(
|
||||
$"render debug {renderDebugMode} F1 cycle 0-8 select",
|
||||
$"render debug {renderDebugMode} F1 cycle 0-9 select",
|
||||
smallFormat,
|
||||
RectFromEdges(18, 56, Math.Min(width - 18, 420), 80),
|
||||
quietTextBrush,
|
||||
|
|
|
|||
|
|
@ -32,6 +32,19 @@ Texture2D<float4> historyControlTexture : register(t8);
|
|||
Texture2D<float4> bloomTexture0 : register(t9);
|
||||
Texture2D<float4> bloomTexture1 : register(t10);
|
||||
Texture2D<float4> bloomTexture2 : register(t11);
|
||||
|
||||
struct FieldInstance
|
||||
{
|
||||
float4 centerRadius;
|
||||
float4 radiusAngle;
|
||||
float4 fieldFlags;
|
||||
float4 materialMedium;
|
||||
float4 colorIntensity;
|
||||
float4 mediumTerms;
|
||||
};
|
||||
|
||||
StructuredBuffer<FieldInstance> fieldInstances : register(t12);
|
||||
|
||||
SamplerState gridSampler : register(s0);
|
||||
SamplerState ditherSampler : register(s1);
|
||||
|
||||
|
|
@ -49,6 +62,8 @@ static const float TERRAIN_ISOLINE_SPACING = 0.12;
|
|||
static const float TERRAIN_ISOLINE_PIXEL_WIDTH = 0.54;
|
||||
static const float TERRAIN_FIELD_LINE_PIXEL_WIDTH = 0.38;
|
||||
static const int CLOUD_FIELD_COUNT = 4;
|
||||
static const int FIELD_INSTANCE_COUNT = 10;
|
||||
static const int FIELD_FLAG_CLOUD = 2;
|
||||
static const float CLOUD_MIN_STEP = 0.085;
|
||||
static const float CLOUD_MAX_STEP = 0.46;
|
||||
static const float CLOUD_EMPTY_STEP_SCALE = 0.42;
|
||||
|
|
@ -359,6 +374,88 @@ float ellipsoidSdf(float3 p, float3 radius)
|
|||
return normalizedDistance * min(safeRadius.x, min(safeRadius.y, safeRadius.z));
|
||||
}
|
||||
|
||||
float2 rotate2(float2 value, float angle)
|
||||
{
|
||||
float s = sin(angle);
|
||||
float c = cos(angle);
|
||||
return float2(value.x * c - value.y * s, value.x * s + value.y * c);
|
||||
}
|
||||
|
||||
float fieldDistance(float3 p, FieldInstance field)
|
||||
{
|
||||
float3 local = p - field.centerRadius.xyz;
|
||||
local.xy = rotate2(local.xy, -field.radiusAngle.w);
|
||||
return ellipsoidSdf(local, max(field.radiusAngle.xyz, 0.001));
|
||||
}
|
||||
|
||||
float registeredMediumDensity(float3 p, out float3 scattering)
|
||||
{
|
||||
float density = 0.0;
|
||||
scattering = 0.0;
|
||||
|
||||
[unroll]
|
||||
for (int i = 0; i < FIELD_INSTANCE_COUNT; i++)
|
||||
{
|
||||
FieldInstance field = fieldInstances[i];
|
||||
if (((int)(field.fieldFlags.y + 0.5) & FIELD_FLAG_CLOUD) == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
float distanceToField = fieldDistance(p, field);
|
||||
float shell = smoothstep(0.0, 0.42, -distanceToField);
|
||||
if (shell <= 0.0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
float3 local = p - field.centerRadius.xyz;
|
||||
local.xy = rotate2(local.xy, -field.radiusAngle.w);
|
||||
local /= max(field.radiusAngle.xyz, 0.001);
|
||||
float erosion = saturate(0.62 + fbm3(local * 3.4 + float3(0.0, 0.0, timeSeconds * 0.018)) * 0.38);
|
||||
float core = 1.0 - smoothstep(0.80, 1.05, length(local));
|
||||
float fieldDensity = shell * core * erosion * field.mediumTerms.w;
|
||||
density += fieldDensity;
|
||||
scattering += field.colorIntensity.rgb * fieldDensity * field.mediumTerms.y;
|
||||
}
|
||||
|
||||
return saturate(density);
|
||||
}
|
||||
|
||||
void integrateRegisteredMedium(float3 rayOrigin, float3 rayDirection, float maxTravel, out float densityIntegral, out float transmittance, out float3 inScattering)
|
||||
{
|
||||
densityIntegral = 0.0;
|
||||
transmittance = 1.0;
|
||||
inScattering = 0.0;
|
||||
|
||||
float marchEnd = min(maxTravel, farDistance);
|
||||
float stepLength = max(marchEnd / 40.0, 0.08);
|
||||
float travel = stepLength * 0.5;
|
||||
|
||||
[loop]
|
||||
for (int stepIndex = 0; stepIndex < 48; stepIndex++)
|
||||
{
|
||||
if (travel >= marchEnd || transmittance < 0.02)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
float3 p = rayOrigin + rayDirection * travel;
|
||||
float3 scattering;
|
||||
float density = registeredMediumDensity(p, scattering);
|
||||
if (density > 0.001)
|
||||
{
|
||||
float extinction = density * 0.16;
|
||||
float segmentTransmittance = exp(-extinction * stepLength);
|
||||
densityIntegral += density * stepLength;
|
||||
inScattering += transmittance * scattering * (1.0 - segmentTransmittance) / max(extinction, 0.001);
|
||||
transmittance *= segmentTransmittance;
|
||||
}
|
||||
|
||||
travel += stepLength;
|
||||
}
|
||||
}
|
||||
|
||||
void cloudFieldInfo(int index, out float3 center, out float3 radius, out float3 tint, out float densityScale)
|
||||
{
|
||||
float slowTime = timeSeconds * 0.035;
|
||||
|
|
@ -1359,6 +1456,7 @@ SceneOut AquariumScenePS(VertexOut input)
|
|||
float outputReactive = 0.0;
|
||||
float outputCoverage = 0.0;
|
||||
float outputMediumOpacity = 0.0;
|
||||
float outputMediumDensity = 0.0;
|
||||
|
||||
if (raymarchBodies(cameraPosition, rayDirection, hitPosition, materialId, primitiveId, travel))
|
||||
{
|
||||
|
|
@ -1390,12 +1488,19 @@ SceneOut AquariumScenePS(VertexOut input)
|
|||
}
|
||||
}
|
||||
|
||||
float mediumDensityIntegral;
|
||||
float mediumTransmittance;
|
||||
float3 mediumInScattering;
|
||||
integrateRegisteredMedium(cameraPosition, rayDirection, min(outputTravel, farDistance), mediumDensityIntegral, mediumTransmittance, mediumInScattering);
|
||||
outputMediumOpacity = saturate(1.0 - mediumTransmittance);
|
||||
outputMediumDensity = saturate(mediumDensityIntegral * 0.18);
|
||||
|
||||
color += float3(0.001, 0.003, 0.004);
|
||||
|
||||
SceneOut output;
|
||||
output.colorTravel = float4(color, min(outputTravel, farDistance + 1.0));
|
||||
output.metadata = float4(outputMaterialId, outputNormal);
|
||||
output.control = float4(outputReactive, outputCoverage, outputMediumOpacity, 0.0);
|
||||
output.control = float4(outputReactive, outputCoverage, outputMediumOpacity, outputMediumDensity);
|
||||
return output;
|
||||
}
|
||||
|
||||
|
|
@ -1517,6 +1622,7 @@ ResolveOut AquariumResolvePS(VertexOut input)
|
|||
float currentReactive = saturate(currentControl.x);
|
||||
float currentCoverage = saturate(currentControl.y);
|
||||
float currentMediumOpacity = saturate(currentControl.z);
|
||||
float currentMediumDensity = saturate(currentControl.w);
|
||||
bool currentIsGrid = abs(currentFieldId - FIELD_ID_GRID) < 0.25;
|
||||
|
||||
if (currentIsGrid && currentTravel <= farDistance)
|
||||
|
|
@ -1626,6 +1732,15 @@ ResolveOut AquariumResolvePS(VertexOut input)
|
|||
float ev = log2(max(luminance(exposedColor), 0.0001));
|
||||
finalColor = lerp(float3(0.02, 0.08, 0.20), float3(1.0, 0.82, 0.22), saturate((ev + 7.0) / 10.0));
|
||||
}
|
||||
else if (renderDebugMode >= 8.5 && renderDebugMode < 9.5)
|
||||
{
|
||||
finalColor = lerp(float3(0.01, 0.025, 0.04), float3(0.28, 0.78, 1.0), currentMediumDensity);
|
||||
}
|
||||
else if (renderDebugMode >= 9.5 && renderDebugMode < 10.5)
|
||||
{
|
||||
float transmittance = saturate(1.0 - currentMediumOpacity);
|
||||
finalColor = lerp(float3(0.10, 0.02, 0.01), float3(0.72, 1.0, 0.86), transmittance);
|
||||
}
|
||||
|
||||
ResolveOut output;
|
||||
output.finalColor = float4(finalColor, 1.0);
|
||||
|
|
|
|||
|
|
@ -46,3 +46,4 @@
|
|||
{"area":"renderer/debug-ui","lesson":"Debug UI interaction feedback should be element-specific and stable-geometry: base/hover/active states, slider track/fill and handle brighten independently, active brightens further, and saturated accent colors should lerp toward white rather than resizing controls or darkening surfaces.","files":["src/Aquarium.Engine/Render/Ui/DebugUi.cs","src/Aquarium.Engine/Render/DirectWriteOverlay.cs","state/memory.json","state/scratch.md"],"verification":["dotnet build Aquarium.Engine.slnx",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4"],"ts":"2026-05-09"}
|
||||
{"area":"renderer/debug-ui","lesson":"Tooltips now belong to code-first control declarations as optional intent strings and render as viewport-clamped Direct2D overlay slabs. Keep that path for future renderer controls instead of adding separate anonymous tooltip plumbing.","files":["src/Aquarium.Engine/Render/Ui/DebugUi.cs","src/Aquarium.Engine/Render/D3D11Renderer.cs","state/memory.json","state/scratch.md"],"verification":["dotnet build Aquarium.Engine.slnx",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4"],"ts":"2026-05-09"}
|
||||
{"area":"renderer/state","lesson":"Global renderer presentation knobs should be a typed CultCache document, not process-local debug UI state. Aquarium now uses a contracts-level GraphicsSettings DTO, a live epiphany.aquarium.graphics_settings document, host sync from renderer to runtime, and runtime flush before live assembly reload so render debug mode plus HDR exposure/bloom controls persist across restart and reload without forcing disk writes on every slider twitch.","files":["src/Aquarium.Engine.Contracts/GraphicsSettings.cs","src/Aquarium.Engine.Contracts/AquariumRuntimeContracts.cs","src/Aquarium.Engine.Live/State/AquariumGraphicsSettingsState.cs","src/Aquarium.Engine.Live/State/AquariumCultStateStore.cs","src/Aquarium.Engine.Live/AquariumRuntime.cs","src/Aquarium.Engine/AquariumHost.cs","src/Aquarium.Engine/Live/LiveRuntimeLoader.cs","src/Aquarium.Engine/Render/D3D11Renderer.cs","docs/cult-runtime-surface.md","docs/hlsl-renderer.md","state/map.yaml","state/memory.json","state/scratch.md"],"verification":["dotnet build Aquarium.Engine.slnx",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4","direct headless two-run probe: --render-debug 7 persisted as debug 7 on the next run using artifacts/verification/graphics-settings-persist.msgpack"],"ts":"2026-05-09"}
|
||||
{"area":"renderer/volumetrics","lesson":"The first fog-land implementation should establish the field contract and diagnostics before compositing fog. Aquarium now sends a fixed field instance structured buffer for Self, planets, and local medium ellipsoids to HLSL; modes 9 and 10 expose registered medium density and transmittance. Final mode 0 remains unchanged until the explicit low-res volume pass and compositor are built.","files":["src/Aquarium.Engine/Render/D3D11Renderer.cs","src/Aquarium.Engine/Render/Shaders/Aquarium.hlsl","src/Aquarium.Engine.Contracts/GraphicsSettings.cs","src/Aquarium.Engine.Contracts/Input/InputState.cs","src/Aquarium.Engine/AquariumHost.cs","src/Aquarium.Engine/Platform/Win32Window.cs","src/Aquarium.Engine/Render/DirectWriteOverlay.cs","docs/sdf-field-renderer-plan.md","docs/hlsl-renderer.md","state/map.yaml","state/memory.json","state/scratch.md"],"verification":["dotnet build Aquarium.Engine.slnx",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4","direct headless startup with --render-debug 10 compiled shaders and loaded persisted debug mode 10"],"ts":"2026-05-09"}
|
||||
|
|
|
|||
|
|
@ -63,8 +63,10 @@ renderer_state:
|
|||
- DirectWrite overlay text after scene rendering.
|
||||
- Direct2D/DirectWrite debug UI panel with code-first controls bound to renderer state.
|
||||
- Global GraphicsSettings document feeding render debug, exposure, bloom intensity, and bloom veil.
|
||||
- First field instance structured buffer feeding registered medium diagnostics.
|
||||
- Splash screen with bundled app icon and GameCult typefaces.
|
||||
next:
|
||||
- Promote field instances from fixed renderer table to a CPU-owned registry with per-field debug controls.
|
||||
- Extend explicit renderer debug modes for hits, normals, depth, bins, and lighting.
|
||||
- Restore HDR scene target, gentle pre-tonemap bloom, and ACES as explicit passes.
|
||||
- Add volumetrics as an explicit renderer-owned field pass, starting from Wronski/Hillaire-style frustum volume lighting with Self as the first emitter.
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
"For research decks with recordings, pull subtitles/transcripts before distilling. The Dreams transcript changed the lesson: preserve the evaluator/field that serves the image, not the elegant SDF/brick/froxel experiment that drifted away from the art direction.",
|
||||
"Sea of Thieves clouds are the stylized counterexample: authored opaque cloud geometry filtered through low-res blurred color/depth compositing can beat dense raymarching when clouds are symbolic world objects or gameplay signage. Consider tool-time SDF baking for per-vertex cloud lighting, not runtime volume traversal by reflex.",
|
||||
"The SDF field renderer plan is docs/sdf-field-renderer-plan.md: solids and clouds should share one field grammar, with distance, density, material, medium, bounds, and debug views.",
|
||||
"Fog-land started with a renderer/HLSL field instance ABI, not final-frame haze. Aquarium now packs Self, planets, and local medium ellipsoids into a structured buffer; debug modes 9 and 10 expose registered medium density and transmittance while final composition remains unchanged until the explicit low-res volume pass exists.",
|
||||
"SDF cloud distance should shape and accelerate the medium, not create a positive-distance absorbing shell. Prototype ellipsoid edges occluded farther clouds until density was changed to eroded interior occupancy with lower extinction.",
|
||||
"A bounded cloud prototype should march analytic ray/volume intervals, not global SDF shells. The first cloud artifact persisted until rays jumped between true ellipsoid entry/exit intervals; otherwise near fields can consume the sample budget and masquerade as occluders.",
|
||||
"SDF clouds/solids need waterfall architecture, not agile accretion. Define and build the field contract, broad phase, explicit local volume pass, composition contract, and acceleration gates before adding more cloud features.",
|
||||
|
|
|
|||
|
|
@ -130,6 +130,11 @@ prototype integrated along the camera ray before surface composition.
|
|||
host syncs changed renderer settings back to the live runtime, and the runtime
|
||||
flushes dirty settings on the normal state interval, shutdown, and before live
|
||||
assembly reload.
|
||||
- Fog-land Gate 1 foothold: renderer now packs a fixed field instance structured
|
||||
buffer for Self, planets, and local medium ellipsoids. HLSL consumes the buffer
|
||||
for registered medium density/transmittance diagnostics. Debug mode 9 shows
|
||||
medium density, mode 10 shows transmittance. Final scene composition is still
|
||||
untouched until the explicit low-res volume pass exists.
|
||||
- Dev watcher correction: live runtime reload now waits for the host stdout log
|
||||
to acknowledge the exact new live DLL path before declaring success. A pointer
|
||||
write alone is not proof. `dev-watch.ps1 -ReopenWhenClosed` reopens the last
|
||||
|
|
|
|||
Loading…
Reference in a new issue