[PR #5476] [MERGED] Shader API: translucent terrain in the shadow pass, and its colour #6311

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

📋 Pull Request Information

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

Base: main ← Head: shader/s7-shadow-translucent


📝 Commits (10+)

  • acc8c21 Shader API: [shadow], a shadow map of the solid terrain
  • d36550e Shader API: translucent terrain in the shadow pass, and its colour
  • 8859015 Merge main into #5461
  • 6d1237c Merge main into #5476
  • b13a22f Merge remote-tracking branch 'origin/main' into shader/s6-shadow-solid
  • d5316ca Shader API: review fixes for [shadow]
  • b10619e Merge branch 'shader/s6-shadow-solid' into shader/s7-shadow-translucent
  • 6a47c9e Docs: shadow_color carries the vertex colour's shading
  • e554c66 Merge main into #5461
  • 68c5daa Merge main and #5461's main merge into #5476

📊 Changes

17 files changed (+934 additions, -19 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx.rs (+71 -1)
📝 crates/horizon-client-render/src/gfx/native_pack.rs (+14 -1)
📝 crates/horizon-client-render/src/gfx/native_post.rs (+124 -5)
➕ crates/horizon-client-render/src/gfx/native_shadow.rs (+496 -0)
📝 crates/horizon-client-render/src/gfx/native_sky.rs (+1 -1)
📝 crates/horizon-client-render/src/gfx/pack_uniforms.rs (+7 -2)
📝 crates/horizon-shader-api/src/check.rs (+3 -0)
📝 crates/horizon-shader-api/src/inputs.rs (+22 -2)
📝 crates/horizon-shader-api/src/manifest.rs (+47 -0)
📝 crates/horizon-shader-api/src/reference.rs (+9 -1)
📝 crates/horizon-shader-api/src/stages.rs (+75 -4)
📝 crates/horizon-shader-api/tests/samples/schema-1/horizon-shaders.toml (+4 -0)
📝 crates/horizon-shader-api/tests/schema.rs (+20 -0)
📝 crates/horizon-shaders/src/config.rs (+4 -0)
📝 docs/api/shaders-reference.md (+24 -0)
📝 docs/api/shaders.md (+12 -1)
📝 docs/shaders.md (+1 -1)

📄 Description

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

Stacked on #5461: merge that first. Only the last commit (d36550e82, +237 −36) is new here; the block below counts both.

What

The shadow pass now draws translucent terrain too, over a copy of the solid map.

  • shadow_map_translucent: the solid map with water, stained glass and ice drawn in, read with shadow_sampler. A point lit in shadow_map but not here lies under such a surface.
  • shadow_color: the texture colour times the tint of the nearest such surface, white where there is none. Alpha is 1 on a fluid and at most 0.99 on anything else.
  • Bindings: 7 and 8 in the material stage, 9 and 10 in the post stage.

Frame doesn't change. A pack without [shadow] gets 1x1 maps. Every pack with [shadow] pays for this pass, whether or not it reads these inputs, and I didn't measure that cost.

Fixes #5475

Proof

Run locally on Windows with a throwaway pack that multiplies light by shadow_color under translucent terrain:

  • Single player, server thread: the pack loaded with no shader error. A red stained glass slab over stone casts a red patch that moves with the sun from time set 3000 to 5000 to 6000, and a pillar's solid shadow stays dark inside it.
  • Water: the scene's water was in the map's draw, but I didn't check its tint separately. Blue glass stood over the water, so that part isn't clearly shown.
  • Post stage: it reads the same bindings in the right third of the frame; the patch in this scene didn't fall there, so the post stage is only shown to compile and bind.
  • Not run on this commit: lan_e2e (--check chest passed on #5461's head), parity harnesses. No screenshot is attached, for the same reason as #5461.

pr_ready (tools/pr_ready.py --quick on Teiwazik, against origin/main at 256a52eb2, 4 min 51 s)

Check Result
Scope ⚠️ 13 files, +868 −14; 832 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 508 passed (1 min 21 s)
rustfmt ✅ (16 s)
clippy ✅ (1 min 47 s)
tests: horizon-client-render, horizon-shader-api ✅ 838 passed (1 min 21 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/5476 **Author:** [@Teiwazik](https://github.com/Teiwazik) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `shader/s7-shadow-translucent` --- ### 📝 Commits (10+) - [`acc8c21`](https://github.com/horizon-rust/horizon/commit/acc8c21f4c9d3f146413b5230d93af9599085c4f) Shader API: [shadow], a shadow map of the solid terrain - [`d36550e`](https://github.com/horizon-rust/horizon/commit/d36550e82c721d8557acd003a9bdb3fb52cff693) Shader API: translucent terrain in the shadow pass, and its colour - [`8859015`](https://github.com/horizon-rust/horizon/commit/88590156f0d68856c06988cb2b3ca97d64c27217) Merge main into #5461 - [`6d1237c`](https://github.com/horizon-rust/horizon/commit/6d1237c04a2a9656401ba44ac66e3dd9ddf4afbd) Merge main into #5476 - [`b13a22f`](https://github.com/horizon-rust/horizon/commit/b13a22fdcbac449c92b9140fdfdeacbd71b7a5e2) Merge remote-tracking branch 'origin/main' into shader/s6-shadow-solid - [`d5316ca`](https://github.com/horizon-rust/horizon/commit/d5316caaaf16a8268cdf6032bbb2a6eb6951a621) Shader API: review fixes for [shadow] - [`b10619e`](https://github.com/horizon-rust/horizon/commit/b10619ee4f7c31c2d61dd6c66cf83fe4aa283b0d) Merge branch 'shader/s6-shadow-solid' into shader/s7-shadow-translucent - [`6a47c9e`](https://github.com/horizon-rust/horizon/commit/6a47c9eab5cefb5350bb5d8980b3c35165bea10b) Docs: shadow_color carries the vertex colour's shading - [`e554c66`](https://github.com/horizon-rust/horizon/commit/e554c66ae2882460d80a4209893cc0a74eedd71c) Merge main into #5461 - [`68c5daa`](https://github.com/horizon-rust/horizon/commit/68c5daa3ae86b293c598ed72f03bc2a0eb7298e5) Merge main and #5461's main merge into #5476 ### 📊 Changes **17 files changed** (+934 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx.rs` (+71 -1) 📝 `crates/horizon-client-render/src/gfx/native_pack.rs` (+14 -1) 📝 `crates/horizon-client-render/src/gfx/native_post.rs` (+124 -5) ➕ `crates/horizon-client-render/src/gfx/native_shadow.rs` (+496 -0) 📝 `crates/horizon-client-render/src/gfx/native_sky.rs` (+1 -1) 📝 `crates/horizon-client-render/src/gfx/pack_uniforms.rs` (+7 -2) 📝 `crates/horizon-shader-api/src/check.rs` (+3 -0) 📝 `crates/horizon-shader-api/src/inputs.rs` (+22 -2) 📝 `crates/horizon-shader-api/src/manifest.rs` (+47 -0) 📝 `crates/horizon-shader-api/src/reference.rs` (+9 -1) 📝 `crates/horizon-shader-api/src/stages.rs` (+75 -4) 📝 `crates/horizon-shader-api/tests/samples/schema-1/horizon-shaders.toml` (+4 -0) 📝 `crates/horizon-shader-api/tests/schema.rs` (+20 -0) 📝 `crates/horizon-shaders/src/config.rs` (+4 -0) 📝 `docs/api/shaders-reference.md` (+24 -0) 📝 `docs/api/shaders.md` (+12 -1) 📝 `docs/shaders.md` (+1 -1) </details> ### 📄 Description > 🤖 Opened by Teiwazik's AI agent (Claude Code, Claude Opus 5.5), not by Teiwazik personally. **Stacked on #5461:** merge that first. Only the last commit (d36550e82, +237 −36) is new here; the block below counts both. ## What The shadow pass now draws translucent terrain too, over a copy of the solid map. - **`shadow_map_translucent`:** the solid map with water, stained glass and ice drawn in, read with `shadow_sampler`. A point lit in `shadow_map` but not here lies under such a surface. - **`shadow_color`:** the texture colour times the tint of the nearest such surface, white where there is none. Alpha is 1 on a fluid and at most 0.99 on anything else. - **Bindings:** 7 and 8 in the material stage, 9 and 10 in the post stage. `Frame` doesn't change. A pack without `[shadow]` gets 1x1 maps. Every pack with `[shadow]` pays for this pass, whether or not it reads these inputs, and I didn't measure that cost. Fixes #5475 ## Proof Run locally on Windows with a throwaway pack that multiplies light by `shadow_color` under translucent terrain: - **Single player, server thread:** the pack loaded with no shader error. A red stained glass slab over stone casts a red patch that moves with the sun from `time set` 3000 to 5000 to 6000, and a pillar's solid shadow stays dark inside it. - **Water:** the scene's water was in the map's draw, but I didn't check its tint separately. Blue glass stood over the water, so that part isn't clearly shown. - **Post stage:** it reads the same bindings in the right third of the frame; the patch in this scene didn't fall there, so the post stage is only shown to compile and bind. - **Not run on this commit:** `lan_e2e` (`--check chest` passed on #5461's head), parity harnesses. No screenshot is attached, for the same reason as #5461. **pr_ready** (`tools/pr_ready.py --quick` on Teiwazik, against origin/main at 256a52eb2, 4 min 51 s) | Check | Result | | --- | --- | | Scope | ⚠️ 13 files, +868 −14; 832 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 508 passed (1 min 21 s) | | rustfmt | ✅ (16 s) | | clippy | ✅ (1 min 47 s) | | tests: horizon-client-render, horizon-shader-api | ✅ 838 passed (1 min 21 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:18:04 +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#6311
No description provided.