[PR #6640] [MERGED] Fusion packs: connected glass and other connecting models join in the world #7008

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6640
Author: @some-du6e
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: optifine/fusion-mesh


📝 Commits (6)

  • 285d8ee Fusion packs: connecting models join their textures in the world
  • c297914 Fusion packs: each baked face carries its rule, so multipart and weighted models join right
  • e0218fe Fusion models: each face joins by its own key, and linked texture folders are read
  • 7e70a77 Fusion faces: a two-byte rule, sprite objects, and tinted overlay pieces
  • 16e35d4 Merge remote-tracking branch 'origin/main' into optifine/fusion-mesh
  • b4330be Merge main into #6640

📊 Changes

9 files changed (+739 additions, -25 deletions)

View changed files

📝 crates/horizon-client-render/src/assets.rs (+9 -1)
📝 crates/horizon-client-render/src/breaking.rs (+1 -0)
📝 crates/horizon-client-render/src/connected.rs (+2 -0)
➕ crates/horizon-client-render/src/fusion.rs (+663 -0)
📝 crates/horizon-client-render/src/lib.rs (+1 -0)
📝 crates/horizon-client-render/src/mesher.rs (+34 -11)
📝 crates/horizon-client-render/src/models/catalog.rs (+10 -0)
📝 crates/horizon-client-render/src/models/cube.rs (+2 -0)
📝 crates/horizon-optifine/src/ctm/connect.rs (+17 -13)

📄 Description

This is the PR where Fusion packs start to show in the world. Fusion Connected Glass and similar packs use fusion:connecting block models whose faces show a connecting texture. With them, glass, panes and bricks join their neighbours instead of each block drawing its own border. Sixth PR of the Fusion stack; depends on #6588 to #6592 and on #6639 (their commits are included here).

What I did.

  • Load (crates/horizon-client-render/src/fusion.rs). The loader finds the textures whose .mcmeta has a fusion section; the scan only reads .mcmeta files and follows linked folders, so a game without Fusion files pays almost nothing. It then visits every baked model (StateModels::models_mut, so multipart arms and weighted variants are all covered). It reads the model JSON only where a face shows one of those sheets, and only follows parents once the model is fusion:connecting. For each face it records the predicates it joins by: the face's connections reference, else its texture's key, else default, else the texture's own. Faces that share a sprite keep their own keys, matched by side once the blockstate's turns are applied. That face gets BakedFace::fusion = Some(rule). Sheets are cut into tiles (#6639) only when a face uses them. Block names in match_* predicates become sorted state-id lists once, at load.
  • Mesh time. For a face with a rule, FusionTextures::pick runs before OptiFine CTM's in Mesher::face. It evaluates the predicate in the face's eight directions: same block, same state, the neighbour or the block in front of it matching, the neighbour's face visible. It reads only the padded section the mesher already has, then turns the mask into the layout's tiles. The drawing is CTM's: one tile is Pick::Tile, pieced is Pick::Quarters, and the overlay layout's pieces go through Overlay. Faces without a rule do no extra work, and nothing new is drawn per frame.
  • Shared with CTM. I added connect::offsets (the eight neighbour offsets of a face, which connect::neighbours now uses too) and a Pick::Nothing variant: an overlay-layout face draws only its pieces, and an empty tile draws nothing. The CTM thread is still working on chained tiles and orient=texture in connected.rs, so Fusion lives in its own module, and its seam in the mesher is the fused lookup before connected.pick.

Not yet, or on purpose.

  • Directions follow a cube's default UVs. The top and bottom of a model turned about x, or with uvlock, join a quarter turn off. Following the texture's own orientation is CTM's orient=texture work, which I'm staying out of.
  • Not yet: model modifiers (fusion/model_modifiers, which Block Transitions and Emissive Ores use to add their overlay models), emissive/render_type/tinting, and the random, continuous and scrolling types. Those are the next PRs.

Docs used. Fusion is All Rights Reserved, so I read none of its code. I worked from its public wiki: Connecting Texture Type (layouts and predicates), Model Types and Connecting Model Type. The official Fusion Connected Glass and Block Transitions packs show which forms packs use; none of their files are committed.

Checks. cargo fmt; no local build of horizon-client-render on this shared machine. The workspace clippy and test run is on my fork's CI: https://github.com/some-du6e/horizon/actions/runs/41370039955. The tests build the lookups for a hand-made world (air, two glass states, stone, sand, dirt) and check what pick draws:

  • Lone glass is the pieced lone tile in every quarter. Glass to the west of a north face joins its right quarters, even in another state, but stone there doesn't. A face showing another sprite isn't Fusion's.
  • Stone's overlay draws the top-edge piece toward visible sand, nothing when stone covers the sand, and the ring when sand is all round.
  • match_block_in_front joins only where the sand sits in front of the neighbour, and an empty tile draws nothing.
  • Model files written to a temp dir: a pane arm over a template that names its sheet only as particle gives rules only for the faces it draws. The wiki's four-keys-on-one-texture example keeps each face's own predicate, and turned moves faces as blockstate rotations do.

Reviewed in two rounds of fresh reviewers. Round 1 found that per-state rules broke the official glass panes (the post model claimed the sheet), plus wasted load work and the whole sheet inflating every layer's size. Round 2 found that faces sharing a sprite lost their own keys, and that linked texture folders were skipped. All are fixed.

No .local vanilla data on this machine, so no harnesses or live game test; I can't screenshot a pack in game here. It is about 750 lines, over the usual size: about 260 of them are tests, and the seam can't be split from the loader without leaving dead code.

Note

Filed by Opus 5.5 using 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/6640 **Author:** [@some-du6e](https://github.com/some-du6e) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `optifine/fusion-mesh` --- ### 📝 Commits (6) - [`285d8ee`](https://github.com/horizon-rust/horizon/commit/285d8ee8367ecc4cfd2f445a92a40b513266e84e) Fusion packs: connecting models join their textures in the world - [`c297914`](https://github.com/horizon-rust/horizon/commit/c2979141de80ccbaa74675c429f58fe20a305767) Fusion packs: each baked face carries its rule, so multipart and weighted models join right - [`e0218fe`](https://github.com/horizon-rust/horizon/commit/e0218fefbd4b2dde6c7a848107cf8883d39fa09f) Fusion models: each face joins by its own key, and linked texture folders are read - [`7e70a77`](https://github.com/horizon-rust/horizon/commit/7e70a7719f9f7ac64e77ac10993d35f873cd513f) Fusion faces: a two-byte rule, sprite objects, and tinted overlay pieces - [`16e35d4`](https://github.com/horizon-rust/horizon/commit/16e35d4fe6099111d8ab41b2cdda23d294eb53e5) Merge remote-tracking branch 'origin/main' into optifine/fusion-mesh - [`b4330be`](https://github.com/horizon-rust/horizon/commit/b4330bef5c87e78cc13f256938dd721ce0dbd6f2) Merge main into #6640 ### 📊 Changes **9 files changed** (+739 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/assets.rs` (+9 -1) 📝 `crates/horizon-client-render/src/breaking.rs` (+1 -0) 📝 `crates/horizon-client-render/src/connected.rs` (+2 -0) ➕ `crates/horizon-client-render/src/fusion.rs` (+663 -0) 📝 `crates/horizon-client-render/src/lib.rs` (+1 -0) 📝 `crates/horizon-client-render/src/mesher.rs` (+34 -11) 📝 `crates/horizon-client-render/src/models/catalog.rs` (+10 -0) 📝 `crates/horizon-client-render/src/models/cube.rs` (+2 -0) 📝 `crates/horizon-optifine/src/ctm/connect.rs` (+17 -13) </details> ### 📄 Description This is the PR where Fusion packs start to show in the world. Fusion Connected Glass and similar packs use `fusion:connecting` block models whose faces show a connecting texture. With them, glass, panes and bricks join their neighbours instead of each block drawing its own border. Sixth PR of the Fusion stack; depends on #6588 to #6592 and on #6639 (their commits are included here). **What I did.** - **Load** (`crates/horizon-client-render/src/fusion.rs`). The loader finds the textures whose `.mcmeta` has a `fusion` section; the scan only reads `.mcmeta` files and follows linked folders, so a game without Fusion files pays almost nothing. It then visits every baked model (`StateModels::models_mut`, so multipart arms and weighted variants are all covered). It reads the model JSON only where a face shows one of those sheets, and only follows parents once the model is `fusion:connecting`. For each face it records the predicates it joins by: the face's `connections` reference, else its texture's key, else `default`, else the texture's own. Faces that share a sprite keep their own keys, matched by side once the blockstate's turns are applied. That face gets `BakedFace::fusion = Some(rule)`. Sheets are cut into tiles (#6639) only when a face uses them. Block names in `match_*` predicates become sorted state-id lists once, at load. - **Mesh time.** For a face with a rule, `FusionTextures::pick` runs before OptiFine CTM's in `Mesher::face`. It evaluates the predicate in the face's eight directions: same block, same state, the neighbour or the block in front of it matching, the neighbour's face visible. It reads only the padded section the mesher already has, then turns the mask into the layout's tiles. The drawing is CTM's: one tile is `Pick::Tile`, `pieced` is `Pick::Quarters`, and the `overlay` layout's pieces go through `Overlay`. Faces without a rule do no extra work, and nothing new is drawn per frame. - **Shared with CTM.** I added `connect::offsets` (the eight neighbour offsets of a face, which `connect::neighbours` now uses too) and a `Pick::Nothing` variant: an `overlay`-layout face draws only its pieces, and an empty tile draws nothing. The CTM thread is still working on chained tiles and `orient=texture` in `connected.rs`, so Fusion lives in its own module, and its seam in the mesher is the `fused` lookup before `connected.pick`. **Not yet, or on purpose.** - Directions follow a cube's default UVs. The top and bottom of a model turned about x, or with `uvlock`, join a quarter turn off. Following the texture's own orientation is CTM's `orient=texture` work, which I'm staying out of. - Not yet: model modifiers (`fusion/model_modifiers`, which Block Transitions and Emissive Ores use to add their overlay models), `emissive`/`render_type`/`tinting`, and the `random`, `continuous` and `scrolling` types. Those are the next PRs. **Docs used.** Fusion is All Rights Reserved, so I read none of its code. I worked from its public wiki: Connecting Texture Type (layouts and predicates), Model Types and Connecting Model Type. The official Fusion Connected Glass and Block Transitions packs show which forms packs use; none of their files are committed. **Checks.** `cargo fmt`; no local build of `horizon-client-render` on this shared machine. The workspace clippy and test run is on my fork's CI: https://github.com/some-du6e/horizon/actions/runs/41370039955. The tests build the lookups for a hand-made world (air, two glass states, stone, sand, dirt) and check what `pick` draws: - Lone glass is the pieced lone tile in every quarter. Glass to the west of a north face joins its right quarters, even in another state, but stone there doesn't. A face showing another sprite isn't Fusion's. - Stone's overlay draws the top-edge piece toward visible sand, nothing when stone covers the sand, and the ring when sand is all round. - `match_block_in_front` joins only where the sand sits in front of the neighbour, and an empty tile draws nothing. - Model files written to a temp dir: a pane arm over a template that names its sheet only as `particle` gives rules only for the faces it draws. The wiki's four-keys-on-one-texture example keeps each face's own predicate, and `turned` moves faces as blockstate rotations do. Reviewed in two rounds of fresh reviewers. Round 1 found that per-state rules broke the official glass panes (the post model claimed the sheet), plus wasted load work and the whole sheet inflating every layer's size. Round 2 found that faces sharing a sprite lost their own keys, and that linked texture folders were skipped. All are fixed. No `.local` vanilla data on this machine, so no harnesses or live game test; I can't screenshot a pack in game here. It is about 750 lines, over the usual size: about 260 of them are tests, and the seam can't be split from the loader without leaving dead code. > [!NOTE] > Filed by Opus 5.5 using 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:31:55 +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#7008
No description provided.