From fbeb0f02f665bbb4fc9895a6188996bdc451fdac Mon Sep 17 00:00:00 2001 From: pkuzic Date: Sat, 3 Oct 2026 11:22:53 +0100 Subject: [PATCH] MONKEY (gfx): separate fading foliage from downstream material markers Move the foliage wind marker from bit 14 to bit 15 in its Rust producer and WGSL consumer so distance-fade twins cannot trigger a downstream fragment effect. Keep bit 14 reserved for those extensions. Verified on Windows: cargo build -p benilla --profile play; cargo test -p benilla-app --lib (4313 passed, 0 failed, 10 ignored; no-install run). Public-base and fixed captures at the reported Elwynn position are pixel-identical; downstream integration still needs its in-game retest. Co-Authored-By: GPT-6 Astra (Codex) --- crates/benilla-assets/src/shaders/wow_model.wgsl | 4 ++-- crates/benilla-world/src/model_render.rs | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/crates/benilla-assets/src/shaders/wow_model.wgsl b/crates/benilla-assets/src/shaders/wow_model.wgsl index 9053cb5b..88d3decc 100644 --- a/crates/benilla-assets/src/shaders/wow_model.wgsl +++ b/crates/benilla-assets/src/shaders/wow_model.wgsl @@ -1109,10 +1109,10 @@ fn vertex(vertex: WowVertex) -> WowVsOut { } #endif // MONKEY (wind): a retained tree inside its fade band renders here with the same anchor/field - // maths, to avoid a pop. MONKEY (fix-wind): the leaf-batch marker is material bit 14 + // maths, to avoid a pop. MONKEY (wind): the leaf-batch marker is material bit 15 // (`model_render::FOLIAGE_WIND_MARKER`), never a MeshTag bit (bit 18 aliases the lane weight // and the interior probe slot, so doorway units and interior props swayed). - if ((u32(m.clutter_fade.z) & 16384u) != 0u && m.clutter_fade.w <= 0.5) { + if ((u32(m.clutter_fade.z) & 32768u) != 0u && m.clutter_fade.w <= 0.5) { let world = p_cam + view.world_position; p_cam += wind_hook::tree_offset( world, frame_origin, view.world_position, wow_light.monkey diff --git a/crates/benilla-world/src/model_render.rs b/crates/benilla-world/src/model_render.rs index 9ad221ef..0997ce90 100644 --- a/crates/benilla-world/src/model_render.rs +++ b/crates/benilla-world/src/model_render.rs @@ -488,11 +488,12 @@ pub(crate) const ENV_MAP_MARKER: u16 = 1 << 12; /// vertex with no raster bias; a `WowModelKey` axis, so every other draw keeps its real depth. pub(crate) const SKY_DEPTH_MARKER: u16 = 1 << 13; -/// MONKEY (fix-wind): `clutter_fade.z` marker bit 14: a classified tree/bush leaf batch's exile +/// MONKEY (wind): `clutter_fade.z` marker bit 15: a classified tree/bush leaf batch's exile /// copy, the only entity draw `wow_model.wgsl` applies `tree_offset` to. Vertex-only uniform data, /// not a `WowModelKey` axis. (It replaced MeshTag bit 18, which aliases the lane weight and the -/// interior probe slot, so doorway units and interior props swayed.) -pub(crate) const FOLIAGE_WIND_MARKER: u16 = 1 << 14; +/// interior probe slot, so doorway units and interior props swayed.) Bit 14 is reserved for +/// downstream material extensions; sharing it makes faded foliage take their fragment paths. +pub(crate) const FOLIAGE_WIND_MARKER: u16 = 1 << 15; /// [`BATCH_ORDER_SORT_EPS`] for the WMO skybox lane: at the −6e4 rung the f32 ulp is 0.0039, so /// 1e-3 would round away; this step is 4 ulps. Every skybox batch pair ties, being eye-anchored.