Files
benilla-octo/crates
pkuzicandClaude Opus 4.8 a0f65f26ae MONKEY: shadow extension hook (benilla::shadow_hook) so receivers stay untouched
Extract the realtime directional-shadow term (fetch + edge fade + night fade)
into ONE importable WGSL library, benilla::shadow_hook, and route all three
receivers through it. Adding or changing the realtime shadow now touches only
shadow_hook.wgsl; terrain.wgsl / wow_model.wgsl / static_gx.wgsl (the shaders
that blanked the terrain when hand-edited) are no longer edited per shadow
feature. Confirmed in-game (rendering unchanged).

- shadow_hook.wgsl (NEW): `realtime_shadow(sample_pos, normal, view_z, cam_dist,
  shadow_range, night) -> factor`. No-op whenever no shadow sun exists (the only
  Bevy DirectionalLight benilla spawns is the rig's, so n_directional_lights == 0
  exactly when shadows are off) — no shader-def toggle needed. Registered via
  bevy `load_shader_library!` in benilla-assets so `#import benilla::shadow_hook`
  resolves across crates (verified: the model pipeline composes it cleanly).
- terrain / wow_model: replace the inline fetch+fade with the hook call; keep
  their own downstream gating (MCSH suppression + spec gate; rig-skin sample
  point + interior exclusion + ambient-preserving apply). Behavior-preserving.
- static_gx: routed through the hook too — tree/building surfaces now get the
  SAME edge + night fade terrain/models already had (they lacked it before).
- The duplicated SHADOW_EDGE_BAND const now lives once, in the hook.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-05 18:50:52 +01:00
..