[PR #5113] [MERGED] Shader packs: custom uniforms' smooth starts from the first real value #6082

Closed
opened 2026-11-03 06:11:30 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: shaderpacks/smooth-first-value


📝 Commits (1)

  • 22e5ef2 Shader packs: custom uniforms' smooth starts from the first real value

📊 Changes

4 files changed (+30 additions, -0 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx/pack_post.rs (+6 -0)
📝 crates/horizon-client-render/src/gfx/pack_uniforms.rs (+2 -0)
📝 crates/horizon-client/src/game/shader_packs.rs (+1 -0)
📝 crates/horizon-shaders/src/custom.rs (+21 -0)

📄 Description

🤖 Opened by TobiasLogic's AI agent (Claude Code, Claude Opus 5.5), not by TobiasLogic personally.

What and why

Fixes #5112.

smooth() keeps the first value it sees. PackPost::new evaluates the custom uniforms once with every built-in at zero, to find names nothing defines, and that run seeded every smooth(). So smoothed uniforms started from their zero-input values and faded toward the world's. Photon's biome_temperature = smooth(temperature * 2.0 - 1.0, 1000, 1000) started at -1 and halves its distance every 1000 seconds; Iris gives the real value on the first frame.

  • Custom::restart_smoothing forgets the smooth() state, so each starts again from its next value.
  • PackPost::new calls it after the dry run.
  • Frames before the camera's biome is known (PackInputs::biome_known, false while its chunk isn't loaded) restart it too, so the first world values seed it rather than a missing biome's.

smooth_starts_again_from_its_next_value_after_a_restart covers the restart.

Read back with a probe pack that declares uniform.float.probe_temp_smooth = smooth(temperature * 2.0 - 1.0, 1000, 1000) (Photon's biome_temperature) and writes it into the frame, about 40 seconds after joining a plains superflat world:

temperature * 2 - 1 smooth(…, 1000, 1000)
Iris 1.11.7 0.6 0.6
Horizon main 0.6 -0.956
This PR 0.6 0.6

No screenshots: Photon, where this shows as off-colour rain, snow and haze for the first minutes, doesn't run on main yet (one of its programs hits naga's "Expression not cached" panic).

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

Not vanilla: the shaders/ pack format's custom uniforms. The reference is Iris 1.11.7 on Minecraft 26.3, run and observed with a probe pack (no source read).

Self-check

pr_ready (tools/pr_ready.py --quick on 6cd182588f2d, against origin/main at 4de90a13d, 7 min 55 s)

Check Result
Scope ✅ 4 files, +30 −0
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 495 run, FAILED (errors=4) (2 min 21 s)
rustfmt ✅ (24 s)
clippy ✅ (2 min 7 s)
tests: horizon-client, horizon-client-render, horizon-shaders ✅ 2067 passed (2 min 58 s)
doc tests ✅ 0 passed (5 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)

Run on a rented Linux box with GPU tests on lavapipe. The 4 Python errors are that box's git 2.34 (git merge-tree --write-tree, in test_nightly_set and test_supervise); they pass with git 2.55.

🤖 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/5113 **Author:** [@TobiasLogic](https://github.com/TobiasLogic) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `shaderpacks/smooth-first-value` --- ### 📝 Commits (1) - [`22e5ef2`](https://github.com/horizon-rust/horizon/commit/22e5ef20293c4b82b7559d59fae2ba1b76719905) Shader packs: custom uniforms' smooth starts from the first real value ### 📊 Changes **4 files changed** (+30 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx/pack_post.rs` (+6 -0) 📝 `crates/horizon-client-render/src/gfx/pack_uniforms.rs` (+2 -0) 📝 `crates/horizon-client/src/game/shader_packs.rs` (+1 -0) 📝 `crates/horizon-shaders/src/custom.rs` (+21 -0) </details> ### 📄 Description > 🤖 Opened by TobiasLogic's AI agent (Claude Code, Claude Opus 5.5), not by TobiasLogic personally. ## What and why Fixes #5112. `smooth()` keeps the first value it sees. `PackPost::new` evaluates the custom uniforms once with every built-in at zero, to find names nothing defines, and that run seeded every `smooth()`. So smoothed uniforms started from their zero-input values and faded toward the world's. Photon's `biome_temperature = smooth(temperature * 2.0 - 1.0, 1000, 1000)` started at -1 and halves its distance every 1000 seconds; Iris gives the real value on the first frame. - `Custom::restart_smoothing` forgets the `smooth()` state, so each starts again from its next value. - `PackPost::new` calls it after the dry run. - Frames before the camera's biome is known (`PackInputs::biome_known`, false while its chunk isn't loaded) restart it too, so the first world values seed it rather than a missing biome's. `smooth_starts_again_from_its_next_value_after_a_restart` covers the restart. Read back with a probe pack that declares `uniform.float.probe_temp_smooth = smooth(temperature * 2.0 - 1.0, 1000, 1000)` (Photon's `biome_temperature`) and writes it into the frame, about 40 seconds after joining a plains superflat world: | | `temperature * 2 - 1` | `smooth(…, 1000, 1000)` | | --- | --- | --- | | Iris 1.11.7 | 0.6 | 0.6 | | Horizon main | 0.6 | -0.956 | | This PR | 0.6 | 0.6 | No screenshots: Photon, where this shows as off-colour rain, snow and haze for the first minutes, doesn't run on main yet (one of its programs hits naga's "Expression not cached" panic). ## Kind - [ ] parity: Horizon now does what vanilla 26.3 does - [x] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference Not vanilla: the `shaders/` pack format's custom uniforms. The reference is Iris 1.11.7 on Minecraft 26.3, run and observed with a probe pack (no source read). ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on 6cd182588f2d, against origin/main at 4de90a13d, 7 min 55 s) | Check | Result | | --- | --- | | Scope | ✅ 4 files, +30 −0 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 495 run, FAILED (errors=4) (2 min 21 s) | | rustfmt | ✅ (24 s) | | clippy | ✅ (2 min 7 s) | | tests: horizon-client, horizon-client-render, horizon-shaders | ✅ 2067 passed (2 min 58 s) | | doc tests | ✅ 0 passed (5 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) | Run on a rented Linux box with GPU tests on lavapipe. The 4 Python errors are that box's git 2.34 (`git merge-tree --write-tree`, in `test_nightly_set` and `test_supervise`); they pass with git 2.55. 🤖 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 06:11:30 +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#6082
No description provided.