Unify D3D12 scene interval traversal

This commit is contained in:
Meta Vens 2026-05-09 19:12:37 +01:00
commit 9cf41b6ad3
6 changed files with 318 additions and 88 deletions

View file

@ -49,6 +49,11 @@ resource graph beyond smoke-pass scaffolding.
contribution is sampled into the medium atlas as a thin participating layer,
so it is integrated with volumetrics rather than alpha-blended or used to
occlude the ray.
- The D3D12 scene shader now follows a unified ray traversal shape: it walks
ray-depth intervals, integrates medium/event transport, queries the binned
froxel primitive table for solid candidates, and resolves the nearest opaque
hit in order. Current solids are still analytic spheres, but the hot loop now
has the right ownership boundary for future SDF evaluators.
- The transparent Grid layer is no longer hardcoded as a medium-special case:
D3D12 now uploads a transparent-surface table and a froxel-binned transparent
surface id buffer, then the medium shader resolves transparent contributions
@ -85,6 +90,9 @@ resource graph beyond smoke-pass scaffolding.
- The transparent-surface bin currently has only the Grid layer as its first
registered producer. Future stochastic particles and billboards should extend
that path rather than reintroducing alpha-blended scene surfaces.
- Solid bins currently contain only Self/planet analytic sphere candidates.
Future work should replace the analytic evaluator with bounded SDF surface
solving inside the existing interval traversal, not a separate solid pass.
- D3D11 and D3D12 field table builders are temporarily duplicated by design.
D3D11 is reference-only and will be removed after migration; do not pay DRY
tax merely to preserve it.

View file

@ -31,6 +31,13 @@ temporary visual reference until the old backend is deleted.
the D3D12 frame graph. Grid line transparency is injected as a thin medium
contribution in the froxel atlas instead of being drawn as an alpha surface or
used as a scene-depth terminator.
- The D3D12 scene pass now uses one bounded interval traversal for solids,
medium, and transparent events. Each camera ray walks the medium slice
intervals, samples medium/event transport for that interval, looks up binned
solid candidates from the froxel primitive table at conservative interval
sample points, and stops at the nearest opaque hit after integrating transport
up to it. The current solid evaluator is still analytic spheres; the traversal
contract is ready for SDF surface evaluators and bracket/bisect refinements.
- Transparent Grid contribution is now represented by a transparent-surface
table plus froxel-binned surface ids. The medium pass discovers it through the
froxel bin, so future particles and billboard-like surfaces can use the same
@ -87,10 +94,8 @@ temporary visual reference until the old backend is deleted.
3. Port the Grid height pass after preserving D3D11 as the reference output.
4. Keep capacity diagnostics loud while the backend is still small enough to
make mistakes obvious.
5. Port the existing passes in visible order: grid height, froxel volume, scene,
bloom, resolve, overlay/debug.
6. Build the transparent stochastic surface pipe in D3D12 once descriptor and
candidate-buffer ownership is explicit.
5. Keep replacing placeholder evaluators inside the unified traversal with real
field/SDF/particle implementations instead of adding side-channel passes.
## Invariants

View file

@ -86,8 +86,12 @@ D3D12 also uploads the current froxel primitive id table and field instance
table into default-heap structured buffers every frame. The D3D12 medium pass
renders a packed frustum froxel atlas into diagnostic and transport render
targets from those field instances, and mode `11` displays the froxel density
target. D3D12 final mode now renders a first scene pass for Self, planets, and
medium transport. Grid transparency contributes to the froxel medium as a thin
target. D3D12 final mode now renders Self, planets, medium transport, and
transparent events through a bounded interval traversal. A camera ray walks the
medium depth intervals, integrates medium/event transport, looks up solid
candidates from the froxel primitive table at conservative interval sample
points, and stops at the nearest opaque hit after integrating transport up to
that travel. Grid transparency contributes to the froxel medium as a thin
binned transparent-surface layer, not as an alpha-blended surface or scene-depth
terminator. That binned Grid layer now carries cartesian gridlines, height
isolines, and gradient-angle field lines. D3D12 also owns an HDR scene target
@ -284,6 +288,13 @@ in-scattering`, gated by the persisted Medium Composite control. The default is
`0`, so the pass can be inspected without changing the presented frame until the
medium is tuned.
The D3D12 scene pass has begun collapsing solid, medium, and transparent-event
composition into one traversal clock. The first implementation still uses
analytic sphere evaluators for Self and planets, but those evaluators are called
only from froxel-binned solid candidates inside each ray interval. Future SDF
surfaces should replace the sphere evaluator with bounded SDF marching plus
bracket/bisect surface refinement inside that same interval contract.
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

View file

@ -23,6 +23,7 @@ cbuffer AquariumFrame : register(b0)
};
Texture2D<float4> gridHeightTexture : register(t0);
StructuredBuffer<int4> froxelPrimitiveIds : register(t1);
Texture2D<float4> mediumVolumeTexture : register(t13);
Texture2D<float4> mediumTransportTexture : register(t14);
Texture2D<float4> mediumEventTexture : register(t17);
@ -38,6 +39,12 @@ static const float FIELD_ID_PLANET_BASE = 10.0;
static const int MEDIUM_FROXEL_ATLAS_COLUMNS = 8;
static const int MEDIUM_FROXEL_ATLAS_ROWS = 4;
static const int MEDIUM_FROXEL_SLICE_COUNT = MEDIUM_FROXEL_ATLAS_COLUMNS * MEDIUM_FROXEL_ATLAS_ROWS;
static const int FROXEL_COUNT_X = 8;
static const int FROXEL_COUNT_Y = 8;
static const int FROXEL_COUNT_Z = 4;
static const int FROXEL_SLOT_COUNT = 2;
static const float FROXEL_MIN_Z = -2.0;
static const float FROXEL_MAX_Z = 6.0;
struct VertexOut
{
@ -52,6 +59,26 @@ struct SceneOut
float4 control : SV_Target2;
};
struct SolidHit
{
bool hit;
float travel;
float3 normal;
float fieldId;
int primitiveId;
};
struct RayMarchResult
{
float3 color;
float travel;
float fieldId;
float3 normal;
float coverage;
float mediumOpacity;
float densityMean;
};
VertexOut FullscreenTriangleVS(uint vertexId : SV_VertexID)
{
float2 uv = float2((vertexId << 1) & 2, vertexId & 2);
@ -100,6 +127,8 @@ float3 planetCenterAt(int index, float sampleTime)
return float3(xy, 1.15 + planetRadius(index) * 0.72);
}
float3 shadeBody(float3 p, float3 normal, int primitiveId);
float2 gridLocal(float2 p)
{
return (p - gridCenter) / max(gridRadius, 0.001);
@ -138,6 +167,114 @@ bool traceSphere(float3 origin, float3 direction, float3 center, float radius, o
return t > 0.0 && t < farDistance;
}
bool traceSphereInInterval(float3 origin, float3 direction, float3 center, float radius, float intervalStart, float intervalEnd, out float travel)
{
if (!traceSphere(origin, direction, center, radius, travel))
{
return false;
}
return travel >= intervalStart && travel <= intervalEnd;
}
float3 primitiveCenterAt(int primitiveId, float sampleTime)
{
if (primitiveId == 0)
{
return float3(0.0, 0.0, 2.2);
}
return planetCenterAt(primitiveId - 1, sampleTime);
}
float primitiveRadius(int primitiveId)
{
return primitiveId == 0 ? SUN_RADIUS : planetRadius(primitiveId - 1);
}
float primitiveFieldId(int primitiveId)
{
return primitiveId == 0 ? FIELD_ID_SELF : FIELD_ID_PLANET_BASE + (float)(primitiveId - 1);
}
int clampCell(float normalized, int count)
{
return clamp((int)floor(normalized * (float)count), 0, count - 1);
}
int froxelIndexForPosition(float3 p)
{
float2 local = gridLocal(p.xy);
float localZ = (p.z - FROXEL_MIN_Z) / (FROXEL_MAX_Z - FROXEL_MIN_Z);
if (abs(local.x) > 1.0 || abs(local.y) > 1.0 || localZ < 0.0 || localZ > 1.0)
{
return -1;
}
int x = clampCell(local.x * 0.5 + 0.5, FROXEL_COUNT_X);
int y = clampCell(local.y * 0.5 + 0.5, FROXEL_COUNT_Y);
int z = clampCell(localZ, FROXEL_COUNT_Z);
return x + y * FROXEL_COUNT_X + z * FROXEL_COUNT_X * FROXEL_COUNT_Y;
}
void considerPrimitiveHit(float3 origin, float3 direction, int primitiveId, float intervalStart, float intervalEnd, inout SolidHit nearest)
{
if (primitiveId < 0)
{
return;
}
float radius = primitiveRadius(primitiveId);
float3 center = primitiveCenterAt(primitiveId, timeSeconds);
float hitTravel;
if (traceSphereInInterval(origin, direction, center, radius, intervalStart, min(intervalEnd, nearest.travel), hitTravel))
{
float3 p = origin + direction * hitTravel;
nearest.hit = true;
nearest.travel = hitTravel;
nearest.normal = normalize(p - center);
nearest.fieldId = primitiveFieldId(primitiveId);
nearest.primitiveId = primitiveId;
}
}
void considerFroxelPrimitiveHits(float3 origin, float3 direction, int froxelIndex, float intervalStart, float intervalEnd, inout SolidHit nearest)
{
if (froxelIndex < 0)
{
return;
}
[unroll]
for (int slotGroup = 0; slotGroup < FROXEL_SLOT_COUNT; slotGroup++)
{
int4 ids = froxelPrimitiveIds[froxelIndex * FROXEL_SLOT_COUNT + slotGroup];
considerPrimitiveHit(origin, direction, ids.x, intervalStart, intervalEnd, nearest);
considerPrimitiveHit(origin, direction, ids.y, intervalStart, intervalEnd, nearest);
considerPrimitiveHit(origin, direction, ids.z, intervalStart, intervalEnd, nearest);
considerPrimitiveHit(origin, direction, ids.w, intervalStart, intervalEnd, nearest);
}
}
SolidHit nearestBinnedSolidHit(float3 origin, float3 direction, float intervalStart, float intervalEnd)
{
SolidHit nearest;
nearest.hit = false;
nearest.travel = intervalEnd;
nearest.normal = 0.0;
nearest.fieldId = 0.0;
nearest.primitiveId = -1;
float3 startPoint = origin + direction * intervalStart;
float3 midPoint = origin + direction * ((intervalStart + intervalEnd) * 0.5);
float3 endPoint = origin + direction * intervalEnd;
considerFroxelPrimitiveHits(origin, direction, froxelIndexForPosition(startPoint), intervalStart, intervalEnd, nearest);
considerFroxelPrimitiveHits(origin, direction, froxelIndexForPosition(midPoint), intervalStart, intervalEnd, nearest);
considerFroxelPrimitiveHits(origin, direction, froxelIndexForPosition(endPoint), intervalStart, intervalEnd, nearest);
return nearest;
}
bool traceGrid(float3 origin, float3 direction, out float travel)
{
travel = farDistance + 1.0;
@ -179,6 +316,51 @@ float mediumSliceTravel(int sliceIndex)
return t * farDistance;
}
float mediumSliceStartTravel(int sliceIndex)
{
return ((float)sliceIndex / (float)MEDIUM_FROXEL_SLICE_COUNT) * farDistance;
}
float mediumSliceEndTravel(int sliceIndex)
{
return (((float)sliceIndex + 1.0) / (float)MEDIUM_FROXEL_SLICE_COUNT) * farDistance;
}
void integrateMediumSlice(
float2 uv,
int sliceIndex,
float intervalFraction,
inout float transmittance,
inout float3 inScattering,
inout float densityMean,
inout float densityTravelSum,
inout float densitySum,
inout float eventTravelSum,
inout float eventSupportSum)
{
float2 atlasUv = mediumAtlasUv(uv, sliceIndex);
float4 diagnostic = mediumVolumeTexture.SampleLevel(gridSampler, atlasUv, 0.0);
float4 transport = mediumTransportTexture.SampleLevel(gridSampler, atlasUv, 0.0);
float4 eventSummary = mediumEventTexture.SampleLevel(gridSampler, atlasUv, 0.0);
float sliceTravel = mediumSliceTravel(sliceIndex);
float fraction = saturate(intervalFraction);
float fullSliceTransmittance = saturate(transport.a);
float sliceExtinction = -log(max(fullSliceTransmittance, 0.0001));
float partialTransmittance = exp(-sliceExtinction * fraction);
float scatterDenominator = max(1.0 - fullSliceTransmittance, 0.0001);
float scatterFraction = (1.0 - partialTransmittance) / scatterDenominator;
float densityContribution = diagnostic.x * fraction;
float eventSupport = saturate(eventSummary.x) * fraction;
densityMean += densityContribution;
densityTravelSum += densityContribution * sliceTravel;
densitySum += densityContribution;
eventTravelSum += eventSupport * sliceTravel;
eventSupportSum += eventSupport;
inScattering += transmittance * transport.rgb * scatterFraction;
transmittance *= saturate(partialTransmittance);
}
void integrateMedium(
float2 uv,
float maxTravel,
@ -203,24 +385,25 @@ void integrateMedium(
[loop]
for (int sliceIndex = 0; sliceIndex < MEDIUM_FROXEL_SLICE_COUNT; sliceIndex++)
{
float sliceTravel = mediumSliceTravel(sliceIndex);
if (sliceTravel > maxTravel)
float intervalStart = mediumSliceStartTravel(sliceIndex);
if (intervalStart >= maxTravel)
{
break;
}
float2 atlasUv = mediumAtlasUv(uv, sliceIndex);
float4 diagnostic = mediumVolumeTexture.SampleLevel(gridSampler, atlasUv, 0.0);
float4 transport = mediumTransportTexture.SampleLevel(gridSampler, atlasUv, 0.0);
float4 eventSummary = mediumEventTexture.SampleLevel(gridSampler, atlasUv, 0.0);
float eventSupport = saturate(eventSummary.x);
densityMean += diagnostic.x;
densityTravelSum += diagnostic.x * sliceTravel;
densitySum += diagnostic.x;
eventTravelSum += eventSupport * sliceTravel;
eventSupportSum += eventSupport;
inScattering += transmittance * transport.rgb;
transmittance *= saturate(transport.a);
float intervalEnd = mediumSliceEndTravel(sliceIndex);
float intervalFraction = saturate((maxTravel - intervalStart) / max(intervalEnd - intervalStart, 0.0001));
integrateMediumSlice(
uv,
sliceIndex,
intervalFraction,
transmittance,
inScattering,
densityMean,
densityTravelSum,
densitySum,
eventTravelSum,
eventSupportSum);
}
densityMean = saturate(densityMean / (float)MEDIUM_FROXEL_SLICE_COUNT);
@ -236,6 +419,84 @@ void integrateMedium(
}
}
RayMarchResult traverseRay(float2 uv, float3 origin, float3 direction)
{
RayMarchResult result;
result.color = float3(0.001, 0.003, 0.004);
result.travel = farDistance + 1.0;
result.fieldId = 0.0;
result.normal = 0.0;
result.coverage = 0.0;
result.mediumOpacity = 0.0;
result.densityMean = 0.0;
float transmittance = 1.0;
float3 inScattering = 0.0;
float densityTravelSum = 0.0;
float densitySum = 0.0;
float eventTravelSum = 0.0;
float eventSupportSum = 0.0;
float densityAccumulation = 0.0;
[loop]
for (int sliceIndex = 0; sliceIndex < MEDIUM_FROXEL_SLICE_COUNT; sliceIndex++)
{
float intervalStart = mediumSliceStartTravel(sliceIndex);
float intervalEnd = mediumSliceEndTravel(sliceIndex);
SolidHit hit = nearestBinnedSolidHit(origin, direction, intervalStart, min(intervalEnd, farDistance));
float intervalFraction = hit.hit
? saturate((hit.travel - intervalStart) / max(intervalEnd - intervalStart, 0.0001))
: 1.0;
integrateMediumSlice(
uv,
sliceIndex,
intervalFraction,
transmittance,
inScattering,
densityAccumulation,
densityTravelSum,
densitySum,
eventTravelSum,
eventSupportSum);
if (hit.hit)
{
float3 p = origin + direction * hit.travel;
float3 bodyColor = shadeBody(p, hit.normal, hit.primitiveId);
result.color = bodyColor * transmittance + inScattering;
result.travel = hit.travel;
result.fieldId = hit.fieldId;
result.normal = hit.normal;
result.coverage = 1.0;
result.mediumOpacity = saturate(1.0 - transmittance);
result.densityMean = saturate(densityAccumulation / (float)MEDIUM_FROXEL_SLICE_COUNT);
return result;
}
}
result.color = result.color * transmittance + inScattering;
result.mediumOpacity = saturate(1.0 - transmittance);
result.densityMean = saturate(densityAccumulation / (float)MEDIUM_FROXEL_SLICE_COUNT);
float transparentEventSupport = saturate(eventSupportSum / (float)MEDIUM_FROXEL_SLICE_COUNT * 4.0);
if (transparentEventSupport > 0.010)
{
result.fieldId = FIELD_ID_TRANSPARENT_EVENT;
result.normal = -direction;
result.coverage = transparentEventSupport;
result.travel = eventSupportSum > 0.0001 ? min(eventTravelSum / eventSupportSum, farDistance) : farDistance;
}
else if (result.mediumOpacity > 0.015)
{
result.fieldId = FIELD_ID_MEDIUM;
result.normal = -direction;
result.coverage = saturate(max(result.mediumOpacity, result.densityMean * 4.0));
result.travel = densitySum > 0.0001 ? min(densityTravelSum / densitySum, farDistance) : farDistance;
}
return result;
}
float3 shadeBody(float3 p, float3 normal, int primitiveId)
{
float3 self = float3(0.0, 0.0, 2.2);
@ -257,79 +518,16 @@ SceneOut D3D12ScenePS(VertexOut input)
float2 pixel = screenUv * resolution;
float3 rayDirection = rayDirectionForPixel(pixel, jitterPixels, cameraPosition, gridCenter);
float travel = farDistance + 1.0;
float3 color = float3(0.001, 0.003, 0.004);
float outputFieldId = 0.0;
float3 outputNormal = 0.0;
float outputCoverage = 0.0;
float hitTravel;
if (traceSphere(cameraPosition, rayDirection, float3(0.0, 0.0, 2.2), SUN_RADIUS, hitTravel))
{
travel = hitTravel;
float3 p = cameraPosition + rayDirection * hitTravel;
outputNormal = normalize(p - float3(0.0, 0.0, 2.2));
color = shadeBody(p, outputNormal, 0);
outputFieldId = FIELD_ID_SELF;
outputCoverage = 1.0;
}
[unroll]
for (int i = 0; i < PLANET_COUNT; i++)
{
float radius = planetRadius(i);
float3 center = planetCenterAt(i, timeSeconds);
if (traceSphere(cameraPosition, rayDirection, center, radius, hitTravel) && hitTravel < travel)
{
travel = hitTravel;
float3 p = cameraPosition + rayDirection * hitTravel;
outputNormal = normalize(p - center);
color = shadeBody(p, outputNormal, i + 1);
outputFieldId = FIELD_ID_PLANET_BASE + (float)i;
outputCoverage = 1.0;
}
}
float densityMean;
float transmittance;
float3 inScattering;
float mediumRepresentativeTravel;
float transparentEventSupport;
float transparentEventTravel;
float mediumTravel = travel <= farDistance ? travel : farDistance;
integrateMedium(
input.uv,
mediumTravel,
densityMean,
transmittance,
inScattering,
mediumRepresentativeTravel,
transparentEventSupport,
transparentEventTravel);
color = color * transmittance + inScattering;
float mediumOpacity = saturate(1.0 - transmittance);
if (outputFieldId < 0.5 && transparentEventSupport > 0.010)
{
outputFieldId = FIELD_ID_TRANSPARENT_EVENT;
outputNormal = -rayDirection;
outputCoverage = transparentEventSupport;
travel = min(transparentEventTravel, farDistance);
}
else if (outputFieldId < 0.5 && mediumOpacity > 0.015)
{
outputFieldId = FIELD_ID_MEDIUM;
outputNormal = -rayDirection;
outputCoverage = saturate(max(mediumOpacity, densityMean * 4.0));
travel = min(mediumRepresentativeTravel, farDistance);
}
RayMarchResult result = traverseRay(input.uv, cameraPosition, rayDirection);
if (renderDebugMode >= 10.5 && renderDebugMode < 11.5)
{
color = lerp(float3(0.006, 0.016, 0.026), float3(0.32, 0.86, 1.0), saturate(densityMean * 6.0));
result.color = lerp(float3(0.006, 0.016, 0.026), float3(0.32, 0.86, 1.0), saturate(result.densityMean * 6.0));
}
SceneOut output;
output.colorTravel = float4(color, min(travel, farDistance + 1.0));
output.metadata = float4(outputFieldId, outputNormal);
output.control = float4(0.0, outputCoverage, mediumOpacity, densityMean);
output.colorTravel = float4(result.color, min(result.travel, farDistance + 1.0));
output.metadata = float4(result.fieldId, result.normal);
output.control = float4(0.0, result.coverage, result.mediumOpacity, result.densityMean);
return output;
}

View file

@ -86,3 +86,4 @@
{"area":"renderer/d3d12/transparent-temporal","lesson":"D3D12 transparent stochastic surfaces now have a generic temporal event summary instead of piggybacking only on bulk medium identity. The medium pass writes a third froxel atlas target carrying transparent event support/density/radiance; the scene pass derives support-weighted travel and emits FIELD_ID_TRANSPARENT_EVENT; the resolve treats that identity as distributed medium-like history. Grid remains just the first producer of this path, not a special transparent surface exception.","files":["src/Aquarium.Engine/Render/D3D12Renderer.cs","src/Aquarium.Engine/Render/Shaders/D3D12Medium.hlsl","src/Aquarium.Engine/Render/Shaders/D3D12Scene.hlsl","src/Aquarium.Engine/Render/Shaders/D3D12Post.hlsl","docs/d3d12-migration.md","docs/hlsl-renderer.md","state/scratch.md"],"verification":["dotnet build Aquarium.Engine.slnx",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4 with AQUARIUM_RENDERER=d3d12 exited 0"],"ts":"2026-05-09"}
{"area":"renderer/d3d12/overlay","lesson":"D3D12 debug overlay parity uses the official D3D11On12 bridge to preserve native DirectWrite/Direct2D hinted text. The D3D12 frame graph owns scene rendering and leaves the backbuffer as a render target; the overlay briefly acquires the current wrapped swapchain image, draws the shared retained DebugUi, releases it to Present, and marks the tracked resource state. Keep this bridge narrow and overlay-only; diegetic text remains MSDF/SDF renderer work.","files":["src/Aquarium.Engine/Render/D3D12Renderer.cs","src/Aquarium.Engine/Render/D3D12TrackedResource.cs","docs/d3d12-migration.md","docs/hlsl-renderer.md","state/scratch.md"],"verification":["dotnet build Aquarium.Engine.slnx",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4 -HeadlessTimeoutSeconds 30 with AQUARIUM_RENDERER=d3d12 and AQUARIUM_RENDER_DEBUG_MODE=0 exited 0",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4 -HeadlessTimeoutSeconds 30 with AQUARIUM_RENDERER=d3d12 and AQUARIUM_RENDER_DEBUG_MODE=11 exited 0"],"ts":"2026-05-09"}
{"area":"renderer/d3d12/parity","lesson":"D3D12 is now the default Aquarium renderer. D3D11 remains selectable as the temporary reference backend, but host startup uses D3D12 unless --renderer or AQUARIUM_RENDERER overrides it. The D3D12 backend reports once-per-second steady-state CPU timing averages for total frame work, command-list recording, and the DirectWrite overlay bridge after skipping warmup frames so the bridge cost has a useful receipt while GPU timestamp instrumentation is still pending.","files":["src/Aquarium.Engine/AquariumHost.cs","src/Aquarium.Engine/Render/D3D12Renderer.cs","docs/d3d12-migration.md","docs/hlsl-renderer.md","docs/d3d12-best-practices-audit.md","state/scratch.md"],"verification":["dotnet build Aquarium.Engine.slnx",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4 -HeadlessTimeoutSeconds 30 without AQUARIUM_RENDERER exited 0 and logged D3D12 device/swapchain creation",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4 -HeadlessTimeoutSeconds 30 with AQUARIUM_RENDERER=d3d11 exited 0"],"ts":"2026-05-09"}
{"area":"renderer/d3d12/unified-traversal","lesson":"D3D12 scene composition now uses one bounded ray interval traversal for solids, medium transport, and transparent events. Each interval samples medium/event transport, checks conservative start/mid/end froxel primitive bins for solid candidates, integrates partial transport up to the first opaque hit, and emits one ordered temporal packet. Current solid evaluators are analytic spheres, but future SDF surfaces should replace that evaluator inside this traversal rather than reintroducing a separate solid pass.","files":["src/Aquarium.Engine/Render/Shaders/D3D12Scene.hlsl","docs/d3d12-migration.md","docs/d3d12-best-practices-audit.md","docs/hlsl-renderer.md","state/scratch.md"],"verification":["dotnet build Aquarium.Engine.slnx",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4 -HeadlessTimeoutSeconds 30 with default D3D12 final mode exited 0",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4 -HeadlessTimeoutSeconds 30 with default D3D12 field-identity mode exited 0"],"ts":"2026-05-09"}

View file

@ -347,3 +347,10 @@ the cut.
once-per-second CPU timing averages for whole frame, command-list recording,
and DirectWrite overlay bridge cost. These are CPU timings, not GPU timestamp
query timings.
- D3D12 unified traversal foothold: `D3D12Scene.hlsl` now uses one bounded ray
interval traversal for solid candidates, medium transport, and transparent
events. Each interval samples transport, checks conservative start/mid/end
froxel primitive bins for solid candidates, integrates partial transport up
to a hit, then stops on the nearest opaque surface. Current solid evaluators
are analytic spheres; future SDF surfaces should replace that evaluator
inside this traversal rather than creating a second solid pass.