[GH-ISSUE #782] Cave culling: vanilla's graph rules (every entry face, distant ray test) #226

Closed
opened 2026-11-02 15:37:28 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @ludovic111 on GitHub (Oct 17, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/782

🤖 Filed by Ludovic's AI agent (Claude), not by Ludovic himself.

Horizon's cave culling search (crates/horizon-client/src/gfx/occlusion.rs) differs from vanilla 26.3's SectionOcclusionGraph.runUpdates in two ways:

  1. Entry faces. Vanilla's Node.sourceDirections keeps every face a section is reached through, and a section leads on through whatever any of them connects to. Horizon keeps only the first face. So Horizon can hide a section vanilla shows: one entered first through a face that leads nowhere, and later through a face that leads on.
  2. Distant ray test. Beyond 60 blocks (MINIMUM_ADVANCED_CULLING_DISTANCE), vanilla steps from the section's corner towards the camera in 28-block steps (CEILED_SECTION_DIAGONAL). It drops the step into a section if any point on that line falls in a section the search has not reached yet. Horizon has no such test, so it draws sections vanilla culls.

Measured on the Mac mini (seed 1234, spectator, 18 views at RD 16 and 32, ticks frozen) with rule 1 switched on in a local build: it draws 5–15% more sections (RD 32: 3,707 → 4,110 at the village, 3,943 → 4,540 over the ocean, 6,040 → 6,740 on a mountain), with no visible pixel difference in any of the 18 views (water animation aside). Rule 2 was not measured; it should cull more than Horizon does today. Because it depends on the order sections are reached, it has to run in vanilla's queue order.

Decision needed: adopt both rules together, which matches vanilla's visible set (rule 1 costs GPU, rule 2 should win it back), or keep Horizon's stricter first-entry rule while no visible hole is found.

Found while moving the search to a worker thread (perf-frame-3).

🤖 Generated with Claude Code

Originally created by @ludovic111 on GitHub (Oct 17, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/782 > 🤖 Filed by Ludovic's AI agent (Claude), not by Ludovic himself. Horizon's cave culling search (`crates/horizon-client/src/gfx/occlusion.rs`) differs from vanilla 26.3's `SectionOcclusionGraph.runUpdates` in two ways: 1. **Entry faces.** Vanilla's `Node.sourceDirections` keeps every face a section is reached through, and a section leads on through whatever any of them connects to. Horizon keeps only the first face. So Horizon can hide a section vanilla shows: one entered first through a face that leads nowhere, and later through a face that leads on. 2. **Distant ray test.** Beyond 60 blocks (`MINIMUM_ADVANCED_CULLING_DISTANCE`), vanilla steps from the section's corner towards the camera in 28-block steps (`CEILED_SECTION_DIAGONAL`). It drops the step into a section if any point on that line falls in a section the search has not reached yet. Horizon has no such test, so it draws sections vanilla culls. Measured on the Mac mini (seed 1234, spectator, 18 views at RD 16 and 32, ticks frozen) with rule 1 switched on in a local build: it draws 5–15% more sections (RD 32: 3,707 → 4,110 at the village, 3,943 → 4,540 over the ocean, 6,040 → 6,740 on a mountain), with **no visible pixel difference** in any of the 18 views (water animation aside). Rule 2 was not measured; it should cull more than Horizon does today. Because it depends on the order sections are reached, it has to run in vanilla's queue order. Decision needed: adopt both rules together, which matches vanilla's visible set (rule 1 costs GPU, rule 2 should win it back), or keep Horizon's stricter first-entry rule while no visible hole is found. Found while moving the search to a worker thread (perf-frame-3). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
bsakaguchi 2026-11-02 15:37:28 +07:00
Author
Owner

@ludovic111 commented on GitHub (Oct 21, 2026):

Claimed by ludovic on Discord (GitHub: ludovic111), to avoid duplicate work. The claim lapses after 14 days without activity (a comment, a pull request or a commit mentioning #782).

<!-- gh-comment-id:6315074711 --> @ludovic111 commented on GitHub (Oct 21, 2026): Claimed by `ludovic` on Discord (GitHub: `ludovic111`), to avoid duplicate work. The claim lapses after 14 days without activity (a comment, a pull request or a commit mentioning #782). <!-- kira:work -->
Author
Owner

@ludovic111 commented on GitHub (Oct 21, 2026):

🤖 Agent: fix in #1094. It adopts both rules, exactly as vanilla's runUpdates (a port-equivalence test checks every cell). It draws 25–66% fewer sections at RD 32 on the surface, with frame time down on the Mac mini and the ThinkPad, and the search is kept cheap with exact shortcuts. The numbers are in the PR.

<!-- gh-comment-id:6321018694 --> @ludovic111 commented on GitHub (Oct 21, 2026): 🤖 Agent: fix in #1094. It adopts both rules, exactly as vanilla's runUpdates (a port-equivalence test checks every cell). It draws 25–66% fewer sections at RD 32 on the surface, with frame time down on the Mac mini and the ThinkPad, and the search is kept cheap with exact shortcuts. The numbers are in the PR.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#226
No description provided.