Animate blue noise grid coverage per pixel
This commit is contained in:
parent
db94ade4c1
commit
a59a8c261b
4 changed files with 8 additions and 3 deletions
|
|
@ -99,7 +99,9 @@ VertexOut FullscreenTriangleVS(uint vertexId : SV_VertexID)
|
|||
|
||||
float stochasticTransparency(float2 screenUv, float alpha)
|
||||
{
|
||||
float2 ditherUv = screenUv * (resolution / DITHER_TEXTURE_SIZE);
|
||||
float2 screenPixel = floor(screenUv * resolution);
|
||||
float2 frameOffset = floor(frac(frameIndex * float2(0.754877666, 0.569840296)) * DITHER_TEXTURE_SIZE);
|
||||
float2 ditherUv = (screenPixel + frameOffset + 0.5) / DITHER_TEXTURE_SIZE;
|
||||
float dither = ditherTexture.SampleLevel(ditherSampler, ditherUv, 0.0).r;
|
||||
return alpha - dither - 0.001 * (1.0 - ceil(alpha));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,3 +102,4 @@
|
|||
{"timestamp":"2026-05-09T22:18:03.0000000+01:00","topic":"d3d12-grid-stochastic-retreat","lesson":"The D3D12 transparent froxel candidate experiment made the Grid angle-dependent, spiky, and brittle. The Grid should follow the proven D3D11 contract: trace it directly as a stochastic surface before the nearest solid, write Grid identity/travel/normal/coverage for TAA, and do not leave dead transparent-surface binning code in the renderer. Git is the archive.","files":["src/Aquarium.Engine/Render/D3D12Renderer.cs","src/Aquarium.Engine/Render/Shaders/D3D12Scene.hlsl","src/Aquarium.Engine/Render/Shaders/D3D12Post.hlsl","state/memory.json","state/scratch.md"]}
|
||||
{"timestamp":"2026-05-09T22:30:46.5567253+01:00","topic":"d3d12-grid-width-stochastic-reference","lesson":"The D3D11 reference Grid used periodic line domains with fwidth() and pixel-width constants for stable line width. The D3D12 world-space ddx/ddy footprint made width angle-dependent. D3D12 now uses the D3D11 line/contour/field-line width math and a screen-pixel-stable hash dither; the remaining quality gap is binding Aetheria blue-noise texture for proper stochastic transparency.","files":["src/Aquarium.Engine/Render/Shaders/D3D12Scene.hlsl","state/memory.json","state/scratch.md"]}
|
||||
{"timestamp":"2026-05-09T22:43:12.0000000+01:00","topic":"d3d12-grid-blue-noise-dither","lesson":"D3D12 Grid stochastic coverage now uses Aetheria's copied 512x512 R8 blue-noise texture instead of a hash. The texture is uploaded once to a default-heap R8_UNorm resource, exposed through a transient SRV at t15, and sampled point/wrap at s1 in screen space without a frame-wide animated seed so per-pixel coverage stays stable for TAA.","files":["src/Aquarium.Engine/Render/D3D12Renderer.cs","src/Aquarium.Engine/Render/Shaders/D3D12Scene.hlsl","state/memory.json","state/scratch.md"]}
|
||||
{"timestamp":"2026-05-09T22:55:27.0000000+01:00","topic":"d3d12-grid-temporal-blue-noise","lesson":"Stable blue-noise dithering is too static for TAA to converge stochastic Grid coverage. The failure mode to avoid is global threshold flicker where all pixels toggle together. Use a per-frame low-discrepancy pixel offset into the blue-noise tile so each pixel changes threshold over time while the spatial mask remains decorrelated.","files":["src/Aquarium.Engine/Render/Shaders/D3D12Scene.hlsl","state/memory.json","state/scratch.md"]}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
"D3D12 Grid height must be brush-rendered, not a fullscreen per-texel loop over bodies. Use a top-down Grid-space orthographic brush pass: base field draw, then one additive up-facing quad per body into a scalar R16_Float height target. Height is one value; do not spend extra channels unless the pass contract actually gains more data. Do not use R32G32B32A32_Float for additive brush composition.",
|
||||
"D3D12 field data should live in default-heap structured buffers, updated from the per-frame upload ring by CopyBufferRegion, then bound through transient SRV descriptors owned by the consuming pass. Do not make shaders read dynamic field tables straight from upload memory. D3D11 is reference-only during migration; do not pay DRY tax to preserve it.",
|
||||
"Do not put the D3D12 Grid through transparent froxel candidate/event traversal. The one-pass transparent binning experiment made the Grid angle-dependent and brittle. The live Grid contract is direct scene tracing as a stochastic surface before the nearest solid, writing Grid identity/travel/normal/coverage for TAA accumulation. Git holds the old experiment; runtime code should stay lean.",
|
||||
"D3D12 Grid line width normalization should match the D3D11 reference: use periodic line domains with `fwidth()` and pixel-width constants, not world-space `ddx/ddy(p.xy)` footprint guesses. D3D12 binds Aetheria's 512x512 R8 blue-noise texture at `t15` with point/wrap sampling at `s1` for screen-space stochastic coverage; keep it screen-stable unless temporal animation is deliberately designed.",
|
||||
"D3D12 Grid line width normalization should match the D3D11 reference: use periodic line domains with `fwidth()` and pixel-width constants, not world-space `ddx/ddy(p.xy)` footprint guesses. D3D12 binds Aetheria's 512x512 R8 blue-noise texture at `t15` with point/wrap sampling at `s1` for stochastic coverage. Animate it by shifting the blue-noise tile per frame with a low-discrepancy pixel offset, not by giving all pixels the same threshold.",
|
||||
"D3D12 solid scene candidate discovery belongs in the view-froxel volume. At 720p the active tube is 160x90x32; primitive ids are indexed by low-res screen cell and depth slice, then scene rays test exact solid intersections inside that slice interval. The CPU-filled view-froxel buffers are bootstrap only; the durable path should become GPU/raster binning so per-frame upload bandwidth does not become the next stupid tax.",
|
||||
"D3D12 pixel shader UAV registers share the output namespace. If a shader writes SV_Target0, bind the first manual UAV at u1, not u0.",
|
||||
"D3D12 shader routing derives its editable source directory from --shader-source/AQUARIUM_SHADER_SOURCE, then watches D3D12Grid/Medium/Scene/Post/Smoke HLSL files directly. Shader/PSO builds run on a background task; startup presents a lightweight loading frame until the first pipeline set is ready, and hot reload keeps the previous pipeline set if compilation fails.",
|
||||
|
|
|
|||
|
|
@ -21,7 +21,9 @@ as dead scaffolding. D3D12 Grid line width now mirrors the D3D11 reference:
|
|||
periodic domains use `fwidth()` and pixel-width constants instead of world-space
|
||||
`ddx/ddy` footprint guesses. The stochastic mask now samples Aetheria's copied
|
||||
512x512 R8 blue-noise texture in screen space through D3D12 `t15/s1`, point and
|
||||
wrap sampled, without a frame-wide animation seed.
|
||||
wrap sampled. It shifts the blue-noise tile by a low-discrepancy pixel offset
|
||||
each frame so TAA sees temporal coverage variation without all pixels toggling
|
||||
together.
|
||||
|
||||
## Hot Context
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue