[PR #387] [CLOSED] Add optional leaf and entity culling to graphics settings #2524

Closed
opened 2026-11-02 15:56:54 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/387
Author: @Online5277
Created: 10/15/2026
Status: ❌ Closed

Base: main ← Head: feat/cull-leaves


📝 Commits (3)

  • 22d2470 Add an opt-in Cull Leaves graphics setting
  • 1a4c7c6 Add conservative opt-in entity culling
  • f1443b9 Keep entity culling description within the UI line limit

📊 Changes

26 files changed (+689 additions, -20 deletions)

View changed files

📝 README.md (+2 -0)
➕ THIRD_PARTY_NOTICES.md (+31 -0)
📝 crates/horizon-client/examples/chunk_bench.rs (+1 -0)
📝 crates/horizon-client/examples/section_mesh_fixture.rs (+1 -0)
➕ crates/horizon-client/src/entity_culling.rs (+266 -0)
📝 crates/horizon-client/src/game.rs (+32 -5)
📝 crates/horizon-client/src/game/armor_stands.rs (+2 -0)
📝 crates/horizon-client/src/game/backdrop.rs (+1 -0)
📝 crates/horizon-client/src/game/boats.rs (+2 -0)
📝 crates/horizon-client/src/game/creatures.rs (+6 -0)
➕ crates/horizon-client/src/game/entity_culling.rs (+51 -0)
📝 crates/horizon-client/src/game/frames.rs (+6 -0)
📝 crates/horizon-client/src/game/item_draw.rs (+2 -0)
📝 crates/horizon-client/src/game/lan.rs (+4 -0)
📝 crates/horizon-client/src/game/minecarts.rs (+2 -0)
📝 crates/horizon-client/src/game/paintings.rs (+2 -0)
📝 crates/horizon-client/src/gfx.rs (+3 -0)
📝 crates/horizon-client/src/graphics.rs (+14 -2)
📝 crates/horizon-client/src/graphics_ui.rs (+102 -0)
📝 crates/horizon-client/src/lib.rs (+1 -0)

...and 6 more files

📄 Description

Adds two independent, opt-in switches under Video Settings → Advanced → Rendering: Cull Leaves and Entity Culling. Both default Off, persist in horizon-graphics.txt, and survive preset changes.

Cull Leaves adapts CullLeaves' default shared-face optimization to Horizon's Rust mesher. Adjacent leaves (including different species) and adjacent mangrove roots hide their shared cull-face groups. Exposed faces, leaf/root boundaries, and existing opaque-leaf behavior are preserved. Changing the switch immediately remeshes loaded sections; streamers and the title backdrop receive the setting. The optional Smart Leaves resource pack is not bundled.

CullLeaves' full MIT notice, including Copyright (c) 2020 MidnightDust, remains in THIRD_PARTY_NOTICES.md, with README/source attribution and inclusion in native packages.

Entity Culling is an original Rust implementation. It removes completed model vertices before GPU upload when a full opaque terrain cross-section covers their entire projected bounds. It covers mobs, LAN guests, armor stands, dropped items, boats, minecarts, paintings, item frames and ordinary block entities. Bounds come from the actual generated model, including animation/equipment, with a small margin. Checking every block in the projected rectangle preserves visibility through windows and slits; uncertain cases and the shared per-frame lookup budget fail open.

Only full opaque model blocks in uploaded, clean, non-meshing sections can occlude. Spectator views, cameras inside opaque blocks, custom resource packs, glowing models, guardian beams and block entities with distant beams/outlines bypass the relevant checks. Local-player rendering, simulation, interaction, name tags, shadows, leashes and separate effects remain independent.

This first implementation still generates CPU poses and meshes; it reduces hidden model upload/drawing, not animation work. No FPS improvement is claimed without a benchmark.

Validation:

  • Five entity-culling tests cover all wall directions, openings/slits, protruding equipment, completed-mesh truncation, preservation of earlier vertices, invalid/inside/crossing bounds and shared-budget exhaustion.
  • Graphics tests and actual UI clicks cover persistence, defaults, both switches and preset preservation (10 graphics tests total).
  • Actual-resource leaf meshing regression compares surviving vertex bytes against real baked-model cull groups: same/mixed species, roots, leaf/root and solid neighbors, opaque leaves, exposed models and a cross-chunk boundary.
  • Game binary tests: 44 passed, one existing ignored. Client all-target Clippy with warnings denied, workspace formatting, diff and public-tree checks pass.
  • Independent review of culling math, render hooks, streaming readiness and settings wiring. Native packager syntax and the exact upstream MIT notice were also checked for the leaf change.

No game window, packaged archive or performance benchmark was run. Cull Leaves can make foliage look less dense; Entity Culling is deliberately inactive with custom resource packs because their visual opacity can differ from gameplay facts.


🔄 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/387 **Author:** [@Online5277](https://github.com/Online5277) **Created:** 10/15/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/cull-leaves` --- ### 📝 Commits (3) - [`22d2470`](https://github.com/horizon-rust/horizon/commit/22d2470bccd69806354f7a508901003d03858595) Add an opt-in Cull Leaves graphics setting - [`1a4c7c6`](https://github.com/horizon-rust/horizon/commit/1a4c7c6b1a13678795df525813945f4f79430a38) Add conservative opt-in entity culling - [`f1443b9`](https://github.com/horizon-rust/horizon/commit/f1443b95ee89fac604e6825a9ce358738e655279) Keep entity culling description within the UI line limit ### 📊 Changes **26 files changed** (+689 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+2 -0) ➕ `THIRD_PARTY_NOTICES.md` (+31 -0) 📝 `crates/horizon-client/examples/chunk_bench.rs` (+1 -0) 📝 `crates/horizon-client/examples/section_mesh_fixture.rs` (+1 -0) ➕ `crates/horizon-client/src/entity_culling.rs` (+266 -0) 📝 `crates/horizon-client/src/game.rs` (+32 -5) 📝 `crates/horizon-client/src/game/armor_stands.rs` (+2 -0) 📝 `crates/horizon-client/src/game/backdrop.rs` (+1 -0) 📝 `crates/horizon-client/src/game/boats.rs` (+2 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+6 -0) ➕ `crates/horizon-client/src/game/entity_culling.rs` (+51 -0) 📝 `crates/horizon-client/src/game/frames.rs` (+6 -0) 📝 `crates/horizon-client/src/game/item_draw.rs` (+2 -0) 📝 `crates/horizon-client/src/game/lan.rs` (+4 -0) 📝 `crates/horizon-client/src/game/minecarts.rs` (+2 -0) 📝 `crates/horizon-client/src/game/paintings.rs` (+2 -0) 📝 `crates/horizon-client/src/gfx.rs` (+3 -0) 📝 `crates/horizon-client/src/graphics.rs` (+14 -2) 📝 `crates/horizon-client/src/graphics_ui.rs` (+102 -0) 📝 `crates/horizon-client/src/lib.rs` (+1 -0) _...and 6 more files_ </details> ### 📄 Description Adds two independent, opt-in switches under **Video Settings → Advanced → Rendering**: **Cull Leaves** and **Entity Culling**. Both default Off, persist in `horizon-graphics.txt`, and survive preset changes. **Cull Leaves** adapts [CullLeaves](https://github.com/TeamMidnightDust/CullLeaves)' default shared-face optimization to Horizon's Rust mesher. Adjacent leaves (including different species) and adjacent mangrove roots hide their shared cull-face groups. Exposed faces, leaf/root boundaries, and existing opaque-leaf behavior are preserved. Changing the switch immediately remeshes loaded sections; streamers and the title backdrop receive the setting. The optional Smart Leaves resource pack is not bundled. CullLeaves' full MIT notice, including **Copyright (c) 2020 MidnightDust**, remains in `THIRD_PARTY_NOTICES.md`, with README/source attribution and inclusion in native packages. **Entity Culling** is an original Rust implementation. It removes completed model vertices before GPU upload when a full opaque terrain cross-section covers their entire projected bounds. It covers mobs, LAN guests, armor stands, dropped items, boats, minecarts, paintings, item frames and ordinary block entities. Bounds come from the actual generated model, including animation/equipment, with a small margin. Checking every block in the projected rectangle preserves visibility through windows and slits; uncertain cases and the shared per-frame lookup budget fail open. Only full opaque model blocks in uploaded, clean, non-meshing sections can occlude. Spectator views, cameras inside opaque blocks, custom resource packs, glowing models, guardian beams and block entities with distant beams/outlines bypass the relevant checks. Local-player rendering, simulation, interaction, name tags, shadows, leashes and separate effects remain independent. This first implementation still generates CPU poses and meshes; it reduces hidden model upload/drawing, not animation work. No FPS improvement is claimed without a benchmark. Validation: - Five entity-culling tests cover all wall directions, openings/slits, protruding equipment, completed-mesh truncation, preservation of earlier vertices, invalid/inside/crossing bounds and shared-budget exhaustion. - Graphics tests and actual UI clicks cover persistence, defaults, both switches and preset preservation (10 graphics tests total). - Actual-resource leaf meshing regression compares surviving vertex bytes against real baked-model cull groups: same/mixed species, roots, leaf/root and solid neighbors, opaque leaves, exposed models and a cross-chunk boundary. - Game binary tests: 44 passed, one existing ignored. Client all-target Clippy with warnings denied, workspace formatting, diff and public-tree checks pass. - Independent review of culling math, render hooks, streaming readiness and settings wiring. Native packager syntax and the exact upstream MIT notice were also checked for the leaf change. No game window, packaged archive or performance benchmark was run. Cull Leaves can make foliage look less dense; Entity Culling is deliberately inactive with custom resource packs because their visual opacity can differ from gameplay facts. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:56:54 +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#2524
No description provided.