[PR #4860] [CLOSED] Rendering Optimization: Cull offscreen animated sprites #5897

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4860
Author: @elythepreciouscat
Created: 10/31/2026
Status: ❌ Closed

Base: main ← Head: perf/async-occlusion-and-smart-animations


📝 Commits (1)

  • addeaf1 Renderer: cull offscreen animated sprites

📊 Changes

2 files changed (+157 additions, -7 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx.rs (+79 -3)
📝 crates/horizon-client-render/src/gfx/animate.rs (+78 -4)

📄 Description

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

Fixes #4859

Summary of Changes

  1. Smart Animated Texture Culling (gfx/animate.rs, gfx.rs):

    • Track animated sprite layers present in each section's meshes during upload (SectionGpu.animated_layers).
    • In collect_animated_layers, mask quad[0].layer & !OPAQUE_LAYER (bit 15) so opaque animated blocks (magma, lava, prismarine, sea lanterns, command blocks, sculk, etc.) are correctly identified and added to animated_layers.
    • Collect active animated layers from visible sections, visible_lods (including standing-in fading tiles), and shadow_visible sections each frame.
    • Cull animation evaluation, job generation, and GPU buffer uploads / compute dispatches for sprites whose layers are not currently drawn or in shadow.
    • Sprites update immediately to the exact tick frame the moment their section enters the visible frustum.
  2. Testing:

    • Unit test inactive_sprites_are_skipped_by_collect in gfx/animate.rs verifying selective sprite collection.
    • Unit test collect_animated_layers_masks_opaque_layer in gfx.rs verifying opaque animated faces have their layers correctly masked and tracked.

(Note: Vertical occlusion search clamping in occlusion.rs has been reverted and split out as requested in review.)

pr_ready (tools/pr_ready.py --quick on omarchy, against origin/main at 3c1d4b39c, 6 min 56 s)

Check Result
Scope ✅ 2 files, +157 −7
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 481 passed (52 s)
rustfmt ✅ (24 s)
clippy ✅ (4 min 15 s)
tests: horizon-client-render ✅ 652 passed (53 s)
doc tests ✅ 0 passed (25 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/4860 **Author:** [@elythepreciouscat](https://github.com/elythepreciouscat) **Created:** 10/31/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `perf/async-occlusion-and-smart-animations` --- ### 📝 Commits (1) - [`addeaf1`](https://github.com/horizon-rust/horizon/commit/addeaf1c58c02e89def27ad4733ae23b9f645808) Renderer: cull offscreen animated sprites ### 📊 Changes **2 files changed** (+157 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx.rs` (+79 -3) 📝 `crates/horizon-client-render/src/gfx/animate.rs` (+78 -4) </details> ### 📄 Description > 🤖 Opened by elythepreciouscat's AI agent (Antigravity), not by elythepreciouscat personally. Fixes #4859 ### Summary of Changes 1. **Smart Animated Texture Culling (`gfx/animate.rs`, `gfx.rs`)**: - Track animated sprite layers present in each section's meshes during upload (`SectionGpu.animated_layers`). - In `collect_animated_layers`, mask `quad[0].layer & !OPAQUE_LAYER` (bit 15) so opaque animated blocks (magma, lava, prismarine, sea lanterns, command blocks, sculk, etc.) are correctly identified and added to `animated_layers`. - Collect active animated layers from `visible` sections, `visible_lods` (including standing-in fading tiles), and `shadow_visible` sections each frame. - Cull animation evaluation, job generation, and GPU buffer uploads / compute dispatches for sprites whose layers are not currently drawn or in shadow. - Sprites update immediately to the exact tick frame the moment their section enters the visible frustum. 2. **Testing**: - Unit test `inactive_sprites_are_skipped_by_collect` in `gfx/animate.rs` verifying selective sprite collection. - Unit test `collect_animated_layers_masks_opaque_layer` in `gfx.rs` verifying opaque animated faces have their layers correctly masked and tracked. *(Note: Vertical occlusion search clamping in `occlusion.rs` has been reverted and split out as requested in review.)* **pr_ready** (`tools/pr_ready.py --quick` on omarchy, against origin/main at 3c1d4b39c, 6 min 56 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +157 −7 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 481 passed (52 s) | | rustfmt | ✅ (24 s) | | clippy | ✅ (4 min 15 s) | | tests: horizon-client-render | ✅ 652 passed (53 s) | | doc tests | ✅ 0 passed (25 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:15:46 +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#5897
No description provided.