From 2fb942b66186c47686ce5276ccd9c245cd8ee979 Mon Sep 17 00:00:00 2001
From: pkuzic
Date: Wed, 2 Sep 2026 23:49:32 +0100
Subject: [PATCH] Apply reference real-character-shadows patch (Bevy shadow-map
approach)
Character-only realtime shadows via a DirectionalLight + a private-layer
CPU-skinned caster proxy; terrain/models/static_gx receive through Bevy's
shadows::fetch_directional_shadow. Opt-in cvar `worldShadows` (default off);
hides the blob oval when on. Branched from 7f4db0e (clean pre-shadow base).
Conflicts resolved: cvars.rs (our `same()` style + 45-entry session array),
options_tests.rs (our row counts +1 for the World Shadows toggle).
Co-Authored-By: Claude Opus 4.8
---
.gitignore | 3 +
crates/benilla-app/assets/ui/OptionsFrame.xml | 19 +-
crates/benilla-app/src/blob_shadow.rs | 14 +
crates/benilla-app/src/cvars.rs | 11 +-
crates/benilla-app/src/lib.rs | 7 +-
crates/benilla-app/src/player_shadow.rs | 653 ++++++++++++++++++
crates/benilla-app/src/shaders.rs | 3 +-
.../src/shaders/shadow_caster.wgsl | 7 +
.../src/ui_script/options_tests.rs | 5 +-
crates/benilla-app/src/video.rs | 4 +
crates/benilla-assets/src/materials.rs | 6 +
.../benilla-assets/src/shaders/terrain.wgsl | 45 +-
.../benilla-assets/src/shaders/wow_model.wgsl | 69 +-
crates/benilla-world/src/model_render.rs | 18 +
.../src/model_render/visibility.rs | 11 +
.../benilla-world/src/shaders/static_gx.wgsl | 79 ++-
crates/benilla-world/src/static_gx/mod.rs | 9 +-
crates/benilla-world/src/static_gx/render.rs | 110 ++-
18 files changed, 1021 insertions(+), 52 deletions(-)
create mode 100644 crates/benilla-app/src/player_shadow.rs
create mode 100644 crates/benilla-app/src/shaders/shadow_caster.wgsl
diff --git a/.gitignore b/.gitignore
index 706cf583..7664883e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,3 +19,6 @@ trace-*.json
.DS_Store
*.swp
/.idea/
+
+# MONKEY: per-run client state written by benilla (saved variables, camera) — not source.
+/benilla-config/
diff --git a/crates/benilla-app/assets/ui/OptionsFrame.xml b/crates/benilla-app/assets/ui/OptionsFrame.xml
index 34096572..39320152 100644
--- a/crates/benilla-app/assets/ui/OptionsFrame.xml
+++ b/crates/benilla-app/assets/ui/OptionsFrame.xml
@@ -677,6 +677,11 @@
.. "There is no exclusive fullscreen mode. WoW itself removed one in 8.0.1, and "
.. "modern Classic offers these same two."
+ BENILLA_TOOLTIP_WORLD_SHADOWS =
+ "Renders real dynamic silhouettes for players, NPCs, creatures, and mounts. Terrain, "
+ .. "buildings, and trees keep their authored shading, matching Wrath's character-only "
+ .. "shadow tier. This uses additional GPU time and memory."
+
OPTIONS_PAGE_ROWS = {
Controls = {
"RowStickyTarget", "RowBlockTrades", "RowAutoLoot", "RowInvertMouse",
@@ -689,7 +694,7 @@
},
Graphics = {
"RowUiScale", "RowFarclip", "RowWorldDetail",
- "RowDisplayMode", "RowVerticalSync", "RowRenderScale",
+ "RowDisplayMode", "RowVerticalSync", "RowWorldShadows", "RowRenderScale",
},
Nameplates = {
"RowEnemyPlates", "RowFriendlyPlates",
@@ -2517,11 +2522,21 @@
"OPTION_TOOLTIP_VERTICAL_SYNC")
-
+
+
+ OptionsRow_OnLoad(self, "worldShadows", "Real Character Shadows",
+ "BENILLA_TOOLTIP_WORLD_SHADOWS")
+
+
+
+
+
+
+
-- Render Scale (decision 1639) -- benilla's own
-- row, no 1.12 counterpart: the reference renders
diff --git a/crates/benilla-app/src/blob_shadow.rs b/crates/benilla-app/src/blob_shadow.rs
index 6070f668..953f15d8 100644
--- a/crates/benilla-app/src/blob_shadow.rs
+++ b/crates/benilla-app/src/blob_shadow.rs
@@ -182,6 +182,7 @@ fn sync_shadows(
/// reaches zero, or no receiving surface is in the box (the reference's no-ground gate).
#[allow(clippy::too_many_arguments, clippy::type_complexity)]
fn update_shadows(
+ video: Res,
time: Res