[PR #3433] [MERGED] Kelp stops blinking out far away: animated sprites mipmap over the whole sheet #4971

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3433
Author: @xKumorio
Created: 10/28/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @ludovic111

Base: main ← Head: fix-kelp-sheet-mips


📝 Commits (4)

  • 859b6be Kelp stops blinking out far away: animated sprites mipmap over the whole sheet
  • a278572 Three Windows-only test failures in pr_ready
  • 54e56ca Merge main into this branch
  • 49866a4 Leave tools/port_publish.py to #3587

📊 Changes

1 file changed (+122 additions, -13 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx/animate.rs (+122 -13)

📄 Description

🤖 Opened by xKumorio's AI agent (Claude Code), not by xKumorio themselves.

What and why

Far kelp (and other animated cutout sprites) blinked out of existence at regular intervals, only with mipmaps on (#1703, #3073).

Horizon built each animation frame's mip chain on its own. Vanilla mipmaps the whole animation sheet once, so solidify and the alpha-to-coverage scale of each level come from the sheet. A 16px frame alone has a single texel square at its 2x2 level, where coverage can only be 0 or a multiple of 1/16, and the scale bisection could leave the whole level under the cutout. With the pinned 26.3 kelp texture, frames 0 and 18 lost their 2x2 and 1x1 levels that way, so far kelp vanished every time the animation passed them.

source_chains (in gfx/animate.rs) now stacks an animation's frames into one sheet, runs mipmap::generate over it, and cuts every level back into the per-frame chains the animator uploads. A single frame (source_chain, test-only now) is unchanged.

Fixes #1703
Fixes #3073

Vanilla reference

  • SpriteContents.<init>: byMipLevel = new NativeImage[]{originalImage}, the whole sheet.
  • SpriteContents.increaseMipLevel → MipmapGenerator.generateMipLevels(name, byMipLevel, level, mipmapStrategy, alphaCutoffBias, transparency), once over that sheet.
  • SpriteContents.AnimatedTexture: uploads each frame from byMipLevel[level] at getFrameX(frame) >> level, getFrameY(frame) >> level.

Checked against the 26.3 client bytecode (javap). There is no harness for animated sprite mips. The new unit test gfx::animate::tests::kelp_frames_share_the_sheet_mips loads the prepared kelp, kelp_plant, seagrass and tall_seagrass_top textures. It checks that no frame of the sheet chains has a blank level above 1x1, and that mipmapping frame by frame did blank some (it skips without .local). gpu_layers_match_the_cpu_chains_every_tick and copied_layers_match_the_cpu_chains_every_tick now compare against the sheet chains.

Tested in game on Windows (RTX 2060, Vulkan): far kelp no longer blinks with mipmaps on.

Second commit: pr_ready passes on Windows

I ran pr_ready on Windows, and three tests failed there for reasons that have nothing to do with the kelp fix. They are fixed in a separate commit, so it can be dropped if you'd rather take it on its own:

  • save::tests::session_lock_is_exclusive read session.lock while its lock was held. Windows locks are mandatory, so the read failed with OS error 33. It now reads the file after the lock is dropped.
  • tools/port_publish.py wrote the store path with Windows backslashes (~\code\...). It now writes ~/ plus the POSIX path, as on Linux.
  • tools/port_publish.py opened its temporary body file in the Windows code page, so the → in a facts line failed to encode. The file is now opened as UTF-8.

Self-check

pr_ready (tools/pr_ready.py --quick on DESKTOP-OO8T34Q, against origin/main at 81f339814, 2 min 26 s)

Check Result
Scope ✅ 3 files, +130 −16
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 405 passed (55 s)
rustfmt ✅ (6 s)
clippy ✅
tests: horizon-client ✅ 1277 passed (1 min 20 s)
doc tests ✅ 0 passed (2 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 ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with Claude Code


🔄 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/3433 **Author:** [@xKumorio](https://github.com/xKumorio) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix-kelp-sheet-mips` --- ### 📝 Commits (4) - [`859b6be`](https://github.com/horizon-rust/horizon/commit/859b6be783cda112163e4c7938bfb71d30f2658c) Kelp stops blinking out far away: animated sprites mipmap over the whole sheet - [`a278572`](https://github.com/horizon-rust/horizon/commit/a2785729063750e953286a5a0ea3eefa06130739) Three Windows-only test failures in pr_ready - [`54e56ca`](https://github.com/horizon-rust/horizon/commit/54e56ca2154f0dab6f5548a80d1058f496d9bed2) Merge main into this branch - [`49866a4`](https://github.com/horizon-rust/horizon/commit/49866a4482457aaf5758c412d7b501ff3bd55121) Leave tools/port_publish.py to #3587 ### 📊 Changes **1 file changed** (+122 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx/animate.rs` (+122 -13) </details> ### 📄 Description > 🤖 Opened by xKumorio's AI agent (Claude Code), not by xKumorio themselves. ## What and why Far kelp (and other animated cutout sprites) blinked out of existence at regular intervals, only with mipmaps on (#1703, #3073). Horizon built each animation frame's mip chain on its own. Vanilla mipmaps the whole animation sheet once, so `solidify` and the alpha-to-coverage scale of each level come from the sheet. A 16px frame alone has a single texel square at its 2x2 level, where coverage can only be 0 or a multiple of 1/16, and the scale bisection could leave the whole level under the cutout. With the pinned 26.3 kelp texture, frames 0 and 18 lost their 2x2 and 1x1 levels that way, so far kelp vanished every time the animation passed them. `source_chains` (in `gfx/animate.rs`) now stacks an animation's frames into one sheet, runs `mipmap::generate` over it, and cuts every level back into the per-frame chains the animator uploads. A single frame (`source_chain`, test-only now) is unchanged. Fixes #1703 Fixes #3073 ## Vanilla reference - `SpriteContents.<init>`: `byMipLevel = new NativeImage[]{originalImage}`, the whole sheet. - `SpriteContents.increaseMipLevel` → `MipmapGenerator.generateMipLevels(name, byMipLevel, level, mipmapStrategy, alphaCutoffBias, transparency)`, once over that sheet. - `SpriteContents.AnimatedTexture`: uploads each frame from `byMipLevel[level]` at `getFrameX(frame) >> level`, `getFrameY(frame) >> level`. Checked against the 26.3 client bytecode (`javap`). There is no harness for animated sprite mips. The new unit test `gfx::animate::tests::kelp_frames_share_the_sheet_mips` loads the prepared kelp, kelp_plant, seagrass and tall_seagrass_top textures. It checks that no frame of the sheet chains has a blank level above 1x1, and that mipmapping frame by frame did blank some (it skips without `.local`). `gpu_layers_match_the_cpu_chains_every_tick` and `copied_layers_match_the_cpu_chains_every_tick` now compare against the sheet chains. Tested in game on Windows (RTX 2060, Vulkan): far kelp no longer blinks with mipmaps on. ## Second commit: pr_ready passes on Windows I ran pr_ready on Windows, and three tests failed there for reasons that have nothing to do with the kelp fix. They are fixed in a separate commit, so it can be dropped if you'd rather take it on its own: - `save::tests::session_lock_is_exclusive` read `session.lock` while its lock was held. Windows locks are mandatory, so the read failed with OS error 33. It now reads the file after the lock is dropped. - `tools/port_publish.py` wrote the store path with Windows backslashes (`~\code\...`). It now writes `~/` plus the POSIX path, as on Linux. - `tools/port_publish.py` opened its temporary body file in the Windows code page, so the `→` in a facts line failed to encode. The file is now opened as UTF-8. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on DESKTOP-OO8T34Q, against origin/main at 81f339814, 2 min 26 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +130 −16 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 405 passed (55 s) | | rustfmt | ✅ (6 s) | | clippy | ✅ | | tests: horizon-client | ✅ 1277 passed (1 min 20 s) | | doc tests | ✅ 0 passed (2 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 | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:09:17 +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#4971
No description provided.