[PR #6250] [MERGED] OptiFine packs: connected-texture overlays (block transitions) #6742

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

📋 Pull Request Information

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

Base: main ← Head: optifine/ctm-overlay


📝 Commits (10+)

  • 9c56a91 OptiFine CTM: connected textures drawn in the world
  • 7f0f3cb OptiFine CTM: compact quarters shade like the whole face
  • 0c8d593 Merge branch 'optifine/ctm-mesh' into optifine/ctm-draw
  • 73de5ed OptiFine CTM: overlays
  • e23b8c8 Merge remote-tracking branch 'origin/main' into optifine/ctm-draw
  • c999da7 OptiFine CTM: compact quarters meet where the sprite's halves do
  • 82c95b7 OptiFine CTM: compact cuts shared by both axes; one biome lookup
  • dd4b388 Merge branch 'optifine/ctm-draw' into optifine/ctm-overlay
  • c3b3166 OptiFine CTM overlays: review fixes
  • 9cdbe81 OptiFine CTM overlays: their pass follows the tile the face drew

📊 Changes

2 files changed (+627 additions, -67 deletions)

View changed files

📝 crates/horizon-client-render/src/connected.rs (+274 -17)
📝 crates/horizon-client-render/src/mesher.rs (+353 -50)

📄 Description

OptiFine packs use overlays for block transitions: grass creeping onto the dirt beside it, sand edges on stone, moss on bricks. A rule with method=overlay draws its tiles over a block's face toward the neighbours it names, and the overlay_* methods lay a decoration over the face. Horizon read these rules but never loaded or drew them. This PR adds them.

Depends on #6198 (its commits are at the bottom of this branch). Review only connected.rs and the overlay part of mesher.rs.

  • overlay: the 17 transition tiles of OptiFine's overlay_template.png, toward neighbours named by connectBlocks (matched per block state) or connectTiles (the neighbour's sprite on the same side). Sides that face each other take two tiles, since the template has none for that case. A corner tile is drawn only where neither side beside it is drawn. With neither list, an overlay rule draws nothing.
  • overlay_ctm, overlay_random, overlay_repeat, overlay_fixed and Continuity's overlay_horizontal, overlay_vertical, overlay_h+v and overlay_v+h pick their tile the way their method does, joining by connect. The doc marks connectBlocks/connectTiles as "only for method overlay", so they are ignored there.
  • Order, as OptiFine documents it (and Continuity's prioritize example shows): overlays apply when they come before the rule that picks the face's own sprite. Every overlay rule before that rule draws, and the face itself is still chosen by the first non-overlay rule.
  • Drawing: each overlay is the face's quad again, emitted right after it at the same depth (the terrain depth test is GreaterEqual, so it wins). With the default layer=cutout it is alpha-tested whatever its tile's alpha; with layer=translucent, or over a translucent face (glass), it goes in the translucent pass. It is never marked opaque. tintIndex and tintBlock tint it with that block's tint source (the face's own block when tintBlock is absent; a tintBlock the game doesn't have tints nothing). At most 8 overlays are drawn per face.
  • Without CTM files nothing changes: the mesher's check is still connected.is_empty().

Docs used: OptiFine's OptiFineDoc/doc/ctm.properties (overlay, connectTiles, connectBlocks, tintIndex, tintBlock, layer) and overlay_template.png, and Continuity's wiki page "Continuity Connected Textures Specification" (the overlay methods it adds). No mod source was read.

Checks: cargo fmt. New tests in connected.rs (overlays_draw_toward_the_blocks_they_name, overlay_joins_layers_and_tints, overlay_methods_pick_like_their_own) check the tiles against values worked out from the template; cargo test -p horizon-client-render --lib connected:: passes (14 tests). Fork CI runs on each push: https://github.com/some-du6e/horizon/actions?query=branch%3Aoptifine%2Fctm-overlay. Nothing was built on this machine. Reviewed by fresh agent rounds. There's no live game test: this machine has no vanilla data (.local/).

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/6250 **Author:** [@some-du6e](https://github.com/some-du6e) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `optifine/ctm-overlay` --- ### 📝 Commits (10+) - [`9c56a91`](https://github.com/horizon-rust/horizon/commit/9c56a91d8238fd9437edd350e808a92fabf152cc) OptiFine CTM: connected textures drawn in the world - [`7f0f3cb`](https://github.com/horizon-rust/horizon/commit/7f0f3cba929854535528c8c2bbb46a10c4c35e0a) OptiFine CTM: compact quarters shade like the whole face - [`0c8d593`](https://github.com/horizon-rust/horizon/commit/0c8d593d3ae30600bcc1eec9d78e3d974d5340db) Merge branch 'optifine/ctm-mesh' into optifine/ctm-draw - [`73de5ed`](https://github.com/horizon-rust/horizon/commit/73de5edebdfc1efaed39fda0997b9cc4decb3e87) OptiFine CTM: overlays - [`e23b8c8`](https://github.com/horizon-rust/horizon/commit/e23b8c8eeed27345abd71b633dd01f786b0e8c6b) Merge remote-tracking branch 'origin/main' into optifine/ctm-draw - [`c999da7`](https://github.com/horizon-rust/horizon/commit/c999da747332eeeef0b098d325ec94919f9d116e) OptiFine CTM: compact quarters meet where the sprite's halves do - [`82c95b7`](https://github.com/horizon-rust/horizon/commit/82c95b7102f090fda00b484685134b016dbdfe6e) OptiFine CTM: compact cuts shared by both axes; one biome lookup - [`dd4b388`](https://github.com/horizon-rust/horizon/commit/dd4b388f3eb7caa9954b78453985635906d8b4e6) Merge branch 'optifine/ctm-draw' into optifine/ctm-overlay - [`c3b3166`](https://github.com/horizon-rust/horizon/commit/c3b316607b365d93c06a3f6e159bf529780b3d0b) OptiFine CTM overlays: review fixes - [`9cdbe81`](https://github.com/horizon-rust/horizon/commit/9cdbe813a656ada1fdd61332f3e774762b0aa19e) OptiFine CTM overlays: their pass follows the tile the face drew ### 📊 Changes **2 files changed** (+627 additions, -67 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/connected.rs` (+274 -17) 📝 `crates/horizon-client-render/src/mesher.rs` (+353 -50) </details> ### 📄 Description OptiFine packs use overlays for block transitions: grass creeping onto the dirt beside it, sand edges on stone, moss on bricks. A rule with `method=overlay` draws its tiles over a block's face toward the neighbours it names, and the `overlay_*` methods lay a decoration over the face. Horizon read these rules but never loaded or drew them. This PR adds them. **Depends on #6198** (its commits are at the bottom of this branch). Review only `connected.rs` and the overlay part of `mesher.rs`. - `overlay`: the 17 transition tiles of OptiFine's `overlay_template.png`, toward neighbours named by `connectBlocks` (matched per block state) or `connectTiles` (the neighbour's sprite on the same side). Sides that face each other take two tiles, since the template has none for that case. A corner tile is drawn only where neither side beside it is drawn. With neither list, an `overlay` rule draws nothing. - `overlay_ctm`, `overlay_random`, `overlay_repeat`, `overlay_fixed` and Continuity's `overlay_horizontal`, `overlay_vertical`, `overlay_h+v` and `overlay_v+h` pick their tile the way their method does, joining by `connect`. The doc marks `connectBlocks`/`connectTiles` as "only for method overlay", so they are ignored there. - Order, as OptiFine documents it (and Continuity's `prioritize` example shows): overlays apply when they come before the rule that picks the face's own sprite. Every overlay rule before that rule draws, and the face itself is still chosen by the first non-overlay rule. - Drawing: each overlay is the face's quad again, emitted right after it at the same depth (the terrain depth test is `GreaterEqual`, so it wins). With the default `layer=cutout` it is alpha-tested whatever its tile's alpha; with `layer=translucent`, or over a translucent face (glass), it goes in the translucent pass. It is never marked opaque. `tintIndex` and `tintBlock` tint it with that block's tint source (the face's own block when `tintBlock` is absent; a `tintBlock` the game doesn't have tints nothing). At most 8 overlays are drawn per face. - Without CTM files nothing changes: the mesher's check is still `connected.is_empty()`. **Docs used:** OptiFine's `OptiFineDoc/doc/ctm.properties` (overlay, connectTiles, connectBlocks, tintIndex, tintBlock, layer) and `overlay_template.png`, and Continuity's wiki page "Continuity Connected Textures Specification" (the overlay methods it adds). No mod source was read. **Checks:** `cargo fmt`. New tests in `connected.rs` (`overlays_draw_toward_the_blocks_they_name`, `overlay_joins_layers_and_tints`, `overlay_methods_pick_like_their_own`) check the tiles against values worked out from the template; `cargo test -p horizon-client-render --lib connected::` passes (14 tests). Fork CI runs on each push: https://github.com/some-du6e/horizon/actions?query=branch%3Aoptifine%2Fctm-overlay. Nothing was built on this machine. Reviewed by fresh agent rounds. There's no live game test: this machine has no vanilla data (`.local/`). > [!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:26:00 +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#6742
No description provided.