[PR #6198] [MERGED] OptiFine packs: connected textures drawn in the world #6715

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

📋 Pull Request Information

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

Base: main ← Head: optifine/ctm-draw


📝 Commits (6)

  • 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
  • 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

📊 Changes

1 file changed (+285 additions, -46 deletions)

View changed files

📝 crates/horizon-client-render/src/mesher.rs (+285 -46)

📄 Description

Since #5746, Horizon knows which connected-texture tile each block face of an OptiFine or Continuity pack should get, but the mesher still draws every face with its own sprite. Glass doesn't join, bookshelves don't line up, and random textures don't vary. This PR makes the mesher draw the picked tiles.

In Mesher::face (crates/horizon-client-render/src/mesher.rs):

  • When the packs have CTM rules, each quad asks ConnectedTextures::pick for its sprite. Neighbours are read from the mesher's padded section, so there are no extra chunk lookups. Rules that test biomes get the block's biome (the same lookup the tints use, without blending).
  • A picked tile swaps the quad's sprite layer. The quad lands in the solid or translucent pass by the tile's own alpha (plus the quad's forced translucency and main's per-layer translucency), so a translucent tile on an opaque block still sorts correctly.
  • ctm_compact cuts the quad where its UVs cross the sprite's middle, and each piece gets its quarter's tile. Both axes use the same cuts and colour, light and AO are blended within the quad's two triangles, the way the GPU blends the whole quad, so a split face shades exactly like an unsplit one.
  • Tints::get and the biome rules share one biome lookup (Tints::biome_id).
  • Without CTM files, connected.is_empty() skips all of this. The vertices, their order, layer bits and passes are the same as before (merged with main's interior_leaf leaf culling and translucent_layers).

Not yet: overlays (next PR, stacked on this one), Continuity's emissive tiles and connected glass panes.

Docs used: OptiFine's OptiFineDoc/doc/ctm.properties and ctm_compact_template.png. No mod source was read.

Checks: cargo fmt. New tests quarter_tests::quarters_blend_the_corners_by_triangle and compact_faces_cut_where_the_sprite_does (hand-worked values; cargo test -p horizon-client-render --lib quarter_tests passes). Fork CI: runs on each push at https://github.com/some-du6e/horizon/actions?query=branch%3Aoptifine%2Fctm-draw. Nothing was built on this machine. Reviewed by fresh agent rounds (results in the comments). There's no live game test: this machine has no vanilla data (.local/) to launch the game with.

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/6198 **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-draw` --- ### 📝 Commits (6) - [`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 - [`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 ### 📊 Changes **1 file changed** (+285 additions, -46 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/mesher.rs` (+285 -46) </details> ### 📄 Description Since #5746, Horizon knows which connected-texture tile each block face of an OptiFine or Continuity pack should get, but the mesher still draws every face with its own sprite. Glass doesn't join, bookshelves don't line up, and random textures don't vary. This PR makes the mesher draw the picked tiles. In `Mesher::face` (`crates/horizon-client-render/src/mesher.rs`): - When the packs have CTM rules, each quad asks `ConnectedTextures::pick` for its sprite. Neighbours are read from the mesher's padded section, so there are no extra chunk lookups. Rules that test biomes get the block's biome (the same lookup the tints use, without blending). - A picked tile swaps the quad's sprite layer. The quad lands in the solid or translucent pass by the tile's own alpha (plus the quad's forced translucency and main's per-layer translucency), so a translucent tile on an opaque block still sorts correctly. - `ctm_compact` cuts the quad where its UVs cross the sprite's middle, and each piece gets its quarter's tile. Both axes use the same cuts and colour, light and AO are blended within the quad's two triangles, the way the GPU blends the whole quad, so a split face shades exactly like an unsplit one. - `Tints::get` and the biome rules share one biome lookup (`Tints::biome_id`). - Without CTM files, `connected.is_empty()` skips all of this. The vertices, their order, layer bits and passes are the same as before (merged with main's `interior_leaf` leaf culling and `translucent_layers`). Not yet: overlays (next PR, stacked on this one), Continuity's emissive tiles and connected glass panes. **Docs used:** OptiFine's `OptiFineDoc/doc/ctm.properties` and `ctm_compact_template.png`. No mod source was read. **Checks:** `cargo fmt`. New tests `quarter_tests::quarters_blend_the_corners_by_triangle` and `compact_faces_cut_where_the_sprite_does` (hand-worked values; `cargo test -p horizon-client-render --lib quarter_tests` passes). Fork CI: runs on each push at https://github.com/some-du6e/horizon/actions?query=branch%3Aoptifine%2Fctm-draw. Nothing was built on this machine. Reviewed by fresh agent rounds (results in the comments). There's no live game test: this machine has no vanilla data (`.local/`) to launch the game with. > [!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:25:21 +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#6715
No description provided.