[PR #343] [MERGED] Interpolate animated textures like vanilla (prismarine, magma, stems, lit furnaces) #2504

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/343
Author: @ludovic111
Created: 10/15/2026
Status: ✅ Merged
Merged: 10/15/2026
Merged by: @ludovic111

Base: main ← Head: fix/sprite-interpolation


📝 Commits (1)

  • c8d5d13 Interpolate animated textures like vanilla (prismarine, magma, stems, lit furnaces)

📊 Changes

2 files changed (+171 additions, -35 deletions)

View changed files

📝 crates/horizon-client/src/gfx.rs (+114 -34)
📝 crates/horizon-client/src/sprites.rs (+57 -1)

📄 Description

What

Animated textures whose .png.mcmeta sets "interpolate": true now blend towards the next frame every tick, as vanilla does. Vanilla 26.3 uses it on 25 block textures (prismarine, magma, crimson and warped stems, lit furnaces/smokers/blast furnaces, campfire logs, command blocks, sculk, the stonecutter saw), and resource packs use it a lot; Horizon stepped from frame to frame.

How

Vanilla: SpriteContents.AnimationState.drawToAtlas draws animate_sprite_interpolate.fsh = mix(current, next, (int)(subFrame / time * 1000) / 1000) per mip level of the two frames into the RGBA8 atlas, every tick (needsToDraw is true for interpolated animations).

Horizon: SpriteAnimation::blend (sprites.rs) gives the frame, the next one and the thousandths from the existing AnimationClip::sample (already checked against vanilla by test_sprite_animation_parity, interpolation_millis included). animate_sprites (gfx.rs) mixes the two frames' mip chains with the same f32 mix and unorm8 rounding and uploads whenever the blend changes (every tick while interpolating; unchanged for other animations). Found by the resource pack audit (#340).

How tested

cargo fmt --check -p horizon-client                       ok
cargo clippy -p horizon-client --all-targets -D warnings  ok
cargo test -p horizon-client --lib sprite                 12 passed (2 new: blend sequence, uploaded mix 0 → 25 → 50 → 99)
tools/parity.py sprite_animation mipmap environment_render   3 passed

tools/parity.py --changed origin/main selects 80 harnesses because gfx.rs is a broad input; only the sprite upload changed, so I ran the three that cover sprite animation, mip chains and world rendering. CI runs the rest.

Needs Ludovic

Nothing.

🤖 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/343 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/sprite-interpolation` --- ### 📝 Commits (1) - [`c8d5d13`](https://github.com/horizon-rust/horizon/commit/c8d5d1381352f0d609784db1618c1afc6f75523d) Interpolate animated textures like vanilla (prismarine, magma, stems, lit furnaces) ### 📊 Changes **2 files changed** (+171 additions, -35 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/gfx.rs` (+114 -34) 📝 `crates/horizon-client/src/sprites.rs` (+57 -1) </details> ### 📄 Description ## What Animated textures whose `.png.mcmeta` sets `"interpolate": true` now blend towards the next frame every tick, as vanilla does. Vanilla 26.3 uses it on 25 block textures (prismarine, magma, crimson and warped stems, lit furnaces/smokers/blast furnaces, campfire logs, command blocks, sculk, the stonecutter saw), and resource packs use it a lot; Horizon stepped from frame to frame. ## How Vanilla: `SpriteContents.AnimationState.drawToAtlas` draws `animate_sprite_interpolate.fsh` = `mix(current, next, (int)(subFrame / time * 1000) / 1000)` per mip level of the two frames into the RGBA8 atlas, every tick (`needsToDraw` is true for interpolated animations). Horizon: `SpriteAnimation::blend` (`sprites.rs`) gives the frame, the next one and the thousandths from the existing `AnimationClip::sample` (already checked against vanilla by `test_sprite_animation_parity`, `interpolation_millis` included). `animate_sprites` (`gfx.rs`) mixes the two frames' mip chains with the same f32 `mix` and unorm8 rounding and uploads whenever the blend changes (every tick while interpolating; unchanged for other animations). Found by the resource pack audit (#340). ## How tested ``` cargo fmt --check -p horizon-client ok cargo clippy -p horizon-client --all-targets -D warnings ok cargo test -p horizon-client --lib sprite 12 passed (2 new: blend sequence, uploaded mix 0 → 25 → 50 → 99) tools/parity.py sprite_animation mipmap environment_render 3 passed ``` `tools/parity.py --changed origin/main` selects 80 harnesses because `gfx.rs` is a broad input; only the sprite upload changed, so I ran the three that cover sprite animation, mip chains and world rendering. CI runs the rest. ## Needs Ludovic Nothing. 🤖 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-02 15:56:44 +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#2504
No description provided.