Decouple transparent tubes from world broadphase
This commit is contained in:
parent
1c0c9d4198
commit
c57f39e76b
2 changed files with 23 additions and 27 deletions
|
|
@ -805,43 +805,38 @@ RayMarchResult traverseRay(float2 uv, float3 origin, float3 direction)
|
|||
float froxelEnter;
|
||||
float froxelExit;
|
||||
bool hasFroxelTube = traceFroxelBounds(origin, direction, froxelEnter, froxelExit);
|
||||
if (!hasFroxelTube)
|
||||
{
|
||||
integrateMediumRange(uv, 0.0, farDistance, transmittance, inScattering, densityAccumulation, densityTravelSum, densitySum);
|
||||
result.color = result.color * transmittance + inScattering;
|
||||
result.mediumOpacity = saturate(1.0 - transmittance);
|
||||
result.densityMean = saturate(densityAccumulation / (float)MEDIUM_FROXEL_SLICE_COUNT);
|
||||
return result;
|
||||
}
|
||||
|
||||
SolidHit nearestSolid;
|
||||
nearestSolid.hit = false;
|
||||
nearestSolid.travel = farDistance;
|
||||
nearestSolid.normal = 0.0;
|
||||
nearestSolid.fieldId = 0.0;
|
||||
nearestSolid.primitiveId = -1;
|
||||
FroxelDda dda = beginFroxelDda(origin, direction, froxelEnter, froxelExit);
|
||||
float cellStart = froxelEnter;
|
||||
[loop]
|
||||
for (int ddaStep = 0; ddaStep < 64 && dda.active != 0; ddaStep++)
|
||||
|
||||
if (hasFroxelTube)
|
||||
{
|
||||
float cellEnd = froxelDdaCellExit(dda);
|
||||
if (cellEnd <= cellStart + 0.00001)
|
||||
FroxelDda dda = beginFroxelDda(origin, direction, froxelEnter, froxelExit);
|
||||
float cellStart = froxelEnter;
|
||||
[loop]
|
||||
for (int ddaStep = 0; ddaStep < 64 && dda.active != 0; ddaStep++)
|
||||
{
|
||||
advanceFroxelDda(dda);
|
||||
float cellEnd = froxelDdaCellExit(dda);
|
||||
if (cellEnd <= cellStart + 0.00001)
|
||||
{
|
||||
advanceFroxelDda(dda);
|
||||
cellStart = cellEnd;
|
||||
continue;
|
||||
}
|
||||
|
||||
int froxelIndex = froxelIndexForCell(dda.cell);
|
||||
SolidHit cellSolid = nearestFroxelSolidHit(origin, direction, froxelIndex, cellStart, min(cellEnd, nearestSolid.travel));
|
||||
if (cellSolid.hit && cellSolid.travel < nearestSolid.travel)
|
||||
{
|
||||
nearestSolid = cellSolid;
|
||||
}
|
||||
|
||||
cellStart = cellEnd;
|
||||
continue;
|
||||
advanceFroxelDda(dda);
|
||||
}
|
||||
|
||||
int froxelIndex = froxelIndexForCell(dda.cell);
|
||||
SolidHit cellSolid = nearestFroxelSolidHit(origin, direction, froxelIndex, cellStart, min(cellEnd, nearestSolid.travel));
|
||||
if (cellSolid.hit && cellSolid.travel < nearestSolid.travel)
|
||||
{
|
||||
nearestSolid = cellSolid;
|
||||
}
|
||||
|
||||
cellStart = cellEnd;
|
||||
advanceFroxelDda(dda);
|
||||
}
|
||||
|
||||
TransparentEvent nearestTransparent;
|
||||
|
|
|
|||
|
|
@ -92,3 +92,4 @@
|
|||
{"area":"renderer/d3d12/reload","lesson":"D3D12 shader/PSO creation must not block the startup/main-thread path. The renderer now starts shader pipeline builds on a background task, presents a lightweight loading clear until the first pipeline set is ready, polls editable D3D12 shader files for hot reload, swaps completed pipeline sets on the render thread after a GPU wait, and preserves the previous set on failure. Headless verification waits for a ready rendered frame and uses a separate headless CultCache to avoid colliding with the visible dev window.","files":["src/Aquarium.Engine/Render/D3D12Renderer.cs","src/Aquarium.Engine/Render/IAquariumRenderer.cs","src/Aquarium.Engine/Render/D3D11Renderer.cs","src/Aquarium.Engine/AquariumHost.cs","scripts/dev-reload.ps1","docs/d3d12-migration.md","state/memory.json","state/scratch.md"],"verification":["dotnet build Aquarium.Engine.slnx",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4 -HeadlessTimeoutSeconds 90 exited 0 after logging D3D12 shader pipelines ready","headless long-run with AQUARIUM_HEADLESS_READY_FRAMES=3000 touched D3D12Post.hlsl timestamp, logged D3D12 shader pipeline build started (hot reload), then logged D3D12 shader hot reload applied with empty stderr"],"ts":"2026-05-09"}
|
||||
{"timestamp":"2026-05-09T20:42:27.8430452+01:00","topic":"d3d12-froxel-transparent-surfaces","lesson":"Fixed view-travel slices are not a froxel traversal. Transparent Grid/particle surfaces need candidate discovery by spatial froxel DDA with exact cell intervals, event selection/deduplication, and shading/filtering after the canonical event is chosen so ddx/ddy are not evaluated inside divergent traversal. The headless smoke timeout must track the ready-frame contract; debug D3D12 PSO compilation can exceed 15 seconds while the app intentionally presents the loading frame.","files":["src/Aquarium.Engine/Render/Shaders/D3D12Scene.hlsl","scripts/dev-reload.ps1","state/memory.json","state/scratch.md"],"verification":["dotnet build Aquarium.Engine.slnx",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4"]}
|
||||
{"timestamp":"2026-05-09T21:01:42.6014332+01:00","topic":"d3d12-view-froxel-transparent-surfaces","lesson":"Transparent surfaces must be binned into the view-froxel tube marched by the scene ray, not into the coarse 8x8x4 world broadphase. Aquarium now bootstraps this with a CPU-filled candidate buffer indexed by low-res screen cell and depth slice; this proves the topology, but the lasting implementation should be a GPU/raster binning pass to avoid large per-frame uploads.","files":["src/Aquarium.Engine/Render/D3D12Renderer.cs","src/Aquarium.Engine/Render/Shaders/D3D12Scene.hlsl","src/Aquarium.Engine/Render/D3D12ResourceRegistry.cs","state/memory.json","state/scratch.md"]}
|
||||
{"timestamp":"2026-05-09T21:13:51.8362280+01:00","topic":"d3d12-view-froxel-transparent-lookup","lesson":"View-froxel transparent lookup must not depend on the coarse world broadphase. A ray that misses the legacy 8x8x4 solid broadphase can still have valid transparent/medium candidates in its screen-space tube; only solid lookup should be gated by the world broadphase hit.","files":["src/Aquarium.Engine/Render/Shaders/D3D12Scene.hlsl"]}
|
||||
|
|
|
|||
Loading…
Reference in a new issue