[PR #5757] [MERGED] Graphics option: dither a high-resolution cutout's small mips, off by default #6481

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

📋 Pull Request Information

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

Base: main ← Head: fix/cutout-mips-keep-coverage


📝 Commits (10+)

  • 03829bb Mipmaps: dither a high-resolution cutout's small levels
  • 82bd9f6 Merge main into #5403
  • 11843ac Mipmaps: put the cutout dither behind a graphics option, off by default
  • 89be625 Docs: the dither option's row has three cells
  • 3ab39ea Merge remote-tracking branch 'origin/main' into shader/s8-shadow-entities
  • b1d6819 Native mods: the screen hears of the wheel before it scrolls
  • 43207a5 Shader API: entities cast into the shadow map
  • c901615 Merge branch 'screen-mouse-button' into screen-mouse-scrolled
  • 11cd3f2 Shader API: the first-person player casts into the shadow map
  • bbbb185 Shader API: materials, an id by sprite, and shadows cut whole

📊 Changes

110 files changed (+5840 additions, -708 deletions)

View changed files

📝 Cargo.lock (+1 -0)
📝 crates/horizon-client-render/src/assets.rs (+8 -0)
📝 crates/horizon-client-render/src/containers.rs (+62 -0)
📝 crates/horizon-client-render/src/fast_hash.rs (+3 -85)
📝 crates/horizon-client-render/src/gfx.rs (+185 -16)
➕ crates/horizon-client-render/src/gfx/block_light.rs (+224 -0)
📝 crates/horizon-client-render/src/gfx/entity_batch.rs (+5 -0)
📝 crates/horizon-client-render/src/gfx/native_material.rs (+79 -19)
📝 crates/horizon-client-render/src/gfx/native_pack.rs (+49 -5)
📝 crates/horizon-client-render/src/gfx/native_post.rs (+501 -134)
📝 crates/horizon-client-render/src/gfx/native_shadow.rs (+180 -8)
📝 crates/horizon-client-render/src/gfx/native_sky.rs (+1 -1)
📝 crates/horizon-client-render/src/gfx/weather.rs (+169 -2)
📝 crates/horizon-client-render/src/graphics.rs (+17 -1)
📝 crates/horizon-client-render/src/graphics_ui.rs (+9 -0)
📝 crates/horizon-client-render/src/hud.rs (+6 -0)
📝 crates/horizon-client-render/src/mesher.rs (+8 -0)
📝 crates/horizon-client-render/src/mipmap.rs (+123 -0)
📝 crates/horizon-client-render/src/options_ui.rs (+117 -44)
📝 crates/horizon-client-render/src/settings.rs (+1 -0)

...and 80 more files

📄 Description

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

Fixes #5402. This is the graphics-option version #5403 was closed in favour of. That description predated the option and still read as if the dither applied to everyone, so here it is restated.

What

  • A new Horizon graphics option, Distant Plant Dither (ditherCutoutMips in horizon-graphics.txt), off by default. With it off, every mip level is computed as before: vanilla's mean plus scaleAlphaToCoverage.
  • With it on, for a cutout whose base level is at least 64 texels wide, each level below the base takes the mean alpha through a 4x4 ordered dither, so its texels are in or out, about as many in as the base has. Textures under 64 texels, vanilla's included, are unchanged either way.
  • Changing it reloads the textures. The sprite cache's VERSION goes to 2, so decoded textures are rebuilt once, which is a one-time cost for everyone, including with the option off.

Why

A high-resolution pack's grass has blades about one texel wide. Averaged down, those texels all fall under the cutoff at small levels, and the plant disappears a short way off.

Proof

Test: a_high_resolution_cutouts_fine_detail_keeps_its_coverage_in_small_mips: blades one texel wide, one column in four, keep 15-35% coverage in the small levels.

In game on Linux (RTX 3050 Ti), single player, with a throwaway resource pack whose short_grass is 64x64 with one-texel blades, one column in four, on a 31x31 field seen from about 60 blocks away:

  • Option off, its default: the field shows bare grass block; no blade draws at that distance.
  • Option on: the blades draw across the whole field and past its far edge against the sky.

Average colour of that crop: 144,160,160 off and 146,166,160 on. I set the option through horizon-graphics.txt and restarted, not through the screen. No screenshots attached: they'd have to be committed to upload, and the scene shows Mojang textures.

Not checked: how the dither looks in motion, a real high-resolution pack on this branch, and lan_e2e (client-only rendering). Parity is unaffected with the option off by construction, but I haven't run those harnesses.

pr_ready (tools/pr_ready.py --quick on teiwazik-laptop, against origin/main at 3bc251ea5, 6 min 58 s)

Check Result
Scope ✅ 7 files, +148 −1
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 511 passed (33 s)
rustfmt ✅ (8 s)
clippy ✅ (52 s)
tests: horizon-client, horizon-client-render ✅ 2492 passed (5 min 22 s)
doc tests ✅ 0 passed (2 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)

🤖 Generated with Claude Code

https://claude.ai/code/session_01EBqm1v5zTsDGwuZF6XKFjL


🔄 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/5757 **Author:** [@Teiwazik](https://github.com/Teiwazik) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/cutout-mips-keep-coverage` --- ### 📝 Commits (10+) - [`03829bb`](https://github.com/horizon-rust/horizon/commit/03829bb88eb3d2d789e0b6d2efe26f25a0853df3) Mipmaps: dither a high-resolution cutout's small levels - [`82bd9f6`](https://github.com/horizon-rust/horizon/commit/82bd9f6f37cb31b28c7e59a8fa29e3702d55ae18) Merge main into #5403 - [`11843ac`](https://github.com/horizon-rust/horizon/commit/11843ac18b909eb7535b7fc6239724dc8b747546) Mipmaps: put the cutout dither behind a graphics option, off by default - [`89be625`](https://github.com/horizon-rust/horizon/commit/89be6259dad985ad39955cb64eef3a6274db6354) Docs: the dither option's row has three cells - [`3ab39ea`](https://github.com/horizon-rust/horizon/commit/3ab39ea98415cf91cbf58af324e3afcc87f8260c) Merge remote-tracking branch 'origin/main' into shader/s8-shadow-entities - [`b1d6819`](https://github.com/horizon-rust/horizon/commit/b1d6819737cabae0cda4c11268d1dfc9954cb652) Native mods: the screen hears of the wheel before it scrolls - [`43207a5`](https://github.com/horizon-rust/horizon/commit/43207a5a3d6afeee0061ed6aef9c68dcd0ce8d24) Shader API: entities cast into the shadow map - [`c901615`](https://github.com/horizon-rust/horizon/commit/c90161511b9404e22911a177208490b058d15e0f) Merge branch 'screen-mouse-button' into screen-mouse-scrolled - [`11cd3f2`](https://github.com/horizon-rust/horizon/commit/11cd3f220d91b1b99febea60ce035150bd8996b8) Shader API: the first-person player casts into the shadow map - [`bbbb185`](https://github.com/horizon-rust/horizon/commit/bbbb18595fdb024b76a7dda8e78a2ce92c7ad0dc) Shader API: [[materials]], an id by sprite, and shadows cut whole ### 📊 Changes **110 files changed** (+5840 additions, -708 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+1 -0) 📝 `crates/horizon-client-render/src/assets.rs` (+8 -0) 📝 `crates/horizon-client-render/src/containers.rs` (+62 -0) 📝 `crates/horizon-client-render/src/fast_hash.rs` (+3 -85) 📝 `crates/horizon-client-render/src/gfx.rs` (+185 -16) ➕ `crates/horizon-client-render/src/gfx/block_light.rs` (+224 -0) 📝 `crates/horizon-client-render/src/gfx/entity_batch.rs` (+5 -0) 📝 `crates/horizon-client-render/src/gfx/native_material.rs` (+79 -19) 📝 `crates/horizon-client-render/src/gfx/native_pack.rs` (+49 -5) 📝 `crates/horizon-client-render/src/gfx/native_post.rs` (+501 -134) 📝 `crates/horizon-client-render/src/gfx/native_shadow.rs` (+180 -8) 📝 `crates/horizon-client-render/src/gfx/native_sky.rs` (+1 -1) 📝 `crates/horizon-client-render/src/gfx/weather.rs` (+169 -2) 📝 `crates/horizon-client-render/src/graphics.rs` (+17 -1) 📝 `crates/horizon-client-render/src/graphics_ui.rs` (+9 -0) 📝 `crates/horizon-client-render/src/hud.rs` (+6 -0) 📝 `crates/horizon-client-render/src/mesher.rs` (+8 -0) 📝 `crates/horizon-client-render/src/mipmap.rs` (+123 -0) 📝 `crates/horizon-client-render/src/options_ui.rs` (+117 -44) 📝 `crates/horizon-client-render/src/settings.rs` (+1 -0) _...and 80 more files_ </details> ### 📄 Description > 🤖 Opened by Teiwazik's AI agent (Claude Code, Claude Opus 5.5), not by Teiwazik personally. Fixes #5402. This is the graphics-option version #5403 was closed in favour of. That description predated the option and still read as if the dither applied to everyone, so here it is restated. ## What - A new Horizon graphics option, Distant Plant Dither (`ditherCutoutMips` in `horizon-graphics.txt`), **off by default**. With it off, every mip level is computed as before: vanilla's mean plus `scaleAlphaToCoverage`. - With it on, for a cutout whose base level is at least 64 texels wide, each level below the base takes the mean alpha through a 4x4 ordered dither, so its texels are in or out, about as many in as the base has. Textures under 64 texels, vanilla's included, are unchanged either way. - Changing it reloads the textures. The sprite cache's `VERSION` goes to 2, so decoded textures are rebuilt once, which is a one-time cost for everyone, including with the option off. ## Why A high-resolution pack's grass has blades about one texel wide. Averaged down, those texels all fall under the cutoff at small levels, and the plant disappears a short way off. ## Proof Test: `a_high_resolution_cutouts_fine_detail_keeps_its_coverage_in_small_mips`: blades one texel wide, one column in four, keep 15-35% coverage in the small levels. In game on Linux (RTX 3050 Ti), single player, with a throwaway resource pack whose `short_grass` is 64x64 with one-texel blades, one column in four, on a 31x31 field seen from about 60 blocks away: - Option off, its default: the field shows bare grass block; no blade draws at that distance. - Option on: the blades draw across the whole field and past its far edge against the sky. Average colour of that crop: `144,160,160` off and `146,166,160` on. I set the option through `horizon-graphics.txt` and restarted, not through the screen. No screenshots attached: they'd have to be committed to upload, and the scene shows Mojang textures. Not checked: how the dither looks in motion, a real high-resolution pack on this branch, and `lan_e2e` (client-only rendering). Parity is unaffected with the option off by construction, but I haven't run those harnesses. **pr_ready** (`tools/pr_ready.py --quick` on teiwazik-laptop, against origin/main at 3bc251ea5, 6 min 58 s) | Check | Result | | --- | --- | | Scope | ✅ 7 files, +148 −1 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 511 passed (33 s) | | rustfmt | ✅ (8 s) | | clippy | ✅ (52 s) | | tests: horizon-client, horizon-client-render | ✅ 2492 passed (5 min 22 s) | | doc tests | ✅ 0 passed (2 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) | 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EBqm1v5zTsDGwuZF6XKFjL --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:21:19 +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#6481
No description provided.