Kelsidavis-WoWee/assets/shaders
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
..
basic.frag.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
basic.frag.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
basic.vert.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
basic.vert.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
celestial.frag.glsl Fix sun quad square artifact with hard radial discard cutoff 2026-02-23 08:43:50 -08:00
celestial.frag.spv Fix sun quad square artifact with hard radial discard cutoff 2026-02-23 08:43:50 -08:00
celestial.vert.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
celestial.vert.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
character.frag.glsl feat(animation): 452 named constants, 30-phase character animation state machine 2026-04-04 23:02:53 +03:00
character.frag.spv fix(rendering): alpha-to-coverage for hair, skip eye glow geosets, add missing include 2026-04-04 00:21:15 -07:00
character.vert.glsl Add normal mapping and parallax occlusion mapping for character models 2026-02-23 01:40:23 -08:00
character.vert.spv Add normal mapping and parallax occlusion mapping for character models 2026-02-23 01:40:23 -08:00
character_shadow.frag.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
character_shadow.frag.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
character_shadow.vert.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
character_shadow.vert.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
charge_dust.frag.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
charge_dust.frag.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
charge_dust.vert.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
charge_dust.vert.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
charge_ribbon.frag.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
charge_ribbon.frag.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
charge_ribbon.vert.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
charge_ribbon.vert.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
clouds.frag.glsl Enhanced sky atmosphere with DBC-driven colors, sun lighting, and zone weather 2026-02-22 23:20:13 -08:00
clouds.frag.spv Enhanced sky atmosphere with DBC-driven colors, sun lighting, and zone weather 2026-02-22 23:20:13 -08:00
clouds.vert.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
clouds.vert.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
fsr2_accumulate.comp.glsl Stabilize FSR2 path and refine temporal pipeline groundwork 2026-03-08 18:52:04 -07:00
fsr2_accumulate.comp.spv Stabilize FSR2 path and refine temporal pipeline groundwork 2026-03-08 18:52:04 -07:00
fsr2_motion.comp.glsl Stabilize FSR2 path and refine temporal pipeline groundwork 2026-03-08 18:52:04 -07:00
fsr2_motion.comp.spv FSR2: selective clamp, tonemapped accumulation, terrain load radius 3 2026-03-08 15:15:44 -07:00
fsr2_sharpen.frag.glsl fix: remove Y-flip counter-hacks in FSR shaders; invert mouse by default; FSR1 disables MSAA 2026-03-12 21:59:41 -07:00
fsr2_sharpen.frag.spv fix: remove Y-flip counter-hacks in FSR shaders; invert mouse by default; FSR1 disables MSAA 2026-03-12 21:59:41 -07:00
fsr_easu.frag.glsl fix: remove Y-flip counter-hacks in FSR shaders; invert mouse by default; FSR1 disables MSAA 2026-03-12 21:59:41 -07:00
fsr_easu.frag.spv fix: remove Y-flip counter-hacks in FSR shaders; invert mouse by default; FSR1 disables MSAA 2026-03-12 21:59:41 -07:00
fsr_rcas.frag.glsl Fix WMO wall collision, normal mapping, POM backfill, and M2/WMO rendering performance 2026-03-07 22:03:28 -08:00
fsr_rcas.frag.spv Fix WMO wall collision, normal mapping, POM backfill, and M2/WMO rendering performance 2026-03-07 22:03:28 -08:00
fxaa.frag.glsl feat: add ghost mode grayscale screen effect 2026-03-13 00:59:36 -07:00
fxaa.frag.spv feat: add ghost mode grayscale screen effect 2026-03-13 00:59:36 -07:00
hiz_build.comp.glsl feat(rendering): add HiZ occlusion culling & fix WMO interior shadows 2026-04-06 16:40:59 +03:00
lens_flare.frag.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
lens_flare.frag.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
lens_flare.vert.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
lens_flare.vert.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
lightning_bolt.frag.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
lightning_bolt.frag.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
lightning_bolt.vert.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
lightning_bolt.vert.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
lightning_flash.frag.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
lightning_flash.frag.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
lightning_flash.vert.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
lightning_flash.vert.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
m2.frag.glsl Fix glow sprite flashing, move fadeAlpha to push constants, throttle character bones 2026-03-04 08:17:32 -08:00
m2.frag.spv Fix glow sprite flashing, move fadeAlpha to push constants, throttle character bones 2026-03-04 08:17:32 -08:00
m2.vert.glsl feat(animation): 452 named constants, 30-phase character animation state machine 2026-04-04 23:02:53 +03:00
m2.vert.spv feat(rendering): GPU architecture + visual quality fixes 2026-04-04 13:43:16 +03:00
m2_cull.comp.glsl feat(animation): 452 named constants, 30-phase character animation state machine 2026-04-04 23:02:53 +03:00
m2_cull.comp.spv feat(rendering): GPU architecture + visual quality fixes 2026-04-04 13:43:16 +03:00
m2_cull_hiz.comp.glsl feat(rendering): add HiZ occlusion culling & fix WMO interior shadows 2026-04-06 16:40:59 +03:00
m2_particle.frag.glsl fix(render): premultiply glow sprite color by alpha 2026-03-14 06:10:20 -07:00
m2_particle.frag.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
m2_particle.vert.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
m2_particle.vert.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
m2_ribbon.frag.glsl feat: implement M2 ribbon emitter rendering for spell trail effects 2026-03-13 01:17:30 -07:00
m2_ribbon.frag.spv feat: implement M2 ribbon emitter rendering for spell trail effects 2026-03-13 01:17:30 -07:00
m2_ribbon.vert.glsl feat: implement M2 ribbon emitter rendering for spell trail effects 2026-03-13 01:17:30 -07:00
m2_ribbon.vert.spv feat: implement M2 ribbon emitter rendering for spell trail effects 2026-03-13 01:17:30 -07:00
m2_smoke.frag.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
m2_smoke.frag.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
m2_smoke.vert.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
m2_smoke.vert.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
minimap_display.frag.glsl fix: correct minimap orientation and arrow direction, compact key ring UI 2026-03-17 08:18:46 -07:00
minimap_display.frag.spv fix: correct minimap orientation and arrow direction, compact key ring UI 2026-03-17 08:18:46 -07:00
minimap_display.vert.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
minimap_display.vert.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
minimap_tile.frag.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
minimap_tile.frag.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
minimap_tile.vert.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
minimap_tile.vert.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
mount_dust.frag.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
mount_dust.frag.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
mount_dust.vert.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
mount_dust.vert.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
overlay.frag.glsl Activate WMO/char/M2 render loop, purge dead GL block, add underwater overlay 2026-02-21 22:04:17 -08:00
overlay.frag.spv Activate WMO/char/M2 render loop, purge dead GL block, add underwater overlay 2026-02-21 22:04:17 -08:00
postprocess.frag.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
postprocess.frag.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
postprocess.vert.glsl fix: remove incorrect Y-flip in postprocess vertex shader 2026-03-12 21:52:00 -07:00
postprocess.vert.spv fix: remove incorrect Y-flip in postprocess vertex shader 2026-03-12 21:52:00 -07:00
quest_marker.frag.glsl feat: desaturate quest markers for trivial (gray) quests 2026-03-10 22:26:56 -07:00
quest_marker.frag.spv feat: desaturate quest markers for trivial (gray) quests 2026-03-10 22:26:56 -07:00
quest_marker.vert.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
quest_marker.vert.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
selection_circle.frag.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
selection_circle.frag.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
selection_circle.vert.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
selection_circle.vert.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
shadow.frag.glsl Add shader-driven tree beautification: wind sway, SSS, color variation, AO 2026-02-23 03:53:50 -08:00
shadow.frag.spv Add shader-driven tree beautification: wind sway, SSS, color variation, AO 2026-02-23 03:53:50 -08:00
shadow.vert.glsl Add shader-driven tree beautification: wind sway, SSS, color variation, AO 2026-02-23 03:53:50 -08:00
shadow.vert.spv Add shader-driven tree beautification: wind sway, SSS, color variation, AO 2026-02-23 03:53:50 -08:00
skybox.frag.glsl Enhanced sky atmosphere with DBC-driven colors, sun lighting, and zone weather 2026-02-22 23:20:13 -08:00
skybox.frag.spv Enhanced sky atmosphere with DBC-driven colors, sun lighting, and zone weather 2026-02-22 23:20:13 -08:00
skybox.vert.glsl Fix sky and clouds orientation for Z-up world coordinates 2026-02-21 22:04:17 -08:00
skybox.vert.spv Fix sky and clouds orientation for Z-up world coordinates 2026-02-21 22:04:17 -08:00
starfield.frag.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
starfield.frag.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
starfield.vert.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
starfield.vert.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
swim_bubble.frag.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
swim_bubble.frag.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
swim_bubble.vert.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
swim_bubble.vert.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
swim_insect.frag.glsl Add ambient insect particles near water vegetation, fix firefly particles, and improve water foam 2026-02-23 07:18:44 -08:00
swim_insect.frag.spv Add ambient insect particles near water vegetation, fix firefly particles, and improve water foam 2026-02-23 07:18:44 -08:00
swim_ripple.frag.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
swim_ripple.frag.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
swim_ripple.vert.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
swim_ripple.vert.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
terrain.frag.glsl feat(animation): 452 named constants, 30-phase character animation state machine 2026-04-04 23:02:53 +03:00
terrain.frag.spv Distance-cull terrain derivative normal mapping 2026-02-23 10:54:56 -08:00
terrain.vert.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
terrain.vert.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
water.frag.glsl chore: remove dead code, document water shader wave parameters 2026-03-30 18:50:14 -07:00
water.frag.spv Ironforge Great Forge lava, magma water rendering, LavaSteam particle effects 2026-03-07 00:48:04 -08:00
water.vert.glsl Add player water ripples and separate 1x water pass for MSAA compatibility 2026-02-22 22:34:48 -08:00
water.vert.spv Add player water ripples and separate 1x water pass for MSAA compatibility 2026-02-22 22:34:48 -08:00
weather.frag.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
weather.frag.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
weather.vert.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
weather.vert.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
wmo.frag.glsl feat(rendering): add HiZ occlusion culling & fix WMO interior shadows 2026-04-06 16:40:59 +03:00
wmo.vert.glsl Add normal mapping and parallax occlusion mapping for WMO surfaces 2026-02-23 01:10:58 -08:00
wmo.vert.spv Add normal mapping and parallax occlusion mapping for WMO surfaces 2026-02-23 01:10:58 -08:00
wmo_occlusion.frag.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
wmo_occlusion.frag.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
wmo_occlusion.vert.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
wmo_occlusion.vert.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
world_map.frag.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
world_map.frag.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00
world_map.vert.glsl Vulcan Nightmare 2026-02-21 22:04:17 -08:00
world_map.vert.spv Vulcan Nightmare 2026-02-21 22:04:17 -08:00