[PR #79] [MERGED] Clouds: draw to the Cloud Distance option, not the render distance (fixes #67) #2310

Closed
opened 2026-11-02 15:54:49 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/79
Author: @ludovic111
Created: 10/14/2026
Status: ✅ Merged
Merged: 10/14/2026
Merged by: @ludovic111

Base: main ← Head: fix/cloud-distance-67


📝 Commits (1)

  • 12eca8a Clouds: draw to the Cloud Distance option, not the render distance (#67)

📊 Changes

11 files changed (+95 additions, -14 deletions)

View changed files

📝 crates/horizon-client/examples/cloud_fixture.rs (+6 -1)
📝 crates/horizon-client/examples/environment_fixture.rs (+4 -0)
📝 crates/horizon-client/src/camera.rs (+13 -0)
📝 crates/horizon-client/src/clouds.rs (+12 -0)
📝 crates/horizon-client/src/environment.rs (+6 -0)
📝 crates/horizon-client/src/fog.rs (+27 -1)
📝 crates/horizon-client/src/game.rs (+8 -3)
📝 crates/horizon-client/src/game/render_tick.rs (+1 -0)
📝 crates/horizon-client/src/gfx.rs (+7 -6)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCloudRenderOracle.java (+6 -2)
📝 tools/test_cloud_render_parity.py (+5 -1)

📄 Description

What was wrong

Clouds stopped at the render distance. Three things were tied to it instead of the Cloud Distance option (cloudRange, which Horizon already stored in options.txt and showed in Video Settings but never used):

  • the cloud mesh radius was ceil(renderDistance * 16 / 12) cells;
  • the far plane was max(4 × render distance, 1024), so clouds past 1024 blocks were clipped anyway;
  • the cloud fog end was a constant min(2048, 128 * 16).

What vanilla does (26.3)

  • CloudRenderer.prepare(…, range, …): radiusBlocks = range * 16, radiusCells = Mth.ceil(radiusBlocks / 12.0F), where range is options.cloudRange() (LevelRenderer → OptionsRenderState.cloudRange).
  • Camera.update: depthFar = max(renderDistance * 4, cloudRange * 16) with renderDistance = effectiveRenderDistance * 16. It is the far plane of the world projection, of the hand projection (GameRenderer) and of the world border (WorldBorderRenderer.prepare). There is no 1024 floor.
  • AtmosphericFogEnvironment.setupFog: cloudEnd = min(cloudRange * 16, visual/cloud_fog_end_distance) (attribute default 2048).

Horizon now does the same: clouds::radius_cells, camera::depth_far (new Frame::depth_far, used for the projection, frustum, hand projection and world border), FogInputs::cloud_range_chunks, and Sky::cloud_fog_end read from the environment attribute.

How it's tested

  • tools/test_cloud_render_parity.py gains Cloud Distance cases 2…128 chunks: the oracle builds the shipped CloudRenderer.buildMesh at vanilla's radius for that range, the probe uses clouds::radius_cells: 3,190/3,190 lines match (was 3,180).
  • tools/test_environment_render_parity.py now also compares visual/cloud_fog_end_distance (no longer in the "not modelled" list): ok.
  • Unit tests: clouds::radius_cells, camera::depth_far, and the cloud fog end in fog::tests.
  • Same saved world on vscreen at render distance 8, Cloud Distance 128: before, Horizon showed only the clouds within 8 chunks; after, the cloud layer reaches the horizon like vanilla 26.3 joined into the same save. (Screenshots kept locally; the vanilla one contains Mojang textures so it isn't uploaded.)
  • cargo fmt --all --check, cargo clippy --workspace --all-targets -D warnings, cargo test --workspace, python tools/check_public_tree.py.

Fixes #67

🤖 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/79 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/14/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/cloud-distance-67` --- ### 📝 Commits (1) - [`12eca8a`](https://github.com/horizon-rust/horizon/commit/12eca8a5c139f4f47711b45101279b8417763ea7) Clouds: draw to the Cloud Distance option, not the render distance (#67) ### 📊 Changes **11 files changed** (+95 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/cloud_fixture.rs` (+6 -1) 📝 `crates/horizon-client/examples/environment_fixture.rs` (+4 -0) 📝 `crates/horizon-client/src/camera.rs` (+13 -0) 📝 `crates/horizon-client/src/clouds.rs` (+12 -0) 📝 `crates/horizon-client/src/environment.rs` (+6 -0) 📝 `crates/horizon-client/src/fog.rs` (+27 -1) 📝 `crates/horizon-client/src/game.rs` (+8 -3) 📝 `crates/horizon-client/src/game/render_tick.rs` (+1 -0) 📝 `crates/horizon-client/src/gfx.rs` (+7 -6) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCloudRenderOracle.java` (+6 -2) 📝 `tools/test_cloud_render_parity.py` (+5 -1) </details> ### 📄 Description ## What was wrong Clouds stopped at the render distance. Three things were tied to it instead of the Cloud Distance option (`cloudRange`, which Horizon already stored in options.txt and showed in Video Settings but never used): - the cloud mesh radius was `ceil(renderDistance * 16 / 12)` cells; - the far plane was `max(4 × render distance, 1024)`, so clouds past 1024 blocks were clipped anyway; - the cloud fog end was a constant `min(2048, 128 * 16)`. ## What vanilla does (26.3) - `CloudRenderer.prepare(…, range, …)`: `radiusBlocks = range * 16`, `radiusCells = Mth.ceil(radiusBlocks / 12.0F)`, where `range` is `options.cloudRange()` (`LevelRenderer` → `OptionsRenderState.cloudRange`). - `Camera.update`: `depthFar = max(renderDistance * 4, cloudRange * 16)` with `renderDistance = effectiveRenderDistance * 16`. It is the far plane of the world projection, of the hand projection (`GameRenderer`) and of the world border (`WorldBorderRenderer.prepare`). There is no 1024 floor. - `AtmosphericFogEnvironment.setupFog`: `cloudEnd = min(cloudRange * 16, visual/cloud_fog_end_distance)` (attribute default 2048). Horizon now does the same: `clouds::radius_cells`, `camera::depth_far` (new `Frame::depth_far`, used for the projection, frustum, hand projection and world border), `FogInputs::cloud_range_chunks`, and `Sky::cloud_fog_end` read from the environment attribute. ## How it's tested - `tools/test_cloud_render_parity.py` gains Cloud Distance cases 2…128 chunks: the oracle builds the shipped `CloudRenderer.buildMesh` at vanilla's radius for that range, the probe uses `clouds::radius_cells`: **3,190/3,190 lines match** (was 3,180). - `tools/test_environment_render_parity.py` now also compares `visual/cloud_fog_end_distance` (no longer in the "not modelled" list): ok. - Unit tests: `clouds::radius_cells`, `camera::depth_far`, and the cloud fog end in `fog::tests`. - Same saved world on vscreen at render distance 8, Cloud Distance 128: before, Horizon showed only the clouds within 8 chunks; after, the cloud layer reaches the horizon like vanilla 26.3 joined into the same save. (Screenshots kept locally; the vanilla one contains Mojang textures so it isn't uploaded.) - `cargo fmt --all --check`, `cargo clippy --workspace --all-targets -D warnings`, `cargo test --workspace`, `python tools/check_public_tree.py`. Fixes #67 🤖 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-02 15:54:49 +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#2310
No description provided.