From 6fbfb10e48c4aafaf85ba332eed89a2a83f34a89 Mon Sep 17 00:00:00 2001 From: popertots Date: Fri, 20 Mar 2026 14:17:19 +0000 Subject: [PATCH] fix: replace HSV df_fade_color with exact stacked blue compositing --- src/world/tiles/tilemap_chunk.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/world/tiles/tilemap_chunk.rs b/src/world/tiles/tilemap_chunk.rs index c4a97db..dff4e92 100644 --- a/src/world/tiles/tilemap_chunk.rs +++ b/src/world/tiles/tilemap_chunk.rs @@ -86,8 +86,18 @@ fn df_fade_color(z_diff: i32) -> Color { if z_diff <= 0 { return Color::WHITE; } - let saturation = (z_diff as f32 / 8.0).clamp(0.0, 1.0); - Color::hsv(194.7, saturation, 1.0 - saturation / 2.0) + let n = (z_diff as f32).min(8_f32); + let overlay_r = 133_f32 / 255_f32; + let overlay_g = 167_f32 / 255_f32; + let overlay_b = 178_f32 / 255_f32; + let layer_alpha = 41_f32 / 255_f32; + let acc_alpha = 1_f32 - (1_f32 - layer_alpha).powf(n); + let inv = 1_f32 - acc_alpha; + Color::srgb( + overlay_r * acc_alpha + inv, + overlay_g * acc_alpha + inv, + overlay_b * acc_alpha + inv, + ) } fn is_tile_visible_at_z(tile_data: &FloorTileData, z_index: usize) -> bool {