Kelsidavis-WoWee/tests
Pavel Okhlopkov 4b9b3026f4 feat(rendering): add HiZ occlusion culling & fix WMO interior shadows
Implement GPU-driven Hierarchical-Z occlusion culling for M2 doodads
using a depth pyramid built from the previous frame's depth buffer.
The cull shader projects bounding spheres via prevViewProj (temporal
reprojection) and samples the HiZ pyramid to reject hidden objects
before the main render pass.

Key implementation details:
- Separate early compute submission (beginSingleTimeCommands + fence
  wait) eliminates 2-frame visibility staleness
- Conservative safeguards prevent false culls: screen-edge guard,
  full VP row-vector AABB projection (Cauchy-Schwarz), 50% sphere
  inflation, depth bias, mip+1, min screen size threshold, camera
  motion dampening (auto-disable on fast rotations), and per-instance
  previouslyVisible flag tracking
- Graceful fallback to frustum-only culling if HiZ init fails

Fix dark WMO interiors by gating shadow map sampling on isInterior==0
in the WMO fragment shader. Interior groups (flag 0x2000) now rely
solely on pre-baked MOCV vertex-color lighting + MOHD ambient color.
Disable interiorDarken globally (was incorrectly darkening outdoor M2s
when camera was inside a WMO). Use isInsideInteriorWMO() instead of
isInsideWMO() for correct indoor detection.

New files:
- hiz_system.hpp/cpp: pyramid image management, compute pipeline,
  descriptors, mip-chain build dispatch, resize handling
- hiz_build.comp.glsl: MAX-depth 2x2 reduction compute shader
- m2_cull_hiz.comp.glsl: frustum + HiZ occlusion cull compute shader
- test_indoor_shadows.cpp: 14 unit tests for shadow/interior contracts

Modified:
- CullUniformsGPU expanded 128->272 bytes (HiZ params, viewProj,
  prevViewProj)
- Depth buffer images gain VK_IMAGE_USAGE_SAMPLED_BIT for HiZ reads
- wmo.frag.glsl: interior branch before unlit, shadow skip for 0x2000
- Render graph: hiz_build + compute_cull disabled (run in early compute)
- .gitignore: ignore compiled .spv binaries
- MEGA_BONE_MAX_INSTANCES: 2048 -> 4096

Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
2026-04-06 16:40:59 +03:00
..
CMakeLists.txt feat(rendering): add HiZ occlusion culling & fix WMO interior shadows 2026-04-06 16:40:59 +03:00
test_activity_fsm.cpp feat(animation): decompose AnimationController into FSM-based architecture 2026-04-05 12:27:35 +03:00
test_anim_capability.cpp feat(animation): decompose AnimationController into FSM-based architecture 2026-04-05 12:27:35 +03:00
test_animation_ids.cpp feat(animation): decompose AnimationController into FSM-based architecture 2026-04-05 12:27:35 +03:00
test_blp_loader.cpp feat(animation): 452 named constants, 30-phase character animation state machine 2026-04-04 23:02:53 +03:00
test_combat_fsm.cpp feat(animation): decompose AnimationController into FSM-based architecture 2026-04-05 12:27:35 +03:00
test_dbc_loader.cpp feat(animation): 452 named constants, 30-phase character animation state machine 2026-04-04 23:02:53 +03:00
test_entity.cpp feat(animation): 452 named constants, 30-phase character animation state machine 2026-04-04 23:02:53 +03:00
test_frustum.cpp feat(animation): 452 named constants, 30-phase character animation state machine 2026-04-04 23:02:53 +03:00
test_indoor_shadows.cpp feat(rendering): add HiZ occlusion culling & fix WMO interior shadows 2026-04-06 16:40:59 +03:00
test_locomotion_fsm.cpp feat(animation): decompose AnimationController into FSM-based architecture 2026-04-05 12:27:35 +03:00
test_m2_structs.cpp feat(animation): 452 named constants, 30-phase character animation state machine 2026-04-04 23:02:53 +03:00
test_opcode_table.cpp feat(animation): 452 named constants, 30-phase character animation state machine 2026-04-04 23:02:53 +03:00
test_packet.cpp feat(animation): 452 named constants, 30-phase character animation state machine 2026-04-04 23:02:53 +03:00
test_srp.cpp feat(animation): 452 named constants, 30-phase character animation state machine 2026-04-04 23:02:53 +03:00