[PR #1916] [MERGED] Shader packs, clean room 42: culled entities, the first-person player, shadowPlayer and shadowLightBlockEntities in the shadow pass #3861

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

📋 Pull Request Information

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

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


📝 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
  • ac47b98 Shader packs, clean room 42: culled entities, the first-person player, shadowPlayer and shadowLightBlockEntities 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

📊 Changes

18 files changed (+1691 additions, -152 deletions)

View changed files

📝 crates/horizon-client/src/entity_culling.rs (+15 -5)
📝 crates/horizon-client/src/game.rs (+7 -1)
📝 crates/horizon-client/src/game/entity_culling.rs (+28 -18)
📝 crates/horizon-client/src/game/perspective.rs (+2 -1)
📝 crates/horizon-client/src/game/shader_packs.rs (+27 -1)
📝 crates/horizon-client/src/gfx.rs (+169 -18)
📝 crates/horizon-client/src/gfx/flat.rs (+66 -4)
📝 crates/horizon-client/src/gfx/pack_draw.rs (+70 -1)
📝 crates/horizon-client/src/gfx/pack_entities.rs (+73 -11)
📝 crates/horizon-client/src/gfx/pack_post.rs (+476 -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 (+242 -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 42: the shadow pass gets the player in first person, shadowPlayer, shadowLightBlockEntities, and entities that Horizon's entity culling hides. Stacked on #1900.

What

  • Entities that Horizon's entity culling hides from the camera (the opt-in Advanced Graphics setting) still cast shadows while a pack's shadow pass draws entities or block entities.
    • Their vertices are kept, and their span is marked hidden. When one span holds several entities of the same type, it is split around the hidden one.
    • Neither Horizon's draw nor the pack's gbuffers programs draw hidden spans; only the shadow pass does.
    • Culler::hidden is the test without the truncation, and cull_vertices still uses it.
  • The player in first person: the local player's model is built in first person too while a pack's entity shadows are on. Its span is hidden from the camera, so the player casts a shadow but stays out of view. Sleeping, spectator, invisible or dead players are still left out, as before.
  • shadowPlayer (spec 3.2, E keys):
    • with shadowEntities=false, the entity shadow program still loads and draws the local player only;
    • with shadowEntities on, it is implied.
    • Spans now carry a player flag. LAN guests are other players and are not marked.
  • shadowLightBlockEntities: with shadowBlockEntities=false, the block shadow program still draws the block entities whose block emits light (e.g. the enchanting table's book). Spans carry an emissive flag taken from the block state's light emission.
  • The log notes name the restriction, e.g. entities (only the player) cast shadows with shadow.
  • Without a shader pack nothing changes.
    • Everything new is gated on the pack's entity spans (pack_ids) and its shadow programs. pack_shadow_casters is (false, false) otherwise, so culling truncates as before and the first-person model isn't built.
    • No-pack screenshots against #1900's binary are identical outside the moving clouds, with entity culling on and off.
  • Game code touched (outside the pack files):
    • game/entity_culling.rs: the hidden test, then keep or truncate;
    • entity_culling.rs: Culler::hidden split out of cull_vertices;
    • game/perspective.rs: player_model_shown allows first person when the pack casts the player;
    • game.rs: one field, mark_player, and a fresh span for LAN guests after the local player.
  • Known gap: spec 3.2 says shadowPlayer also covers what the player rides. The vehicle is not marked, so with shadowEntities=false a ridden boat or horse casts no shadow.

Clean room

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

How tested

  • Unit tests:
    • hide_splits_the_span_around_one_entity (pack_draw);
    • caster cases in the pack_entities split test (hidden spans: shadow only; only the player; only light-emitting block entities);
    • the loader test covers shadowPlayer and shadowLightBlockEntities loading the programs with the keys off.
  • In game (screenshots local, from a debug pack of ours that shows the shadow map; test packs' screenshots aren't uploaded):
    • Culling: a horse on top of a 10-high pillar is hidden from the player below by entity culling. With #1900's binary it is missing from the shadow map. With this branch it is there: in the pillar region, the map differs from #1900's by 209 px and from the culling-off map by 9 px.
    • First person: the player's head, body and arms show in the shadow map and cast a shadow on the floor. Before, there was none.
    • shadowEntities=false, shadowPlayer=true, shadowBlockEntities=false, shadowLightBlockEntities=true: the map keeps the player and the enchanting table's book, and drops the horse and the chest.
  • Checks:
    • pr_ready --quick passes (1290 tests).
    • The 6 render harnesses among those the files select pass (light, environment_render, block_entity_render, cloud_render, weather_render, world_border_render). The game-code files select 110; the rest run in CI.
    • The first-person and shadowPlayer checks were repeated on the in-frame path (--in-frame).

🤖 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/1916 **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-casters` --- ### 📝 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 - [`ac47b98`](https://github.com/horizon-rust/horizon/commit/ac47b988c9add9ceb575a23a24751084ec43abc6) Shader packs, clean room 42: culled entities, the first-person player, shadowPlayer and shadowLightBlockEntities 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 ### 📊 Changes **18 files changed** (+1691 additions, -152 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/entity_culling.rs` (+15 -5) 📝 `crates/horizon-client/src/game.rs` (+7 -1) 📝 `crates/horizon-client/src/game/entity_culling.rs` (+28 -18) 📝 `crates/horizon-client/src/game/perspective.rs` (+2 -1) 📝 `crates/horizon-client/src/game/shader_packs.rs` (+27 -1) 📝 `crates/horizon-client/src/gfx.rs` (+169 -18) 📝 `crates/horizon-client/src/gfx/flat.rs` (+66 -4) 📝 `crates/horizon-client/src/gfx/pack_draw.rs` (+70 -1) 📝 `crates/horizon-client/src/gfx/pack_entities.rs` (+73 -11) 📝 `crates/horizon-client/src/gfx/pack_post.rs` (+476 -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` (+242 -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 42:** the shadow pass gets the player in first person, `shadowPlayer`, `shadowLightBlockEntities`, and entities that Horizon's entity culling hides. Stacked on #1900. ## What - **Entities that Horizon's entity culling hides from the camera** (the opt-in Advanced Graphics setting) still cast shadows while a pack's shadow pass draws entities or block entities. - Their vertices are kept, and their span is marked `hidden`. When one span holds several entities of the same type, it is split around the hidden one. - Neither Horizon's draw nor the pack's gbuffers programs draw hidden spans; only the shadow pass does. - `Culler::hidden` is the test without the truncation, and `cull_vertices` still uses it. - **The player in first person:** the local player's model is built in first person too while a pack's entity shadows are on. Its span is hidden from the camera, so the player casts a shadow but stays out of view. Sleeping, spectator, invisible or dead players are still left out, as before. - **`shadowPlayer` (spec 3.2, E keys):** - with `shadowEntities=false`, the entity shadow program still loads and draws the local player only; - with `shadowEntities` on, it is implied. - Spans now carry a `player` flag. LAN guests are other players and are not marked. - **`shadowLightBlockEntities`:** with `shadowBlockEntities=false`, the block shadow program still draws the block entities whose block emits light (e.g. the enchanting table's book). Spans carry an `emissive` flag taken from the block state's light emission. - The log notes name the restriction, e.g. `entities (only the player) cast shadows with shadow`. - **Without a shader pack nothing changes.** - Everything new is gated on the pack's entity spans (`pack_ids`) and its shadow programs. `pack_shadow_casters` is `(false, false)` otherwise, so culling truncates as before and the first-person model isn't built. - No-pack screenshots against #1900's binary are identical outside the moving clouds, with entity culling on and off. - **Game code touched (outside the pack files):** - `game/entity_culling.rs`: the hidden test, then keep or truncate; - `entity_culling.rs`: `Culler::hidden` split out of `cull_vertices`; - `game/perspective.rs`: `player_model_shown` allows first person when the pack casts the player; - `game.rs`: one field, `mark_player`, and a fresh span for LAN guests after the local player. - **Known gap:** spec 3.2 says `shadowPlayer` also covers what the player rides. The vehicle is not marked, so with `shadowEntities=false` a ridden boat or horse casts no shadow. ## Clean room Clean-room: implemented from `cleanroom/shader-packs-spec.md` revision 1, §2.4, §3.2 (`shadowPlayer`, `shadowLightBlockEntities`); no other loader's code read. ## How tested - **Unit tests:** - `hide_splits_the_span_around_one_entity` (pack_draw); - caster cases in the pack_entities split test (hidden spans: shadow only; only the player; only light-emitting block entities); - the loader test covers `shadowPlayer` and `shadowLightBlockEntities` loading the programs with the keys off. - **In game** (screenshots local, from a debug pack of ours that shows the shadow map; test packs' screenshots aren't uploaded): - **Culling:** a horse on top of a 10-high pillar is hidden from the player below by entity culling. With #1900's binary it is missing from the shadow map. With this branch it is there: in the pillar region, the map differs from #1900's by 209 px and from the culling-off map by 9 px. - **First person:** the player's head, body and arms show in the shadow map and cast a shadow on the floor. Before, there was none. - **`shadowEntities=false`, `shadowPlayer=true`, `shadowBlockEntities=false`, `shadowLightBlockEntities=true`:** the map keeps the player and the enchanting table's book, and drops the horse and the chest. - **Checks:** - `pr_ready --quick` passes (1290 tests). - The 6 render harnesses among those the files select pass (`light`, `environment_render`, `block_entity_render`, `cloud_render`, `weather_render`, `world_border_render`). The game-code files select 110; the rest run in CI. - The first-person and `shadowPlayer` checks were repeated on the in-frame path (`--in-frame`). 🤖 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:51 +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#3861
No description provided.