Rework the realtime shadow feature into two INDEPENDENT, plug-and-play
modules over one shared rig, plus alpha-tested foliage:
- character_shadow.rs (was player_shadow.rs): owns the shared rig — one
directional "sun" on private layer 31, the camera-layer plumbing, the
shadow map, the invisible proxy material — and the per-frame CHARACTER
lane. The rig lights up whenever EITHER lane is on.
- world_shadow.rs (NEW, self-contained): the WORLD lane — the retained
static_gx world (trees + buildings, cast solid) and alpha-tested foliage
(leaf canopies, one caster per leaf texture). Removing the feature is
deleting this module + its two calls + the cvar.
Two separate cvars, each on its own Options row: `characterShadows`
(players/NPCs/creatures/mounts, replacing the oval blob) and `worldShadows`
(the static world + foliage, and MCSH terrain-shadow suppression). Either
alone drives the shared sun; the per-frame entity caster admits Creature
parts under characterShadows and entity-resident environment under
worldShadows.
Alpha-tested foliage caster (leaf-shaped canopy shadows): a
CutoutShadowCasterMaterial (AlphaMode::Mask + an explicit prepass fragment,
shadow_caster_cutout_prepass.wgsl) samples the leaf sheet and discards
transparent texels in the directional-shadow pass, so a canopy casts its
leaves instead of a solid box. Grouped one caster per leaf texture;
StaticGx::collect_cutout_shadow_triangles buckets by AssetId and reuses the
foliage's own image handle so the sampler inherits the correct clamp mode.
MCSH terrain-shadow suppression now keys on the WORLD lane only (packed into
the free sh_c16.w light lane via a new WorldShadowActive resource), not on
the mere presence of a shadow sun — so character-only shadows leave the
world's baked shadows intact. blob_shadow now hides the oval on
characterShadows, not worldShadows.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>