[PR #1414] [MERGED] feat(shaders): API 2 shadow, G-buffer and deferred passes with pack options UI #3503

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

📋 Pull Request Information

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

Base: main ← Head: feat/shader-api2-pipeline


📝 Commits (9)

  • 4dff61b feat(shaders): complete wgpu Iris/Horizon API-2 shader pipeline, shadow & G-buffer passes, GLSL translator fixes, and settings/import UI
  • d95932e Merge origin/main into feat/shader-api2-pipeline
  • eafe97d Shader packs: keep what Iris does, drop what doesn't work, apply settings on Done
  • fe7bb3a Java packs: the world goes where the pack's terrain program draws
  • 963d5ce Shader packs: keep the opaque depth and G-buffer only for packs that read them
  • 39ae543 Shader packs: test importing zips and folders, and refusing what isn't a pack
  • fe3a3af Shader Packs page: the pack's settings button sits beside the folder button
  • d959104 Shader pack docs: MakeUp, Chocapic13' and Photon on the Java path, and where the world goes
  • 6fe8897 Merge origin/main into feat/shader-api2-pipeline

📊 Changes

28 files changed (+3802 additions, -338 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+3 -0)
📝 crates/horizon-client/src/game/options.rs (+3 -0)
📝 crates/horizon-client/src/game/shader_packs.rs (+15 -0)
📝 crates/horizon-client/src/game/startup_menu.rs (+14 -0)
📝 crates/horizon-client/src/gfx.rs (+228 -4)
📝 crates/horizon-client/src/gfx/java_stages.rs (+213 -93)
📝 crates/horizon-client/src/gfx/pack_stages.rs (+253 -26)
📝 crates/horizon-client/src/gfx/world_post.rs (+568 -23)
📝 crates/horizon-client/src/graphics_ui.rs (+7 -6)
📝 crates/horizon-client/src/java_pack.rs (+58 -2)
📝 crates/horizon-client/src/options_ui.rs (+387 -5)
📝 crates/horizon-client/src/shader_pack.rs (+919 -20)
➕ crates/horizon-client/src/shader_pack_prelude_api2.wgsl (+108 -0)
📝 crates/horizon-shaderpack/src/lib.rs (+27 -1)
📝 crates/horizon-shaderpack/src/options.rs (+14 -4)
📝 crates/horizon-shaderpack/src/pipeline.rs (+55 -5)
📝 crates/horizon-shaderpack/src/properties.rs (+74 -13)
📝 crates/horizon-shaderpack/src/source.rs (+18 -4)
📝 crates/horizon-shaderpack/src/translate.rs (+307 -115)
📝 crates/horizon-shaderpack/tests/pack.rs (+36 -0)

...and 8 more files

📄 Description

What and why

Completes Horizon's API 2 shader-pack pipeline and exposes it through the options UI, so Horizon packs can use the same stages Iris/OptiFine packs do, and Java pack options become editable in game.

Renderer

  • shadow stage: directional sun/moon shadow map with shadowtex0/shadowtex1, light-space shadowModelView/shadowProjection, shadowMapResolution, shadowDistance, shadowDistanceRenderMul, nearest/mipmap/hardware-filtering directives.
  • gbuffer stage plus scene_normal/scene_material (colortex1..3) reconstructed from depth and scene colour.
  • deferred stage over the opaque world, before translucent terrain, with depthtex1/depthtex2 captured pre-translucent.
  • shaders.properties blend state (blend.<program>, blend.<program>.<buffer>), custom PNG textures, noise texture, wetness, centerDepthSmooth, eye light.
  • final stage now runs after composite over the pack's last target.

Packs and UI

  • Interactive pack options, profiles, sub-screens and labels read from shaders.properties and .lang.
  • Import of a .zip or folder, plus drag-and-drop, into shaderpacks/; reset to defaults and reload after edits.
  • Wired into the vanilla-style Options screen.

Translator

  • 2D array and struct varyings, vertex textureLod, mat2(vec4), 1 << 31 shifts, constants naga cannot fold, and .lang option labels.

Example

  • examples/shaderpacks/horizon-ultra: PCF sun/moon shadows, GTAO, water SSR/absorption, volumetric godrays, HDR bloom and ACES tonemapping.

The branch is rebased onto 5bb492c. The UI was ported from the removed options_horizon.rs to the single vanilla-style Options menu.

Vanilla reference

Horizon-only (Iris/OptiFine shader-pack compatibility); there is no vanilla counterpart. Program names, shaders.properties keys and directive semantics follow Iris/OptiFine.

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on cachyos-x8664, against upstream/main at 5bb492ca5, 43 s)

Check Result
Scope ⚠️ 27 files, +3610 −283; 3832 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅ (1 s)
Python tests ➖ no Python change
rustfmt ✅ (5 s)
clippy ✅ (1 s)
tests: horizon-client, horizon-shaderpack ✅ 1188 passed (35 s)
doc tests ✅ 0 passed (1 s)
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)

Screenshots

Not attached: the result depends on the GPU/driver and on local Minecraft resources. I can add captures on request.


🔄 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/1414 **Author:** [@kerneldroid](https://github.com/kerneldroid) **Created:** 10/23/2026 **Status:** ✅ Merged **Merged:** 10/23/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/shader-api2-pipeline` --- ### 📝 Commits (9) - [`4dff61b`](https://github.com/horizon-rust/horizon/commit/4dff61b697f8f032f374a6b71bea80b1af23d866) feat(shaders): complete wgpu Iris/Horizon API-2 shader pipeline, shadow & G-buffer passes, GLSL translator fixes, and settings/import UI - [`d95932e`](https://github.com/horizon-rust/horizon/commit/d95932e62c28edd5c2b24eff596d0d2895c0ce5f) Merge origin/main into feat/shader-api2-pipeline - [`eafe97d`](https://github.com/horizon-rust/horizon/commit/eafe97da7468315d1bd159ccee038a8cee72e62d) Shader packs: keep what Iris does, drop what doesn't work, apply settings on Done - [`fe7bb3a`](https://github.com/horizon-rust/horizon/commit/fe7bb3a34b54da4792b6f9b201a6e2eb2bd4c9ca) Java packs: the world goes where the pack's terrain program draws - [`963d5ce`](https://github.com/horizon-rust/horizon/commit/963d5cedd3671d1c04569b89d98940cd7d9187f9) Shader packs: keep the opaque depth and G-buffer only for packs that read them - [`39ae543`](https://github.com/horizon-rust/horizon/commit/39ae54379601b12984c302462cf437ada48db790) Shader packs: test importing zips and folders, and refusing what isn't a pack - [`fe3a3af`](https://github.com/horizon-rust/horizon/commit/fe3a3af5684f7afdb763d1c1f9f66dcc24bc68e0) Shader Packs page: the pack's settings button sits beside the folder button - [`d959104`](https://github.com/horizon-rust/horizon/commit/d9591047fa44e7fc5c1bb3f2c4863e5bd0bc83e4) Shader pack docs: MakeUp, Chocapic13' and Photon on the Java path, and where the world goes - [`6fe8897`](https://github.com/horizon-rust/horizon/commit/6fe88978a780b9073e913c4345c7d5b79ae12d74) Merge origin/main into feat/shader-api2-pipeline ### 📊 Changes **28 files changed** (+3802 additions, -338 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+3 -0) 📝 `crates/horizon-client/src/game/options.rs` (+3 -0) 📝 `crates/horizon-client/src/game/shader_packs.rs` (+15 -0) 📝 `crates/horizon-client/src/game/startup_menu.rs` (+14 -0) 📝 `crates/horizon-client/src/gfx.rs` (+228 -4) 📝 `crates/horizon-client/src/gfx/java_stages.rs` (+213 -93) 📝 `crates/horizon-client/src/gfx/pack_stages.rs` (+253 -26) 📝 `crates/horizon-client/src/gfx/world_post.rs` (+568 -23) 📝 `crates/horizon-client/src/graphics_ui.rs` (+7 -6) 📝 `crates/horizon-client/src/java_pack.rs` (+58 -2) 📝 `crates/horizon-client/src/options_ui.rs` (+387 -5) 📝 `crates/horizon-client/src/shader_pack.rs` (+919 -20) ➕ `crates/horizon-client/src/shader_pack_prelude_api2.wgsl` (+108 -0) 📝 `crates/horizon-shaderpack/src/lib.rs` (+27 -1) 📝 `crates/horizon-shaderpack/src/options.rs` (+14 -4) 📝 `crates/horizon-shaderpack/src/pipeline.rs` (+55 -5) 📝 `crates/horizon-shaderpack/src/properties.rs` (+74 -13) 📝 `crates/horizon-shaderpack/src/source.rs` (+18 -4) 📝 `crates/horizon-shaderpack/src/translate.rs` (+307 -115) 📝 `crates/horizon-shaderpack/tests/pack.rs` (+36 -0) _...and 8 more files_ </details> ### 📄 Description ## What and why Completes Horizon's API 2 shader-pack pipeline and exposes it through the options UI, so Horizon packs can use the same stages Iris/OptiFine packs do, and Java pack options become editable in game. **Renderer** - `shadow` stage: directional sun/moon shadow map with `shadowtex0`/`shadowtex1`, light-space `shadowModelView`/`shadowProjection`, `shadowMapResolution`, `shadowDistance`, `shadowDistanceRenderMul`, nearest/mipmap/hardware-filtering directives. - `gbuffer` stage plus `scene_normal`/`scene_material` (`colortex1..3`) reconstructed from depth and scene colour. - `deferred` stage over the opaque world, before translucent terrain, with `depthtex1`/`depthtex2` captured pre-translucent. - `shaders.properties` blend state (`blend.<program>`, `blend.<program>.<buffer>`), custom PNG textures, noise texture, `wetness`, `centerDepthSmooth`, eye light. - `final` stage now runs after composite over the pack's last target. **Packs and UI** - Interactive pack options, profiles, sub-screens and labels read from `shaders.properties` and `.lang`. - Import of a `.zip` or folder, plus drag-and-drop, into `shaderpacks/`; reset to defaults and reload after edits. - Wired into the vanilla-style Options screen. **Translator** - 2D array and struct varyings, vertex `textureLod`, `mat2(vec4)`, `1 << 31` shifts, constants naga cannot fold, and `.lang` option labels. **Example** - `examples/shaderpacks/horizon-ultra`: PCF sun/moon shadows, GTAO, water SSR/absorption, volumetric godrays, HDR bloom and ACES tonemapping. The branch is rebased onto `5bb492c`. The UI was ported from the removed `options_horizon.rs` to the single vanilla-style Options menu. ## Vanilla reference Horizon-only (Iris/OptiFine shader-pack compatibility); there is no vanilla counterpart. Program names, `shaders.properties` keys and directive semantics follow Iris/OptiFine. ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on cachyos-x8664, against upstream/main at 5bb492ca5, 43 s) | Check | Result | | --- | --- | | Scope | ⚠️ 27 files, +3610 −283; 3832 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ (1 s) | | Python tests | ➖ no Python change | | rustfmt | ✅ (5 s) | | clippy | ✅ (1 s) | | tests: horizon-client, horizon-shaderpack | ✅ 1188 passed (35 s) | | doc tests | ✅ 0 passed (1 s) | | 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) | ## Screenshots Not attached: the result depends on the GPU/driver and on local Minecraft resources. I can add captures on request. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:10: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#3503
No description provided.