[PR #4991] [MERGED] Renderer: clamp vertical occlusion search grid height to non-air sections #5994

Closed
opened 2026-11-03 05:16:28 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4991
Author: @elythepreciouscat
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @rdbtCVS

Base: main ← Head: perf/clamp-vertical-occlusion-search


📝 Commits (2)

  • ede6a08 Renderer: clamp vertical occlusion search grid height to non-air sections
  • 9dba54f Keep clamped occlusion sky conservative

📊 Changes

1 file changed (+129 additions, -4 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx/occlusion.rs (+129 -4)

📄 Description

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

Fixes #4985

Summary

This PR isolates the vertical occlusion search clamping optimization previously included in #4860 into its own targeted pull request so that occlusion parity and performance harnesses can judge it independently.

  1. Dynamic Search Box Clamping: In Graph::search, scan the highest non-air section across columns in the search radius and clamp self.height = (top_y + 3).max(3).min(columns.sections + 2). This avoids allocating, exploring, and traversing empty air sections all the way up to build limit in worlds or areas where terrain ends well below maximum height.
  2. Column Slice Copying: The column slice copying in Graph::search is clamped to (column.len() as i32).min(self.height - 1) as usize.
  3. Open-Sky Visibility Fallback: For queries above the clamped search box (key.1 >= self.y0 + self.height), fall back to checking whether the top cell in that column was reached by the search. If reached, open air sections above are visible; if not (e.g., covered cave/roof), they remain hidden.
  4. Unit Test: Added vertical_clamping_bounds_height_and_reaches_open_sky verifying height clamping, camera visibility, open air column reachability, and ceiling occlusion in caves.

pr_ready (tools/pr_ready.py --quick on omarchy, against origin/main at 6eca57787, 5 min 52 s)

Check Result
Scope ✅ 1 files, +61 −4
Cargo.lock ✅ unchanged
Public tree ✅ (1 s)
Python tests ✅ 495 passed (58 s)
rustfmt ✅ (22 s)
clippy ✅ (3 min 50 s)
tests: horizon-client-render ✅ 708 passed (22 s)
doc tests ✅ 0 passed (10 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 354 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 342 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with Antigravity


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/4991 **Author:** [@elythepreciouscat](https://github.com/elythepreciouscat) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `perf/clamp-vertical-occlusion-search` --- ### 📝 Commits (2) - [`ede6a08`](https://github.com/horizon-rust/horizon/commit/ede6a087d023d498669765407b76e32b01c084f6) Renderer: clamp vertical occlusion search grid height to non-air sections - [`9dba54f`](https://github.com/horizon-rust/horizon/commit/9dba54f8faeb3b8429b2accc7ca3ba1a5f712480) Keep clamped occlusion sky conservative ### 📊 Changes **1 file changed** (+129 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx/occlusion.rs` (+129 -4) </details> ### 📄 Description > 🤖 Opened by elythepreciouscat's AI agent (Antigravity), not by elythepreciouscat personally. Fixes #4985 ### Summary This PR isolates the vertical occlusion search clamping optimization previously included in #4860 into its own targeted pull request so that occlusion parity and performance harnesses can judge it independently. 1. **Dynamic Search Box Clamping**: In `Graph::search`, scan the highest non-air section across columns in the search radius and clamp `self.height = (top_y + 3).max(3).min(columns.sections + 2)`. This avoids allocating, exploring, and traversing empty air sections all the way up to build limit in worlds or areas where terrain ends well below maximum height. 2. **Column Slice Copying**: The column slice copying in `Graph::search` is clamped to `(column.len() as i32).min(self.height - 1) as usize`. 3. **Open-Sky Visibility Fallback**: For queries above the clamped search box (`key.1 >= self.y0 + self.height`), fall back to checking whether the top cell in that column was reached by the search. If reached, open air sections above are visible; if not (e.g., covered cave/roof), they remain hidden. 4. **Unit Test**: Added `vertical_clamping_bounds_height_and_reaches_open_sky` verifying height clamping, camera visibility, open air column reachability, and ceiling occlusion in caves. **pr_ready** (`tools/pr_ready.py --quick` on omarchy, against origin/main at 6eca57787, 5 min 52 s) | Check | Result | | --- | --- | | Scope | ✅ 1 files, +61 −4 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ (1 s) | | Python tests | ✅ 495 passed (58 s) | | rustfmt | ✅ (22 s) | | clippy | ✅ (3 min 50 s) | | tests: horizon-client-render | ✅ 708 passed (22 s) | | doc tests | ✅ 0 passed (10 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 354 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 342 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with Antigravity --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:16:28 +07:00
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#5994
No description provided.