[PR #4398] [MERGED] Shader API: [reflection] option, and facing culling for the water mirror's eye #5604

Closed
opened 2026-11-03 05:13:42 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4398
Author: @Teiwazik
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: shader/s5b-mirror-option


📝 Commits (10+)

  • fa845cd Shader API: the material stage sees what lies behind translucent terrain
  • 951c7d5 Shader API: the frame's motion since the last one, and the eye's light eased
  • 07d3026 Shader API: the post stage's history, last frame's input to the last pass
  • f9ef4e0 Shader API: the material stage's face, fluid, emission, normal and tangent
  • 9b53e24 Shader API: the material stage's water mirror
  • 77fab15 Shader API: [reflection] option, and facing culling for the mirror's eye
  • 45d19d1 Merge remote-tracking branch 'origin/main' into shader/s5-water-mirror
  • 2cefbeb Merge branch 'shader/s5-water-mirror' into shader/s5b-mirror-option
  • 3dbcf3c Merge remote-tracking branch 'origin/main' into pr4335
  • 252ac76 Merge branch 'pr4335' into pr4345

📊 Changes

25 files changed (+1293 additions, -65 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx.rs (+324 -9)
📝 crates/horizon-client-render/src/gfx/flat.rs (+15 -2)
📝 crates/horizon-client-render/src/gfx/native_material.rs (+28 -2)
📝 crates/horizon-client-render/src/gfx/native_pack.rs (+14 -1)
📝 crates/horizon-client-render/src/gfx/native_post.rs (+456 -20)
📝 crates/horizon-client-render/src/gfx/resident.rs (+5 -3)
📝 crates/horizon-client-render/src/gfx/world_post.rs (+5 -2)
📝 crates/horizon-client-render/src/lod/mesh.rs (+9 -2)
📝 crates/horizon-client-render/src/mesher.rs (+43 -1)
📝 crates/horizon-client-render/src/mesher/fluid.rs (+18 -9)
📝 crates/horizon-client-render/src/mesher/sides.rs (+26 -1)
📝 crates/horizon-client-render/src/terrain.wgsl (+12 -0)
📝 crates/horizon-client/examples/probe/section_mesh_fixture.rs (+2 -2)
📝 crates/horizon-client/src/game.rs (+18 -0)
📝 crates/horizon-client/src/game/boats.rs (+57 -0)
📝 crates/horizon-shader-api/src/check.rs (+26 -1)
📝 crates/horizon-shader-api/src/inputs.rs (+32 -2)
📝 crates/horizon-shader-api/src/manifest.rs (+25 -0)
📝 crates/horizon-shader-api/src/stages.rs (+86 -5)
📝 crates/horizon-shader-api/tests/check.rs (+23 -0)

...and 5 more files

📄 Description

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

Fixes #4397

Builds on #4379 (and the shader PRs under it). This PR's own change is its last commit, 77fab1508 (10 files, +128 −14), plus a merge that brings in #4379's merge of main.

What and why

[reflection] option

A pack's option can decide whether its water reflections are drawn. Players can't change option values yet (game/native_shaders.rs builds them from each option's default), so for now the pack's default decides.

  • [reflection] option = "<id>" names an option. While it is on (a bool on, a number above 0), the mirror is drawn; without the key, it is drawn whenever the material reads reflection.
  • The manifest refuses [reflection] without [material], and an option id that does not exist.
  • check::Report carries [reflection] to the renderer.
  • The sample pack (tests/samples/schema-1) shows it: its water mixes in the mirror while the reflections option is on. The schema tests read the key and its two errors.

Facing culling with the mirror

#4379 drew every solid quad while mirroring.

  • Sides::visible_from(eye, low, ..) keeps the quads facing any eye from eye straight down to the height low. Only the downward-facing bucket depends on it; the sides depend on x and z, which the camera and its mirror share.
  • facing_runs_from passes the mirror's eye height for the sections and the distant tiles.

Test: an_eye_and_its_mirror_below_see_the_faces_of_both.

pr_ready

pr_ready (tools/pr_ready.py --quick on Teiwazik, against origin/main at 68f036059, before the merge of main, 9 min 26 s)

Check Result
Scope ⚠️ 24 files, +1163 −56; 1124 lines of code: over 500, split it if it can ship in parts (the stack under it; this PR's own commit is +128 −14)
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 480 passed (1 min 37 s)
rustfmt ✅ (17 s)
clippy ✅ (2 min 2 s)
tests: horizon-client, horizon-client-render, horizon-shader-api ❌ 726 passed, 1 failed (5 min 21 s): title::tests::each_world_preset_writes_its_own_generator, which fails on Windows on main too (a world folder name with :). That stopped the run, so the render and API tests ran separately with --no-fail-fast: horizon-shader-api all pass; horizon-client-render 569 passed, 3 failed, all three asserting cfg!(debug_assertions), which the fast profile used here turns off
doc tests ✅ 0 passed (6 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)

After the merge of main, cargo check -p horizon-client --all-targets and cargo fmt --check pass.

🤖 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/4398 **Author:** [@Teiwazik](https://github.com/Teiwazik) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `shader/s5b-mirror-option` --- ### 📝 Commits (10+) - [`fa845cd`](https://github.com/horizon-rust/horizon/commit/fa845cd5802713d4824f42f296eaf99b52792dd8) Shader API: the material stage sees what lies behind translucent terrain - [`951c7d5`](https://github.com/horizon-rust/horizon/commit/951c7d5165d02d68f47d89fb1f2033efd5b9b6c0) Shader API: the frame's motion since the last one, and the eye's light eased - [`07d3026`](https://github.com/horizon-rust/horizon/commit/07d302639ecb87e90e0127669cdc54adaff8d98f) Shader API: the post stage's history, last frame's input to the last pass - [`f9ef4e0`](https://github.com/horizon-rust/horizon/commit/f9ef4e0ea0dd0ab14ff52392cf792c3706bc774f) Shader API: the material stage's face, fluid, emission, normal and tangent - [`9b53e24`](https://github.com/horizon-rust/horizon/commit/9b53e24b33135aee408b8b91f18d8b1b40fe7928) Shader API: the material stage's water mirror - [`77fab15`](https://github.com/horizon-rust/horizon/commit/77fab15086cb69318e695e6a446b01e2e6c34965) Shader API: [reflection] option, and facing culling for the mirror's eye - [`45d19d1`](https://github.com/horizon-rust/horizon/commit/45d19d1f8787a830f4e1d17135f80cd81db815cb) Merge remote-tracking branch 'origin/main' into shader/s5-water-mirror - [`2cefbeb`](https://github.com/horizon-rust/horizon/commit/2cefbebb649cdae6864cbfa7a3a0580bebae69f5) Merge branch 'shader/s5-water-mirror' into shader/s5b-mirror-option - [`3dbcf3c`](https://github.com/horizon-rust/horizon/commit/3dbcf3c6c66104f76353df7352d14d12889409ec) Merge remote-tracking branch 'origin/main' into pr4335 - [`252ac76`](https://github.com/horizon-rust/horizon/commit/252ac76369990b6ef98615f6a125d769ec407707) Merge branch 'pr4335' into pr4345 ### 📊 Changes **25 files changed** (+1293 additions, -65 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx.rs` (+324 -9) 📝 `crates/horizon-client-render/src/gfx/flat.rs` (+15 -2) 📝 `crates/horizon-client-render/src/gfx/native_material.rs` (+28 -2) 📝 `crates/horizon-client-render/src/gfx/native_pack.rs` (+14 -1) 📝 `crates/horizon-client-render/src/gfx/native_post.rs` (+456 -20) 📝 `crates/horizon-client-render/src/gfx/resident.rs` (+5 -3) 📝 `crates/horizon-client-render/src/gfx/world_post.rs` (+5 -2) 📝 `crates/horizon-client-render/src/lod/mesh.rs` (+9 -2) 📝 `crates/horizon-client-render/src/mesher.rs` (+43 -1) 📝 `crates/horizon-client-render/src/mesher/fluid.rs` (+18 -9) 📝 `crates/horizon-client-render/src/mesher/sides.rs` (+26 -1) 📝 `crates/horizon-client-render/src/terrain.wgsl` (+12 -0) 📝 `crates/horizon-client/examples/probe/section_mesh_fixture.rs` (+2 -2) 📝 `crates/horizon-client/src/game.rs` (+18 -0) 📝 `crates/horizon-client/src/game/boats.rs` (+57 -0) 📝 `crates/horizon-shader-api/src/check.rs` (+26 -1) 📝 `crates/horizon-shader-api/src/inputs.rs` (+32 -2) 📝 `crates/horizon-shader-api/src/manifest.rs` (+25 -0) 📝 `crates/horizon-shader-api/src/stages.rs` (+86 -5) 📝 `crates/horizon-shader-api/tests/check.rs` (+23 -0) _...and 5 more files_ </details> ### 📄 Description > 🤖 Opened by Teiwazik's AI agent (Claude Code, Claude Opus 5.5), not by Teiwazik personally. Fixes #4397 Builds on #4379 (and the shader PRs under it). This PR's own change is its last commit, 77fab1508 (10 files, +128 −14), plus a merge that brings in #4379's merge of main. ## What and why ### `[reflection] option` A pack's option can decide whether its water reflections are drawn. Players can't change option values yet (`game/native_shaders.rs` builds them from each option's default), so for now the pack's default decides. - `[reflection] option = "<id>"` names an option. While it is on (a bool on, a number above 0), the mirror is drawn; without the key, it is drawn whenever the material reads `reflection`. - The manifest refuses `[reflection]` without `[material]`, and an option id that does not exist. - `check::Report` carries `[reflection]` to the renderer. - The sample pack (`tests/samples/schema-1`) shows it: its water mixes in the mirror while the `reflections` option is on. The schema tests read the key and its two errors. ### Facing culling with the mirror #4379 drew every solid quad while mirroring. - `Sides::visible_from(eye, low, ..)` keeps the quads facing any eye from `eye` straight down to the height `low`. Only the downward-facing bucket depends on it; the sides depend on x and z, which the camera and its mirror share. - `facing_runs_from` passes the mirror's eye height for the sections and the distant tiles. Test: `an_eye_and_its_mirror_below_see_the_faces_of_both`. ## pr_ready **pr_ready** (`tools/pr_ready.py --quick` on Teiwazik, against origin/main at 68f036059, before the merge of main, 9 min 26 s) | Check | Result | | --- | --- | | Scope | ⚠️ 24 files, +1163 −56; 1124 lines of code: over 500, split it if it can ship in parts (the stack under it; this PR's own commit is +128 −14) | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 480 passed (1 min 37 s) | | rustfmt | ✅ (17 s) | | clippy | ✅ (2 min 2 s) | | tests: horizon-client, horizon-client-render, horizon-shader-api | ❌ 726 passed, 1 failed (5 min 21 s): `title::tests::each_world_preset_writes_its_own_generator`, which fails on Windows on main too (a world folder name with `:`). That stopped the run, so the render and API tests ran separately with `--no-fail-fast`: horizon-shader-api all pass; horizon-client-render 569 passed, 3 failed, all three asserting `cfg!(debug_assertions)`, which the `fast` profile used here turns off | | doc tests | ✅ 0 passed (6 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) | After the merge of main, `cargo check -p horizon-client --all-targets` and `cargo fmt --check` pass. 🤖 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 05:13:42 +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#5604
No description provided.