Document dominant light direction limits
This commit is contained in:
parent
f1ff530ecb
commit
ffdfa72701
4 changed files with 9 additions and 4 deletions
|
|
@ -136,3 +136,4 @@
|
|||
{"timestamp":"2026-05-10T16:05:00+01:00","topic":"d3d12-lighting-sanitation","lesson":"Do not keep dead lighting math in the live medium pass. D3D12 final integration reads density/transmittance plus the propagated froxel light target; the old phase-scattered direct radiance path into `transport.rgb` was unused and has been cut. Docs/state must describe the current direct-traced Grid event lane, not the removed transparent-froxel Grid experiment.","files":["src/Aquarium.Engine/Render/Shaders/D3D12Medium.hlsl","src/Aquarium.Engine/Render/Shaders/D3D12Scene.hlsl","docs/d3d12-best-practices-audit.md","docs/d3d12-migration.md","docs/hlsl-renderer.md","state/map.yaml","state/memory.json","state/scratch.md"],"verification":["dotnet build Aquarium.Engine.slnx --no-restore",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4 -HeadlessTimeoutSeconds 90"]}
|
||||
{"timestamp":"2026-05-10T16:25:00+01:00","topic":"d3d12-physical-medium-coefficients","lesson":"Aquarium medium math should justify where light comes from before beauty tuning. D3D12 froxels now carry explicit density, extinction sigma_t, scattering sigma_s, albedo, slice transmittance, and raw emitter irradiance. Scene integration uses Beer-Lambert transmittance and isotropic single scattering sigma_s * irradiance / 4pi; direct ray transmittance debug uses the same coefficient evaluator. mediumTerms now means x extinction-per-density, y scattering albedo, z reserved phase/aniso, w density scale.","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","src/Aquarium.Engine/Render/Shaders/D3D12Smoke.hlsl","docs/hlsl-renderer.md","docs/sdf-field-renderer-plan.md","state/memory.json","state/scratch.md"],"verification":["dotnet build Aquarium.Engine.slnx --no-restore",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4 -HeadlessTimeoutSeconds 90"]}
|
||||
{"timestamp":"2026-05-10T16:38:53.8578765+01:00","topic":"D3D12 directional medium lighting","lesson":"Medium lighting needs explicit directional/probe data once phase and glossy surfaces matter. Aquarium now carries a luminance-weighted dominant-light direction moment beside propagated froxel irradiance, uses it for Henyey-Greenstein scattering, and shades solids from the same field instead of private direct emitter loops.","files":["src/Aquarium.Engine/Render/Shaders/D3D12Medium.hlsl","src/Aquarium.Engine/Render/Shaders/D3D12Scene.hlsl","src/Aquarium.Engine/Render/D3D12Renderer.cs"]}
|
||||
{"timestamp":"2026-05-10T16:49:14.2607265+01:00","topic":"Dominant-light direction limitation","lesson":"A single froxel light direction is a lossy artistic approximation. Intersecting beams average, and opposed beams can cancel to low confidence and isotropic fallback. Keep the smear for now because it may look good, but future full transport needs multi-lobe, probe, or reservoir direction storage.","files":["state/memory.json","state/map.yaml","state/scratch.md"]}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ renderer_state:
|
|||
- Splash screen with bundled app icon and GameCult typefaces.
|
||||
next:
|
||||
- Replace CPU bootstrap view-froxel binning with GPU/raster binning before primitive/event counts scale.
|
||||
- Evolve the dominant-light direction field into richer probe lighting once multiple emitters and glossy SDFs need more than one direction.
|
||||
- Evolve the dominant-light direction field into richer probe lighting once multiple emitters, crossing beams, or glossy SDFs need more than one direction. Until then, the one-direction smear is accepted as an artistic approximation.
|
||||
- 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.
|
||||
- Add volumetrics as an explicit renderer-owned field pass, starting from Wronski/Hillaire-style frustum volume lighting with Self as the first emitter.
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
"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 non-terminating stochastic event before the nearest solid. Grid must not write the surface packet. Medium has a separate temporal packet even when a solid is behind it; Grid/particles have a separate stochastic-event color+metadata history lane. 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. For a single Grid event, emit expected premultiplied event radiance from analytic coverage; do not blue-noise dither one sample into visible grain. Blue-noise stochastic selection belongs in the future multi-event chooser when several transparent samples compete for one ray/pixel.",
|
||||
"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.",
|
||||
"Mouse/cursor-owned SDF bodies need object-motion reprojection. Carry current and previous cursor world anchors through frame constants and reproject cursor hits from current center to previous center, just like orbiting planets. The current cursor body uses the MathWorld teardrop curve profile with m=6, revolved around vertical: x=cos(t), y=sin(t)*sin^m(t/2), so radius from vertical x is `sqrt(1 - x^2) * ((1 - x) / 2)^3`. Cursor latitudinal ripples belong in the SDF radius function first; material is brass GGX metal with brass-tinted F0, no diffuse metal term, non-emissive, and no ambient floor. Diffuse/body light comes from the froxel light field; glossy cursor specular still uses direct emitter evaluation until Aquarium owns directional/probe lighting. Keep the shader bound radius and CPU froxel bound radius matched. Profile fields are not automatically distance fields; for this hot profile path, prefer conservative step scale and cheap polynomial pieces over sampled profile distance, numeric slope probes, or fractional `pow`, all of which can stall D3D12 shader pipeline compilation.",
|
||||
"Mouse/cursor-owned SDF bodies need object-motion reprojection. Carry current and previous cursor world anchors through frame constants and reproject cursor hits from current center to previous center, just like orbiting planets. The current cursor body uses the MathWorld teardrop curve profile with m=6, revolved around vertical: x=cos(t), y=sin(t)*sin^m(t/2), so radius from vertical x is `sqrt(1 - x^2) * ((1 - x) / 2)^3`. Cursor latitudinal ripples belong in the SDF radius function first; material is brass GGX metal with brass-tinted F0, no diffuse metal term, non-emissive, and no ambient floor. Diffuse/body light and glossy cursor specular come from the froxel light field. Keep the shader bound radius and CPU froxel bound radius matched. Profile fields are not automatically distance fields; for this hot profile path, prefer conservative step scale and cheap polynomial pieces over sampled profile distance, numeric slope probes, or fractional `pow`, all of which can stall D3D12 shader pipeline compilation.",
|
||||
"Heavy/specialized SDF evaluators should not live inside the generic packed primitive-id hit helper when that helper is called for every int4 component. Detect specialized ids in the froxel loop and invoke the evaluator once per relevant froxel; otherwise the shader compiler clones the path into a startup-time punishment device.",
|
||||
"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. During initial startup, D3D12 should not touch or present the swapchain until the first pipeline set is ready; the host keeps repainting the Win32 splash instead. This can flicker slightly, but it avoids black loading frames and stale DirectWrite loading text in live backbuffers. Hot reload keeps the previous pipeline set if compilation fails.",
|
||||
|
|
@ -52,7 +52,7 @@
|
|||
"HDR/PBR presentation should follow research/rendering/hdr-pbr-presentation.md: scene-linear lighting, explicit exposure, pre-tonemap bloom/veil, then a display transform. Do not reach for 2000s threshold bloom when the frame needs dynamic range.",
|
||||
"Aquarium's current HDR presentation pass uses fixed manual exposure plus a three-level half/quarter/eighth pre-tonemap bloom pyramid with firefly-safe downsampling and separable blur. Next HDR work is persisted exposure/display controls, not threshold glow.",
|
||||
"Future volumetric lighting should be a field sampled consistently by terrain, planets, fog, particles, and diegetic UI. Do not fake only the planet term if the scene is supposed to bounce light.",
|
||||
"Volumetric density must not self-illuminate through baked color. D3D12 medium lighting now evaluates physical-ish coefficients first: density for inspection, extinction sigma_t, scattering sigma_s, and albedo. Field mediumTerms mean x = extinction per density, y = scattering albedo, z = reserved phase/aniso, w = density scale. Raw irradiance from FieldFlags.Emitter instances is injected using emitter colorIntensity.rgb, finite solid angle, and cheap depth/radial light-path attenuation; a separate propagation pass transports both irradiance and a luminance-weighted dominant-light direction moment. Medium integration uses Beer-Lambert transmittance and Henyey-Greenstein phase from that direction field; solids consume the propagated froxel light/direction for diffuse and cursor GGX specular. Do not compute unused direct-scattering color into transport targets or private per-surface emitter loops just because an earlier pass did. Self, cursor, nebulae, and future emissive SDFs must all use this field-emitter path; do not reintroduce point-light constants or ambient fog glow.",
|
||||
"Volumetric density must not self-illuminate through baked color. D3D12 medium lighting now evaluates physical-ish coefficients first: density for inspection, extinction sigma_t, scattering sigma_s, and albedo. Field mediumTerms mean x = extinction per density, y = scattering albedo, z = reserved phase/aniso, w = density scale. Raw irradiance from FieldFlags.Emitter instances is injected using emitter colorIntensity.rgb, finite solid angle, and cheap depth/radial light-path attenuation; a separate propagation pass transports both irradiance and a luminance-weighted dominant-light direction moment. Medium integration uses Beer-Lambert transmittance and Henyey-Greenstein phase from that direction field; solids consume the propagated froxel light/direction for diffuse and cursor GGX specular. A single direction moment is intentionally lossy: crossing beams smear or cancel to low confidence and fall back toward isotropic scattering. Keep it for now if the smear is useful, but do not mistake it for final transport; future richer lighting needs multi-lobe/probe/reservoir direction storage. Do not compute unused direct-scattering color into transport targets or private per-surface emitter loops just because an earlier pass did. Self, cursor, nebulae, and future emissive SDFs must all use this field-emitter path; do not reintroduce point-light constants or ambient fog glow.",
|
||||
"Do not blend D3D12 medium color history into final presentation until the renderer owns a proper light-volume/medium reprojection contract. Medium packets can keep opacity/density/travel age for diagnostics, but resolved fog color history smears badly when injected lighting changes with camera/emitter geometry.",
|
||||
"D3D12 medium radiance has its own temporal lane: scene emits `sceneMediumColor`, resolve keeps surface history surface-only, reprojects medium packet travel into `historyMediumColor`, validates by travel/opacity/density, and composites resolved surface + resolved medium + events. Medium lighting is split into raw emitter injection and a propagated froxel light target; medium integration and solid diffuse shading consume the propagated light field instead of private direct diffuse loops. This is single-step froxel propagation plus reprojection; full multi-bounce GI and directional/probe glossy lighting remain future work.",
|
||||
"Volumetric design must start from research/volumetrics/synthesis.md. The first pass should follow Wronski/Hillaire production shape: explicit low-resolution frustum volume, injected density/extinction/scattering, Self as first emitter, front-to-back transmittance/in-scattering integration, then consistent composition.",
|
||||
|
|
|
|||
|
|
@ -513,4 +513,8 @@ reusing field identity/travel/control.
|
|||
instead of pretending every froxel is isotropic. Planets and the cursor sample
|
||||
the same froxel light/direction field; the old cursor-only direct emitter
|
||||
specular loop has been cut. Debug mode `13` visualizes propagated froxel light
|
||||
direction.
|
||||
direction. This is deliberately lossy: two beams crossing in one froxel smear
|
||||
into an averaged direction, and opposed beams can cancel toward low-confidence
|
||||
isotropic scatter. Let that artistic smear stand for now; future proper
|
||||
transport should use multi-lobe/probe/reservoir direction storage when this
|
||||
becomes the limiting artifact.
|
||||
|
|
|
|||
Loading…
Reference in a new issue