Commit graph

7 commits

Author SHA1 Message Date
dac63e3be5 Phase 6.2: toping BLAS shadows + adaptive TMin + perf optimization
- Re-enable toping BLAS in TLAS (3 instances: blocky + smooth + topings)
  with PREFER_FAST_TRACE for optimized BVH traversal (23M tris)
- Separate shadow/AO ray origins: shadow uses worldPos directly (zero bias),
  AO keeps normal bias (0.15) for hemisphere self-avoidance
- Adaptive TMin solves self-hit vs gap dilemma:
  ground (N.y≈1) → TMin=0.002 for tight blade shadows,
  blade surfaces (N.y≈0) → TMin=0.10 to skip own geometry
- Shadow rays 4→3 with tight cone (0.012 rad), AO rays 8→4
  (7 total rays/pixel, temporal accumulation compensates)
- Remove screen-space contact shadows (doesn't work for thin geometry)
2026-03-30 13:58:57 +02:00
3d0c4f2f80 Phase 4.2+7: grass blade rework + soft RT shadows + toping BLAS optimization
Grass blades:
- Leaf-shaped profile (4 sections: base→belly→taper→tip) instead of spiky triangles
- Wider blades (base 0.055-0.095), more spacing between blades (±0.07 scatter)
- Natural green texture (50,140,35 → 80,180,55) instead of neon lime
- Reduced warm shift and removed artificial saturation boost
- Side faces at 60% brightness (dark green) instead of 38% (near-black)

Soft RT shadows:
- 2 jittered shadow rays per pixel with IGN+Cranley-Patterson temporal variation
- 2.3° cone around sun direction for soft penumbra
- Gradual shadow factor (0-100%) instead of binary on/off

Performance:
- Toping BLAS removed from TLAS (23M+ tris caused massive ray traversal slowdown)
- Toping BLAS position/index buffer construction skipped entirely
- Shadow rays reduced from 4 to 2 (temporal accumulation compensates)
2026-03-29 19:46:25 +02:00
82307269e8 Phase 7.1 tuning: reduce saturation, increase contrast, multi-angle screenshots
- Saturation 1.40→1.15, exposure 2.2→1.8 (less oversaturated)
- Shadow factor 0.55→0.45 (more contrast between lit and shadow)
- Ambient reduced slightly for better contrast
- Screenshot mode: 4 camera views (landscape, sideview, topdown, backlit)
- AO history reset between view changes (prevents temporal contamination)
2026-03-29 15:11:42 +02:00
55c67686f2 Phase 7.1: stylized lighting — hemisphere ambient, colored shadows, rim light, tone mapping
Wonderbox-inspired lighting overhaul across all 3 pixel shaders:
- Hemisphere ambient (sky blue above, warm brown below) replaces flat ambient
- RT shadows lerp toward blue-violet tint instead of plain darkening (factor 0.55)
- Rim light (fresnel) with warm golden color on silhouettes (30% on vegetation)
- Soft exponential tone mapping + saturation boost in final post-process pass
- CB parameters for all lighting values (skyAmbient, groundAmbient, shadowTint, etc.)
- Fog color/density centralized from CB instead of hardcoded per-shader
- Screenshot mode (CLI "screenshot"): fixed camera, AO convergence, auto-capture
- AO noise stability: world-space hash using voxel center + tangent-axis frac position
- AO distance-weighted falloff: continuous occlusion values instead of binary hit/miss
2026-03-29 15:00:12 +02:00
40560c25ef Phase 6.3: temporal accumulation + IGN noise for RT AO
- Interleaved Gradient Noise replaces world-space hash for ray sampling
- Cranley-Patterson rotation (golden ratio × frameIndex) per frame
- Temporal accumulation: blend 5% current + 95% reprojected history (~20 frames)
- aoHistoryTexture_ persists between frames, copy pre-blur for next frame
- prevViewProjection added to VoxelCB for screen-space reprojection
- Push constants: frameIndex + historyValid for temporal control
- Result: nearly noise-free AO with only 8 rays per pixel
2026-03-29 09:55:08 +02:00
9de53e5293 Phase 6.3: RT ambient occlusion with bilateral blur
- 8 cosine-weighted hemisphere rays per pixel (inline ray queries, SM 6.5)
- Distance-weighted AO: quadratic falloff (1-hitT/aoRadius)² instead of binary hit/miss
- World-space hash seed: voxel coord + tangent-plane frac position (stable, no flicker)
- Bilateral blur pipeline: 2-pass separable (H+V), radius 6, depth+normal edge-stopping
- 4-pass dispatch: shadow+rawAO → blur H → blur V → apply
- AO written to separate R8_UNORM texture, blurred, then applied to color buffer
- Debug mode (F5 x3): grayscale AO visualization
2026-03-29 09:31:19 +02:00
6b41da0932 Phase 6.2: RT shadows — inline ray queries with BLAS/TLAS fix
Add shadow compute shader (voxelShadowCS.hlsl) that traces rays toward
the sun using DXR inline ray queries (RayQuery<>, SM 6.5). Shadows
modulate voxelRT_ in-place via RWTexture2D (no extra render target).

Key fixes to Phase 6.1 BLAS/TLAS infrastructure:
- Sequential index buffer required: Wicked treats IndexCount=0 with
  non-null IndexBuffer as "0 indexed triangles" → empty BLAS
- Memory barriers between BLAS→TLAS→RT: without GPUBarrier::Memory()
  the TLAS build races with BLAS builds, causing zero ray hits
- inverseViewProjection added to VoxelCB for depth reconstruction

F5 toggles shadows OFF→ON→DEBUG (red=hit, green=miss, blue=backface).
2026-03-28 20:01:18 +01:00