Skip to content

feat(lighting): Complete lighting overhaul — PCSS, SH L1 LPV, occlusion, LUT color grading#263

Closed
MichaelFisher1997 wants to merge 9 commits intodevfrom
refactor/lighting-overhaul
Closed

feat(lighting): Complete lighting overhaul — PCSS, SH L1 LPV, occlusion, LUT color grading#263
MichaelFisher1997 wants to merge 9 commits intodevfrom
refactor/lighting-overhaul

Conversation

@MichaelFisher1997
Copy link
Collaborator

Summary

Completes the lighting system overhaul tracked in #143. This PR implements phases 4-6 and fixes the remaining Vulkan validation error.

Changes

  • PCSS Soft Shadows (Phase 4): Replaced fixed-radius PCF with Percentage-Closer Soft Shadows using 8-sample Poisson disk blocker search and penumbra-based variable-radius filtering for contact-hardening shadows
  • Native 3D Textures for LPV (Phase 5A): Migrated LPV grids from 2D atlas (image2D) to native VkImage3D / image3D, enabling hardware trilinear sampling
  • Occlusion-Aware Propagation (Phase 5B): Added GPU SSBO occlusion grid built from world chunk data; opaque blocks now correctly block light propagation
  • SH L1 Directional LPV (Phase 5C): Replaced scalar RGB LPV with Spherical Harmonics L1 encoding (3 channel textures × 4 SH coefficients each) for directionally-aware indirect lighting that responds to surface normals
  • LUT Color Grading (Phase 6): Added 32³ 3D LUT-based color grading to the post-process pipeline with configurable intensity
  • 3D Dummy Texture Fix: Created a 1×1×1 3D dummy texture so sampler3D descriptors (bindings 11-13) have a correctly-typed fallback before LPV initialization, fixing VK_IMAGE_VIEW_TYPE_2D vs Dim=3D validation errors

Files Changed (24 files)

Shaders: terrain.frag, lpv_inject.comp, lpv_propagate.comp, post_process.frag + SPIR-V binaries
Engine: lpv_system.zig, rhi.zig, rhi_vulkan.zig, rhi_types.zig, rhi_tests.zig, render_graph.zig
Vulkan backend: descriptor_manager.zig, descriptor_bindings.zig, rhi_context_types.zig, rhi_context_factory.zig, rhi_init_deinit.zig, rhi_frame_orchestration.zig, rhi_resource_setup.zig, rhi_shadow_bridge.zig, rhi_pass_orchestration.zig, post_process_system.zig
Game: world.zig

Testing

  • zig build test passes (unit tests + SPIR-V shader validation)
  • zig build compiles cleanly
  • Pre-push hooks (formatting + full test suite) passed

Resolves #143

@github-actions github-actions bot added documentation Improvements or additions to documentation engine game build shaders labels Feb 8, 2026
… soft shadows, SH L1 LPV with occlusion, and LUT color grading

Implement the full lighting overhaul (phases 4-6):
- PCSS: Poisson-disk blocker search with penumbra-based variable-radius PCF
- LPV: native 3D textures, SH L1 directional encoding (3 channels), occlusion-aware propagation
- Post-process: LUT-based color grading with 32^3 neutral identity texture
- Fix Vulkan validation error on bindings 11-13 by creating a 1x1x1 3D dummy texture
  so sampler3D descriptors have a correctly-typed fallback before LPV initialization

Resolves #143
@MichaelFisher1997 MichaelFisher1997 force-pushed the refactor/lighting-overhaul branch from ead4ae1 to de7b427 Compare February 8, 2026 03:57
@MichaelFisher1997
Copy link
Collaborator Author

Closing in favor of a clean branch — the old branch had merge commits that caused phantom conflicts after #262 was squash-merged into dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build documentation Improvements or additions to documentation engine game shaders

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant