[PR #4825] [MERGED] Post-effect chains: draw post_effect JSON over the world, handle ClientboundPostEffects #5875

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

📋 Pull Request Information

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

Base: main ← Head: parity/E1-post-chain


📝 Commits (1)

  • a55abdf Draw post_effect chains over the world (PostChain, PostPass, handlePostEffects)

📊 Changes

8 files changed (+1401 additions, -6 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx.rs (+26 -1)
📝 crates/horizon-client-render/src/lib.rs (+1 -0)
➕ crates/horizon-client-render/src/post_chain.rs (+1195 -0)
➕ crates/horizon-client-render/src/post_chain.wgsl (+124 -0)
📝 crates/horizon-client/src/game.rs (+23 -0)
📝 crates/horizon-client/src/game/remote.rs (+2 -0)
📝 crates/horizon-client/src/lib.rs (+5 -5)
📝 crates/horizon-protocol/src/packets/play.rs (+25 -0)

📄 Description

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

Part of #3518

Rows:

  • ClientCommonPacketListenerImpl.handlePostEffects: new ClientboundPostEffectsPacket (typed in horizon-protocol) sets LocalPlayer.postEffects (Game::post_effects), cleared when the world closes.

Also the renderer those effects need (PostChain, PostChainConfig, PostPass, GameRenderer.preparePostEffects/applyPostEffects), new horizon-client-render/src/post_chain.rs:

  • post_effect/*.json are read at run time from the active resource root (so resource packs can replace or add chains); nothing from Mojang is committed.
  • Passes run over the frame after the entity outline and before the GUI; the frame is copied to a work texture, chains run on it, and it is blitted back. Internal targets, clear_color, persistent, bilinear, std140 uniform blocks follow vanilla.
  • The shaders a pass names are Horizon's own WGSL stand-ins (post_chain.wgsl) for core/screenquad, post/rotscale, invert, blit, bits, color_convolve, box_blur, spiderclip. A chain naming another shader, a texture/depth input or a target other than main fails once (failedPostEffects) and is skipped. entity_outline keeps its own hard-coded chain.
  • Slightly over the size guideline (~890 lines of Rust, mostly rustfmt expansion); it is one self-contained module.

Vanilla followed: PostChain.load/addToFrame, PostPass.addToFrame, PostChainConfig codecs, UniformValue, GameRenderer.update/preparePostEffects/applyPostEffects, ClientCommonPacketListenerImpl.handlePostEffects.

Tests: config parsing, std140 packing, WGSL validation, a GPU run of a two-pass chain (skips without an adapter), the vanilla chains load (skips without .local), packet round trip. Visual check on the fast build (stacked with the follow-up PR that sends the packet): /posteffect add @s minecraft:invert inverts the world, the HUD and chat are untouched; without it the frame is unchanged.

🤖 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/4825 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `parity/E1-post-chain` --- ### 📝 Commits (1) - [`a55abdf`](https://github.com/horizon-rust/horizon/commit/a55abdfe89c1cd17f12f41169f6b9c2d515d1eff) Draw post_effect chains over the world (PostChain, PostPass, handlePostEffects) ### 📊 Changes **8 files changed** (+1401 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx.rs` (+26 -1) 📝 `crates/horizon-client-render/src/lib.rs` (+1 -0) ➕ `crates/horizon-client-render/src/post_chain.rs` (+1195 -0) ➕ `crates/horizon-client-render/src/post_chain.wgsl` (+124 -0) 📝 `crates/horizon-client/src/game.rs` (+23 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+2 -0) 📝 `crates/horizon-client/src/lib.rs` (+5 -5) 📝 `crates/horizon-protocol/src/packets/play.rs` (+25 -0) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent (Claude Code, Claude Sonnet 5.5), not by levzzz5154 personally. Part of #3518 Rows: - `ClientCommonPacketListenerImpl.handlePostEffects`: new `ClientboundPostEffectsPacket` (typed in horizon-protocol) sets `LocalPlayer.postEffects` (`Game::post_effects`), cleared when the world closes. Also the renderer those effects need (`PostChain`, `PostChainConfig`, `PostPass`, `GameRenderer.preparePostEffects/applyPostEffects`), new `horizon-client-render/src/post_chain.rs`: - `post_effect/*.json` are read at run time from the active resource root (so resource packs can replace or add chains); nothing from Mojang is committed. - Passes run over the frame after the entity outline and before the GUI; the frame is copied to a work texture, chains run on it, and it is blitted back. Internal targets, `clear_color`, `persistent`, `bilinear`, std140 uniform blocks follow vanilla. - The shaders a pass names are Horizon's own WGSL stand-ins (`post_chain.wgsl`) for `core/screenquad`, `post/rotscale`, `invert`, `blit`, `bits`, `color_convolve`, `box_blur`, `spiderclip`. A chain naming another shader, a texture/depth input or a target other than `main` fails once (`failedPostEffects`) and is skipped. `entity_outline` keeps its own hard-coded chain. - Slightly over the size guideline (~890 lines of Rust, mostly rustfmt expansion); it is one self-contained module. Vanilla followed: `PostChain.load/addToFrame`, `PostPass.addToFrame`, `PostChainConfig` codecs, `UniformValue`, `GameRenderer.update/preparePostEffects/applyPostEffects`, `ClientCommonPacketListenerImpl.handlePostEffects`. Tests: config parsing, std140 packing, WGSL validation, a GPU run of a two-pass chain (skips without an adapter), the vanilla chains load (skips without `.local`), packet round trip. Visual check on the fast build (stacked with the follow-up PR that sends the packet): `/posteffect add @s minecraft:invert` inverts the world, the HUD and chat are untouched; without it the frame is unchanged. 🤖 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:15:37 +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#5875
No description provided.