[PR #1900] [MERGED] Shader packs, clean room 41: entities and block entities in the shadow pass #3849

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

📋 Pull Request Information

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

Base: main ← Head: feat/shader-packs-shadow-entities


📝 Commits (10+)

  • 5dcbe22 Shader packs, clean room 37: shadow settings and the shadow camera
  • 86d8d9e Shader packs, clean room 38: load the shadow programs
  • 6320718 Shader packs, clean room 39: shadow buffers, their samplers and shadowcomp
  • a276f81 Shader packs, clean room 39: the run doc comment back on run
  • c965aad Shader packs, clean room 40: terrain in the shadow map, culled from the light
  • 96199c2 Shader packs, clean room 41: entities and block entities in the shadow pass
  • 86a2f8e Merge feat/shader-packs-hand into feat/shader-packs-shadow-camera
  • b2a7e77 Merge feat/shader-packs-shadow-camera into feat/shader-packs-shadow-programs
  • 8b7315a Merge feat/shader-packs-shadow-programs into feat/shader-packs-shadow-buffers
  • c841ab6 Merge feat/shader-packs-shadow-buffers into feat/shader-packs-shadow-terrain

📊 Changes

12 files changed (+1437 additions, -124 deletions)

View changed files

📝 crates/horizon-client/src/gfx.rs (+157 -18)
📝 crates/horizon-client/src/gfx/flat.rs (+66 -4)
📝 crates/horizon-client/src/gfx/pack_entities.rs (+25 -10)
📝 crates/horizon-client/src/gfx/pack_post.rs (+452 -58)
➕ crates/horizon-client/src/gfx/pack_shadow.rs (+208 -0)
📝 crates/horizon-client/src/gfx/pack_sky.rs (+6 -4)
📝 crates/horizon-client/src/gfx/pack_uniforms.rs (+117 -17)
📝 crates/horizon-shaders/src/config.rs (+136 -0)
📝 crates/horizon-shaders/src/lib.rs (+3 -3)
📝 crates/horizon-shaders/src/post.rs (+221 -3)
📝 crates/horizon-shaders/src/translate/mod.rs (+39 -6)
📝 crates/horizon-shaders/tests/real_packs.rs (+7 -1)

📄 Description

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

Shader packs, clean room 41: entities and block entities cast shadows. Stacked on #1888.

What

  • Programs (spec 2.4): shadow_entities and shadow_block load with the entities' vertex inputs, each falling back to shadow.
    • shadowEntities=false or shadowBlockEntities=false (3.2) leaves that part out. Both are on by default (OQ-19).
  • What they draw:
    • the same entity and block-entity runs the gbuffers programs draw, with the same per-draw uniforms (renderStage, entityId, blockEntityId, entityColor);
    • into the shadow map, after the solid terrain and before the shadowtex1 copy;
    • each in a pass of its own, timed as shadow (entities) and shadow (block entities).
  • Uploads: a run is uploaded when a gbuffers program or a shadow program draws it. Horizon still draws the runs no gbuffers program covers.
  • Known gaps:
    • With Horizon's entity culling on, an entity hidden from the camera by blocks casts no shadow: its vertices are culled before the pack sees them.
    • shadowPlayer and shadowLightBlockEntities (E) are not read.
    • In first person, the player's body is not in the entity list.
  • Without a shader pack nothing changes: only the pack's entity code is touched (pack_entities.rs, pack_post.rs, the loader).
  • Also moves has_terrain's doc comment back from shadow_view, where #1888 left it.

Clean room

Clean-room: implemented from cleanroom/shader-packs-spec.md revision 1, §2.4, §3.2, OQ-19; no other loader's code read.

How tested

  • Unit tests: shadow_programs_load_when_a_shadow_buffer_is_read now also covers shadow_block over shadow, shadow_entities → shadow, and both keys off.
  • In game (screenshots local; the packs' licences forbid uploading them). The scene is a white floor with a horse, an armor stand, a chest and a sign, in the morning:
    • Sildurs: the horse, the armor stand and the chest cast shadows. Before this PR only the sign did, because Horizon meshes signs with the terrain.
    • Complementary: the horse and armor stand cast shadows.
    • The debug pack: the horse's shadow lands where its height says.
    • BSL keeps entity shadows off: its SHADOW_ENTITY option is off by default and its properties set shadowEntities=false, which the loader honours.
  • Cost (HORIZON_SHADER_PACK_TIMING, Sildurs, 720p): 0.03 ms for each of the two passes in that scene.
  • Checks: pr_ready --quick passes (1289 tests), and so do the 6 render harnesses among those the files select (light, environment_render, block_entity_render, cloud_render, weather_render, world_border_render). The 107 in all run in CI.

🤖 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/1900 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/shader-packs-shadow-entities` --- ### 📝 Commits (10+) - [`5dcbe22`](https://github.com/horizon-rust/horizon/commit/5dcbe222c94261c7291659a15a06549f46134014) Shader packs, clean room 37: shadow settings and the shadow camera - [`86d8d9e`](https://github.com/horizon-rust/horizon/commit/86d8d9e3a19a0c6614b6b4fec537007d33759254) Shader packs, clean room 38: load the shadow programs - [`6320718`](https://github.com/horizon-rust/horizon/commit/632071849134f15723faba98d8fb76d155faa1ce) Shader packs, clean room 39: shadow buffers, their samplers and shadowcomp - [`a276f81`](https://github.com/horizon-rust/horizon/commit/a276f81abacc7d7503a3098c986b1c370f294912) Shader packs, clean room 39: the run doc comment back on run - [`c965aad`](https://github.com/horizon-rust/horizon/commit/c965aad8d3ad6a837149d6ae5a6e7100c168232d) Shader packs, clean room 40: terrain in the shadow map, culled from the light - [`96199c2`](https://github.com/horizon-rust/horizon/commit/96199c23e7ba28ec666bff1309ce6a075a058c17) Shader packs, clean room 41: entities and block entities in the shadow pass - [`86a2f8e`](https://github.com/horizon-rust/horizon/commit/86a2f8e470868e862d3290efe71ba25f8dd880ba) Merge feat/shader-packs-hand into feat/shader-packs-shadow-camera - [`b2a7e77`](https://github.com/horizon-rust/horizon/commit/b2a7e77036c445340f06f55f3f34952e673dba3e) Merge feat/shader-packs-shadow-camera into feat/shader-packs-shadow-programs - [`8b7315a`](https://github.com/horizon-rust/horizon/commit/8b7315a6ff0921d1ce41d99ce9212329a8243076) Merge feat/shader-packs-shadow-programs into feat/shader-packs-shadow-buffers - [`c841ab6`](https://github.com/horizon-rust/horizon/commit/c841ab6d56761fcf8fe23daa3f86ab366893e40b) Merge feat/shader-packs-shadow-buffers into feat/shader-packs-shadow-terrain ### 📊 Changes **12 files changed** (+1437 additions, -124 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/gfx.rs` (+157 -18) 📝 `crates/horizon-client/src/gfx/flat.rs` (+66 -4) 📝 `crates/horizon-client/src/gfx/pack_entities.rs` (+25 -10) 📝 `crates/horizon-client/src/gfx/pack_post.rs` (+452 -58) ➕ `crates/horizon-client/src/gfx/pack_shadow.rs` (+208 -0) 📝 `crates/horizon-client/src/gfx/pack_sky.rs` (+6 -4) 📝 `crates/horizon-client/src/gfx/pack_uniforms.rs` (+117 -17) 📝 `crates/horizon-shaders/src/config.rs` (+136 -0) 📝 `crates/horizon-shaders/src/lib.rs` (+3 -3) 📝 `crates/horizon-shaders/src/post.rs` (+221 -3) 📝 `crates/horizon-shaders/src/translate/mod.rs` (+39 -6) 📝 `crates/horizon-shaders/tests/real_packs.rs` (+7 -1) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. **Shader packs, clean room 41:** entities and block entities cast shadows. Stacked on #1888. ## What - **Programs** (spec 2.4): `shadow_entities` and `shadow_block` load with the entities' vertex inputs, each falling back to `shadow`. - `shadowEntities=false` or `shadowBlockEntities=false` (3.2) leaves that part out. Both are on by default (OQ-19). - **What they draw:** - the same entity and block-entity runs the gbuffers programs draw, with the same per-draw uniforms (`renderStage`, `entityId`, `blockEntityId`, `entityColor`); - into the shadow map, after the solid terrain and before the `shadowtex1` copy; - each in a pass of its own, timed as `shadow (entities)` and `shadow (block entities)`. - **Uploads:** a run is uploaded when a gbuffers program or a shadow program draws it. Horizon still draws the runs no gbuffers program covers. - **Known gaps:** - With Horizon's entity culling on, an entity hidden from the camera by blocks casts no shadow: its vertices are culled before the pack sees them. - `shadowPlayer` and `shadowLightBlockEntities` (E) are not read. - In first person, the player's body is not in the entity list. - **Without a shader pack** nothing changes: only the pack's entity code is touched (`pack_entities.rs`, `pack_post.rs`, the loader). - Also moves `has_terrain`'s doc comment back from `shadow_view`, where #1888 left it. ## Clean room Clean-room: implemented from `cleanroom/shader-packs-spec.md` revision 1, §2.4, §3.2, OQ-19; no other loader's code read. ## How tested - **Unit tests:** `shadow_programs_load_when_a_shadow_buffer_is_read` now also covers `shadow_block` over `shadow`, `shadow_entities` → `shadow`, and both keys off. - **In game** (screenshots local; the packs' licences forbid uploading them). The scene is a white floor with a horse, an armor stand, a chest and a sign, in the morning: - **Sildurs:** the horse, the armor stand and the chest cast shadows. Before this PR only the sign did, because Horizon meshes signs with the terrain. - **Complementary:** the horse and armor stand cast shadows. - **The debug pack:** the horse's shadow lands where its height says. - **BSL** keeps entity shadows off: its `SHADOW_ENTITY` option is off by default and its properties set `shadowEntities=false`, which the loader honours. - **Cost** (`HORIZON_SHADER_PACK_TIMING`, Sildurs, 720p): 0.03 ms for each of the two passes in that scene. - **Checks:** `pr_ready --quick` passes (1289 tests), and so do the 6 render harnesses among those the files select (`light`, `environment_render`, `block_entity_render`, `cloud_render`, `weather_render`, `world_border_render`). The 107 in all run in CI. 🤖 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:12:45 +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#3849
No description provided.