From b251857af1d923e01291f6bb5a8c421b50d2d9b8 Mon Sep 17 00:00:00 2001 From: Kapu1178 <75460809+Kapu1178@users.noreply.github.com> Date: Sat, 29 Jun 2024 20:44:02 -0400 Subject: [PATCH] fix bloom the right way (#1011) * fix bloom the right way * ok i guess --- code/modules/lighting/lighting_corner.dm | 39 +++++++++++++----------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/code/modules/lighting/lighting_corner.dm b/code/modules/lighting/lighting_corner.dm index 420803feed94..286ba4a4f0cd 100644 --- a/code/modules/lighting/lighting_corner.dm +++ b/code/modules/lighting/lighting_corner.dm @@ -99,17 +99,6 @@ lum_g += delta_g lum_b += delta_b - add_r = clamp((lum_r - 1.1) * 0.3, 0, 0.22) - add_g = clamp((lum_g - 1.1) * 0.3, 0, 0.22) - add_b = clamp((lum_b - 1.1) * 0.3, 0, 0.22) - - // Client-shredding, does not cull any additive overlays. - //applying_additive = add_r || add_g || add_b - // Cull additive overlays that would be below 0.03 alpha in any color. - applying_additive = max(add_r, add_g, add_b) > 0.03 - // Cull additive overlays whose color alpha sum is lower than 0.03 - //applying_additive = (add_r + add_g + add_b) > 0.03 - if (!needs_update) needs_update = TRUE SSlighting.corners_queue += src @@ -125,9 +114,13 @@ if (largest_color_luminosity > 1) . = 1 / largest_color_luminosity - // var/old_r = cache_r - // var/old_g = cache_g - // var/old_b = cache_b + var/old_r = cache_r + var/old_g = cache_g + var/old_b = cache_b + + var/old_add_r = add_r + var/old_add_g = add_g + var/old_add_b = add_b #if LIGHTING_SOFT_THRESHOLD != 0 else if (largest_color_luminosity < LIGHTING_SOFT_THRESHOLD) @@ -142,14 +135,24 @@ cache_b = round(lum_b * ., LIGHTING_ROUND_VALUE) #endif + add_r = clamp((lum_r - 1.1) * 0.3, 0, 0.22) + add_g = clamp((lum_g - 1.1) * 0.3, 0, 0.22) + add_b = clamp((lum_b - 1.1) * 0.3, 0, 0.22) + + // Client-shredding, does not cull any additive overlays. + //applying_additive = add_r || add_g || add_b + // Cull additive overlays that would be below 0.03 alpha in any color. + applying_additive = max(add_r, add_g, add_b) > 0.03 + // Cull additive overlays whose color alpha sum is lower than 0.03 + //applying_additive = (add_r + add_g + add_b) > 0.03 + src.largest_color_luminosity = round(largest_color_luminosity, LIGHTING_ROUND_VALUE) #ifdef VISUALIZE_LIGHT_UPDATES - if(!SSlighting.allow_duped_corners && old_r == cache_r && old_g == cache_g && old_b == cache_b) + if(!SSlighting.allow_duped_corners && old_r == cache_r && old_g == cache_g && old_b == cache_b && old_add_r == add_r && old_add_b == add_b && old_add_g == add_g) return #else - // For some reason, preventing duped corners breaks bloom, so it's disabled. - // if(old_r == cache_r && old_g == cache_g && old_b == cache_b) - // return + if(old_r == cache_r && old_g == cache_g && old_b == cache_b && old_add_r == add_r && old_add_b == add_b && old_add_g == add_g) + return #endif var/datum/lighting_object/lighting_object = master_NE?.lighting_object