[PR #1262] [CLOSED] Shader pack stages in Rust: SDK, cargo horizon-shader, Daybreak (inspired by BSL) #3465

Closed
opened 2026-11-03 04:09:44 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1262
Author: @ludovic111
Created: 10/22/2026
Status: ❌ Closed

Base: feat/horizon-shaders-v1 ← Head: feat/horizon-shaders-rust


📝 Commits (1)

  • 0070f46 Shader pack stages in Rust: SDK, cargo horizon-shader, Daybreak

📊 Changes

15 files changed (+1229 additions, -2 deletions)

View changed files

📝 .gitignore (+2 -0)
📝 Cargo.lock (+9 -0)
📝 Cargo.toml (+1 -1)
➕ crates/cargo-horizon-shader/Cargo.toml (+15 -0)
➕ crates/cargo-horizon-shader/src/main.rs (+188 -0)
📝 crates/horizon-client/src/shader_pack.rs (+19 -1)
➕ crates/horizon-shader-sdk/Cargo.toml (+18 -0)
➕ crates/horizon-shader-sdk/src/lib.rs (+274 -0)
➕ examples/shaderpacks/daybreak/Cargo.lock (+118 -0)
➕ examples/shaderpacks/daybreak/Cargo.toml (+28 -0)
➕ examples/shaderpacks/daybreak/LICENSE (+21 -0)
➕ examples/shaderpacks/daybreak/pack.toml (+128 -0)
➕ examples/shaderpacks/daybreak/shaders/daybreak.spv (+0 -0)
➕ examples/shaderpacks/daybreak/shaders/world.wgsl (+161 -0)
➕ examples/shaderpacks/daybreak/src/lib.rs (+247 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Stacked on #1261, the Horizon shaders v1 runtime (base branch feat/horizon-shaders-v1). Adds the Rust side of "Horizon shaders v1" and its first example.

What

  • crates/horizon-shader-sdk (not a workspace member; rust-gpu's own nightly builds it): the stage prelude in Rust, mirroring the WGSL one: Frame and its helpers (linear_depth, view_position, world_offset, project, previous_uv), sample, depth, is_sky, gbuffer_at, shadow_lit, colour helpers, hash, smoothstep, the material ids, and stage!, which writes the entry point with Horizon's bindings; the stage names its group 1 textures and its options' ids.
  • crates/cargo-horizon-shader: cargo horizon-shader build [<pack>] runs rust-gpu's cargo gpu build in the pack folder (it says how to install cargo-gpu when missing), checks every module as the game will (naga: parse, validate, write WGSL, fragment entry points that pack.toml names) and copies it into shaders/. check only checks. Tested end to end on Daybreak.
  • examples/shaderpacks/daybreak (MIT): warm sunlight with soft shadows, a cool sky light, waving plants and leaves, water with waves, Fresnel sky reflections, sun glints and screen-space reflections, a painted sky, height and distance fog, light shafts, ambient occlusion, bloom, a filmic (ACES fit) tonemap and a grade. World hooks in WGSL (shaders/world.wgsl, 160 lines), the five full-screen stages in Rust (src/lib.rs → shaders/daybreak.spv, 46 KB). Ten options, which #1260 shows on the Shader Packs page.

Licence verdict

Daybreak's look is inspired by BSL (Capt Tatsu). BSL is all rights reserved and forbids modified copies, so no BSL code, constants or textures are used: every shader here was written from scratch for Horizon. BSL itself only ran locally, through Horizon's Java pack path, for the comparison below (never committed). Other packs: see the table in docs/shader-packs.md ("Licences of the well-known packs").

Screenshots

Same seed (42), place and view, offscreen at 1280x720 on the M4 Pro. Left: vanilla; middle: Daybreak; right: BSL 10.1.8 through Horizon's Java pack path (full-screen passes only, so no BSL shadows or water yet). Times 1000, 6000, 12400, 18000, then the lake at noon.

sunrise
noon
sunset
night
lake

Daybreak full size: noon sunset lake

Not done: the same view in Iris/OptiFine on the vanilla client (the Mac mini's session is locked and the desktop was in use; FEATURES.md LATER 4y(a)).

Frame times

See #1261: p50 at 1280x720, vanilla → Daybreak: M4 Pro 1.29 → 2.72 ms still, 0.95 → 3.87 ms flying; RTX 4080 0.30 → 0.48 ms still, 0.14 → 0.87 ms flying. BSL through the Java path: 3.03 / 0.59 ms still.

Checks

  • cargo fmt --check, cargo clippy --workspace --all-targets -- -D warnings (now with cargo-horizon-shader): clean.
  • cargo test -p cargo-horizon-shader (2) and -p horizon-client shader (21): pass, including compiled_stages_get_their_options_by_id (a saved fog_density=2 reaches the Rust stage as specialization constant 1) and every example pack translated for Metal, DirectX and Vulkan.
  • tools/check_public_tree.py: passed.

🤖 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/1262 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/22/2026 **Status:** ❌ Closed **Base:** `feat/horizon-shaders-v1` ← **Head:** `feat/horizon-shaders-rust` --- ### 📝 Commits (1) - [`0070f46`](https://github.com/horizon-rust/horizon/commit/0070f46e00524c46a4467b80eccd289921c0e46c) Shader pack stages in Rust: SDK, cargo horizon-shader, Daybreak ### 📊 Changes **15 files changed** (+1229 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+2 -0) 📝 `Cargo.lock` (+9 -0) 📝 `Cargo.toml` (+1 -1) ➕ `crates/cargo-horizon-shader/Cargo.toml` (+15 -0) ➕ `crates/cargo-horizon-shader/src/main.rs` (+188 -0) 📝 `crates/horizon-client/src/shader_pack.rs` (+19 -1) ➕ `crates/horizon-shader-sdk/Cargo.toml` (+18 -0) ➕ `crates/horizon-shader-sdk/src/lib.rs` (+274 -0) ➕ `examples/shaderpacks/daybreak/Cargo.lock` (+118 -0) ➕ `examples/shaderpacks/daybreak/Cargo.toml` (+28 -0) ➕ `examples/shaderpacks/daybreak/LICENSE` (+21 -0) ➕ `examples/shaderpacks/daybreak/pack.toml` (+128 -0) ➕ `examples/shaderpacks/daybreak/shaders/daybreak.spv` (+0 -0) ➕ `examples/shaderpacks/daybreak/shaders/world.wgsl` (+161 -0) ➕ `examples/shaderpacks/daybreak/src/lib.rs` (+247 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Stacked on #1261, the Horizon shaders v1 runtime (base branch `feat/horizon-shaders-v1`). Adds the Rust side of "Horizon shaders v1" and its first example. ## What - **`crates/horizon-shader-sdk`** (not a workspace member; rust-gpu's own nightly builds it): the stage prelude in Rust, mirroring the WGSL one: `Frame` and its helpers (`linear_depth`, `view_position`, `world_offset`, `project`, `previous_uv`), `sample`, `depth`, `is_sky`, `gbuffer_at`, `shadow_lit`, colour helpers, `hash`, `smoothstep`, the material ids, and `stage!`, which writes the entry point with Horizon's bindings; the stage names its group 1 textures and its options' ids. - **`crates/cargo-horizon-shader`**: `cargo horizon-shader build [<pack>]` runs rust-gpu's `cargo gpu build` in the pack folder (it says how to install `cargo-gpu` when missing), checks every module as the game will (naga: parse, validate, write WGSL, fragment entry points that `pack.toml` names) and copies it into `shaders/`. `check` only checks. Tested end to end on Daybreak. - **`examples/shaderpacks/daybreak`** (MIT): warm sunlight with soft shadows, a cool sky light, waving plants and leaves, water with waves, Fresnel sky reflections, sun glints and screen-space reflections, a painted sky, height and distance fog, light shafts, ambient occlusion, bloom, a filmic (ACES fit) tonemap and a grade. World hooks in WGSL (`shaders/world.wgsl`, 160 lines), the five full-screen stages in Rust (`src/lib.rs` → `shaders/daybreak.spv`, 46 KB). Ten options, which #1260 shows on the Shader Packs page. ## Licence verdict Daybreak's look is **inspired by BSL** (Capt Tatsu). BSL is all rights reserved and forbids modified copies, so **no BSL code, constants or textures are used**: every shader here was written from scratch for Horizon. BSL itself only ran locally, through Horizon's Java pack path, for the comparison below (never committed). Other packs: see the table in docs/shader-packs.md ("Licences of the well-known packs"). ## Screenshots Same seed (42), place and view, offscreen at 1280x720 on the M4 Pro. Left: vanilla; middle: **Daybreak**; right: BSL 10.1.8 through Horizon's Java pack path (full-screen passes only, so no BSL shadows or water yet). Times 1000, 6000, 12400, 18000, then the lake at noon. ![sunrise](https://raw.githubusercontent.com/ludovic111/horizon/2354575b048675f5750174f62aac934a15d6ddde/shaders-1/row_1000.jpg) ![noon](https://raw.githubusercontent.com/ludovic111/horizon/2354575b048675f5750174f62aac934a15d6ddde/shaders-1/row_6000.jpg) ![sunset](https://raw.githubusercontent.com/ludovic111/horizon/2354575b048675f5750174f62aac934a15d6ddde/shaders-1/row_12400.jpg) ![night](https://raw.githubusercontent.com/ludovic111/horizon/2354575b048675f5750174f62aac934a15d6ddde/shaders-1/row_18000.jpg) ![lake](https://raw.githubusercontent.com/ludovic111/horizon/2354575b048675f5750174f62aac934a15d6ddde/shaders-1/row_water.jpg) Daybreak full size: ![noon](https://raw.githubusercontent.com/ludovic111/horizon/2354575b048675f5750174f62aac934a15d6ddde/shaders-1/daybreak_6000.jpg) ![sunset](https://raw.githubusercontent.com/ludovic111/horizon/2354575b048675f5750174f62aac934a15d6ddde/shaders-1/daybreak_12400.jpg) ![lake](https://raw.githubusercontent.com/ludovic111/horizon/2354575b048675f5750174f62aac934a15d6ddde/shaders-1/daybreak_water.jpg) Not done: the same view in Iris/OptiFine on the vanilla client (the Mac mini's session is locked and the desktop was in use; FEATURES.md LATER 4y(a)). ## Frame times See #1261: p50 at 1280x720, vanilla → Daybreak: M4 Pro 1.29 → 2.72 ms still, 0.95 → 3.87 ms flying; RTX 4080 0.30 → 0.48 ms still, 0.14 → 0.87 ms flying. BSL through the Java path: 3.03 / 0.59 ms still. ## Checks - `cargo fmt --check`, `cargo clippy --workspace --all-targets -- -D warnings` (now with `cargo-horizon-shader`): clean. - `cargo test -p cargo-horizon-shader` (2) and `-p horizon-client shader` (21): pass, including `compiled_stages_get_their_options_by_id` (a saved `fog_density=2` reaches the Rust stage as specialization constant 1) and every example pack translated for Metal, DirectX and Vulkan. - `tools/check_public_tree.py`: passed. 🤖 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-03 04:09:44 +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#3465
No description provided.