Skip to content

fix: unify terrain lighting model#908

Merged
github-actions[bot] merged 1 commit into
devfrom
bug/901-unify-terrain-lighting
Jul 10, 2026
Merged

fix: unify terrain lighting model#908
github-actions[bot] merged 1 commit into
devfrom
bug/901-unify-terrain-lighting

Conversation

@MichaelFisher1997

Copy link
Copy Markdown
Collaborator

Summary\n- remove the forced simple-lighting override and restore the shared feature settings\n- render textured terrain, fallback terrain, and LOD terrain through one Lambert plus dielectric GGX lighting equation\n- restrict AO/SSAO to indirect diffuse, preserve RGB block light, fix camera-relative view vectors/TBN handedness, and remove mandatory lush grading\n\n## Verification\n- nix develop --command zig build test\n- nix develop --command zig build test-integration\n- nix develop --command zig build run -Dskip-present -Dauto-world=normal -Dstartup-diagnostic-seconds=5\n\nCloses #901

@github-actions github-actions Bot added documentation Improvements or additions to documentation engine shaders labels Jul 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

kcov coverage

Line coverage ran for this PR and uploaded a non-blocking report artifact named kcov-report. Codecov upload is configured as non-blocking while the project captures a stable baseline.

@github-actions

Copy link
Copy Markdown
Contributor

📋 Summary

PR #908 closes #901 by removing the forced simple_lighting_mode override, collapsing the terrain simple/legacy/partial-PBR branches into a single computeTerrainLighting function, and applying the fixes to view vectors, TBN handedness, and AO/SSAO usage described in the issue. The default LOW preset is now aligned with the other presets (pbr_enabled: true). I verified that nix develop --command zig build test passes (exit 0), including shader compilation for the modified terrain.frag, water.frag, and post_process.frag.

📌 Review Metadata

🔴 Critical Issues (Must Fix - Blocks Merge)

None identified.

⚠️ High Priority Issues (Should Fix)

None identified.

💡 Medium Priority Issues (Nice to Fix)

None identified.

ℹ️ Low Priority Suggestions (Optional)

[LOW] assets/shaders/vulkan/post_process.frag:181 - Dead code gate now trivially true
Confidence: High
Description: computeScreenSunShafts is defined but never called, and its global.render_flags.w < 0.5 guard is now always true because render_flags.w is hard-coded to 0.0 in rhi_render_state.zig:43. In sky.frag:208 the same guard is intentionally always-open now that simple lighting is gone.
Impact: No runtime impact today (function is dead), but the vestigial uniform field and dead function are technical debt.
Suggested Fix: Either remove computeScreenSunShafts and stop populating render_flags.w, or repurpose the bit for a future feature gate with a clear comment.

📊 SOLID Principles Score

Principle Score Notes
Single Responsibility 8 One lighting function replaces four; clear separation of direct/indirect terms.
Open/Closed 7 New model is feature-gated by existing settings, but preset defaults changed.
Liskov Substitution 8 No inheritance hierarchy affected; shader inputs remain compatible.
Interface Segregation 8 FrameRenderParams is simplified by removing simple_lighting_enabled.
Dependency Inversion 7 RHI still consumes concrete settings; reasonable for this layer.
Average 7.6

🎯 Final Assessment

Overall Confidence Score: 85%

Confidence Breakdown:

  • Code Quality: 90% (clean, focused refactor; removes more code than it adds)
  • Completeness: 85% (addresses the main [Lighting Overhaul][Phase 3] Unify terrain lighting, atmosphere, and output #901 scope; some visual acceptance criteria like windowed/headless equivalence are not independently verified)
  • Risk Level: 30% (shader changes always carry visual/regression risk, but tests pass and the change is well-scoped)
  • Test Coverage: 80% (existing tests compile and pass; no new unit tests added for the lighting function)

Merge Readiness:

  • All critical issues resolved
  • SOLID average score >= 6.0
  • Overall confidence >= 60%
  • No security concerns
  • Tests present and passing (if applicable)

Verdict:

MERGE - The PR correctly unifies the terrain lighting model, removes the forced simple-lighting override, and passes the build/test pipeline with no critical or high-priority issues.

Machine Readable Verdict

{
  "reviewed_sha": "54a3e6d6e4356359a9df8a703d08e9e6c86e44d6",
  "critical_issues": 0,
  "high_priority_issues": 0,
  "medium_priority_issues": 0,
  "overall_confidence_score": 85,
  "recommendation": "MERGE"
}

New%20session%20-%202026-07-10T01%3A26%3A33.166Z
opencode session  |  github run

@github-actions
github-actions Bot merged commit 78e11d1 into dev Jul 10, 2026
21 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation engine shaders

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant