[GH-ISSUE #4985] Renderer: clamp vertical occlusion search grid height to non-air sections #1509

Closed
opened 2026-11-02 15:47:33 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @elythepreciouscat on GitHub (Oct 31, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/4985

Originally assigned to: @elythepreciouscat on GitHub.

🤖 Filed by elythepreciouscat's AI agent (Antigravity), not by elythepreciouscat personally.

Description

In crates/horizon-client-render/src/gfx/occlusion.rs, Graph::search initializes the BFS search grid height to columns.sections + 2 regardless of terrain structure in the search radius. In typical overworld biomes (such as plains, deserts, oceans, savannas) where terrain only reaches y ~ 64–96 (section 4 to 6 of 24), exploring all vertical sections up to the build height allocates a large grid (side * side * height) and spends time copying column visibility slices for empty air space.

Proposal

  1. In Graph::search, dynamically clamp the search box height to (max_non_air_y + 3).max(from.1 + 3).min(columns.sections + 2).
  2. When the camera is at or above columns.sections, retain full height.
  3. In Graph::contains, if a queried section is above the clamped search box, check reachability of the top reached section in that column (which connects through open air to the sky).
  4. Unit tests covering height clamping and open sky reachability.
Originally created by @elythepreciouscat on GitHub (Oct 31, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/4985 Originally assigned to: @elythepreciouscat on GitHub. > 🤖 Filed by elythepreciouscat's AI agent (Antigravity), not by elythepreciouscat personally. ### Description In `crates/horizon-client-render/src/gfx/occlusion.rs`, `Graph::search` initializes the BFS search grid height to `columns.sections + 2` regardless of terrain structure in the search radius. In typical overworld biomes (such as plains, deserts, oceans, savannas) where terrain only reaches y ~ 64–96 (section 4 to 6 of 24), exploring all vertical sections up to the build height allocates a large grid (`side * side * height`) and spends time copying column visibility slices for empty air space. ### Proposal 1. In `Graph::search`, dynamically clamp the search box height to `(max_non_air_y + 3).max(from.1 + 3).min(columns.sections + 2)`. 2. When the camera is at or above `columns.sections`, retain full height. 3. In `Graph::contains`, if a queried section is above the clamped search box, check reachability of the top reached section in that column (which connects through open air to the sky). 4. Unit tests covering height clamping and open sky reachability.
Author
Owner

@elythepreciouscat commented on GitHub (Oct 31, 2026):

🤖 Agent: /claim

<!-- gh-comment-id:6539686403 --> @elythepreciouscat commented on GitHub (Oct 31, 2026): 🤖 Agent: /claim
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#1509
No description provided.