Fix nuke fallout embers flickering forever ☢️

The ember/particle flicker in the fallout effect was gated only by the
fallout bit, which is permanent on tiles that stay unowned. It also ramped
to full strength as the per-tile heat decayed to 0 and animated on the
global tick, so it kept flickering indefinitely after the blast had cooled —
visible both as the bloom dots and (more prominently) as the ambient ember
light when dynamic lighting is enabled.

Fade both with heat so they vanish along with the glow:
- extract.frag.glsl: bloom dots multiplied by the glow's opacity
- fallout-light.frag.glsl: ember light multiplied by heat

Heat decay timing is unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
evanpelle
2026-06-14 18:45:29 -07:00
parent b997099dfe
commit 5161d78d84
2 changed files with 8 additions and 0 deletions
@@ -45,6 +45,10 @@ void main() {
float flick = max(0.0, sin(uTick * tileRate + h1 * 12.0) * 0.8 + 0.2);
flick *= flick;
flick *= mix(uParticleFreshScale, 1.0, 1.0 - heat);
// Fade embers out with the heat. The fallout bit is permanent on tiles
// that stay unowned, so without this the ember light flickers forever
// once the blast has cooled.
flick *= heat;
light += uEmberLightColor * flick * uEmberLightIntensity;
}
@@ -102,6 +102,10 @@ void main() {
flick *= flick;
// Dampen when fresh (high heat); ramp to full as heat decays.
flick *= mix(uParticleFreshScale, 1.0, 1.0 - heat);
// Fade dots out with the glow. Heat decays to 0, but the fallout bit is
// permanent on tiles that stay unowned, so without this the dots flicker
// forever once the bloom is gone.
flick *= opacity;
vec3 pc = mix(uParticleColorDark, uParticleColorBright, h1) * flick * uParticleStrength;
float pa = max(pc.r, max(pc.g, pc.b));
fragColor += vec4(pc, pa);