From bb464538d029e160fc9c4ec6e2d0d7f651cbcb86 Mon Sep 17 00:00:00 2001 From: Evan Date: Tue, 16 Jun 2026 18:56:07 -0700 Subject: [PATCH] =?UTF-8?q?Add=20Fallout=20effects=20toggle=20to=20graphic?= =?UTF-8?q?s=20settings=20=E2=98=A2=EF=B8=8F=20(#4313)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Adds a **"Fallout effects"** toggle to the *Effects* section of the graphics settings modal, letting players disable the nuclear fallout visuals (useful for performance). Fallout is rendered by two passes — the broiling green **bloom** on irradiated territory and its additive **light** contribution in day/night mode. The bloom pass was already gated by `passEnabled.falloutBloom`, but the light pass had no gate. This adds a `passEnabled.falloutLight` flag and a single user-facing `passEnabled.fallout` graphics override that drives both together. ## Changes - **`RenderSettings.ts` / `render-settings.json`** — new `passEnabled.falloutLight` flag (default `true`). - **`LightmapPass.ts`** — gate the fallout light pass behind `passEnabled.falloutLight`. - **`GraphicsOverrides.ts`** — add `fallout: z.boolean()` to the `passEnabled` override group. - **`RenderOverrides.ts`** — apply `passEnabled.fallout` to both `falloutBloom` and `falloutLight`. - **`GraphicsSettingsModal.ts`** — `currentFallout()` / `onToggleFallout()` + a toggle button (mirrors the existing Special Effects toggle). - **`en.json`** — `graphics_setting.fallout_label` / `fallout_desc`. ## Testing - `tsc --noEmit` passes; JSON files validated. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.8 --- resources/lang/en.json | 2 ++ .../hud/layers/GraphicsSettingsModal.ts | 30 +++++++++++++++++++ src/client/render/gl/GraphicsOverrides.ts | 3 ++ src/client/render/gl/RenderOverrides.ts | 6 ++++ src/client/render/gl/RenderSettings.ts | 1 + src/client/render/gl/passes/LightmapPass.ts | 4 ++- src/client/render/gl/render-settings.json | 1 + 7 files changed, 46 insertions(+), 1 deletion(-) diff --git a/resources/lang/en.json b/resources/lang/en.json index 5dfce1e70..92fcb3a16 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -523,6 +523,8 @@ "colored_names_label": "Name color", "coordinate_grid_opacity_desc": "How opaque the coordinate grid is (lower lets more things show through)", "coordinate_grid_opacity_label": "Coordinate grid opacity", + "fallout_desc": "Show the green nuclear fallout glow on irradiated territory. Disable to improve performance", + "fallout_label": "Fallout effects", "highlight_brighten_desc": "How strongly the border brightens on hover (0 to disable)", "highlight_brighten_label": "Border highlight amount", "highlight_fill_desc": "How strongly territory brightens on hover (0 to disable)", diff --git a/src/client/hud/layers/GraphicsSettingsModal.ts b/src/client/hud/layers/GraphicsSettingsModal.ts index 22ca56b20..d0b65abac 100644 --- a/src/client/hud/layers/GraphicsSettingsModal.ts +++ b/src/client/hud/layers/GraphicsSettingsModal.ts @@ -487,6 +487,17 @@ export class GraphicsSettingsModal extends LitElement implements Controller { this.patchPassEnabled({ fx: !this.currentSpecialEffects() }); } + private currentFallout(): boolean { + return ( + this.userSettings.graphicsOverrides().passEnabled?.fallout ?? + renderDefaults.passEnabled.falloutBloom + ); + } + + private onToggleFallout() { + this.patchPassEnabled({ fallout: !this.currentFallout() }); + } + /** Whether colorblind mode is currently enabled. */ private currentColorblind(): boolean { return ( @@ -1137,6 +1148,25 @@ export class GraphicsSettingsModal extends LitElement implements Controller { + +
diff --git a/src/client/render/gl/GraphicsOverrides.ts b/src/client/render/gl/GraphicsOverrides.ts index 453e371c5..021450c6a 100644 --- a/src/client/render/gl/GraphicsOverrides.ts +++ b/src/client/render/gl/GraphicsOverrides.ts @@ -38,6 +38,9 @@ export const GraphicsOverridesSchema = z passEnabled: z .object({ fx: z.boolean(), + // Nuclear fallout effects: the broiling green territory bloom and its + // light emission in day/night mode. Disable to improve performance. + fallout: z.boolean(), }) .partial(), accessibility: z diff --git a/src/client/render/gl/RenderOverrides.ts b/src/client/render/gl/RenderOverrides.ts index cd71ea9ed..5d53883e5 100644 --- a/src/client/render/gl/RenderOverrides.ts +++ b/src/client/render/gl/RenderOverrides.ts @@ -73,6 +73,12 @@ export function applyGraphicsOverrides( if (overrides.passEnabled?.fx !== undefined) { settings.passEnabled.fx = overrides.passEnabled.fx; } + if (overrides.passEnabled?.fallout !== undefined) { + // One user-facing toggle drives both fallout passes: the territory bloom + // and its additive light contribution in the day/night composite. + settings.passEnabled.falloutBloom = overrides.passEnabled.fallout; + settings.passEnabled.falloutLight = overrides.passEnabled.fallout; + } if (overrides.terrain?.oceanColor !== undefined) { settings.terrain.oceanColor = overrides.terrain.oceanColor; } diff --git a/src/client/render/gl/RenderSettings.ts b/src/client/render/gl/RenderSettings.ts index 6654e50a4..d301f1e2d 100644 --- a/src/client/render/gl/RenderSettings.ts +++ b/src/client/render/gl/RenderSettings.ts @@ -52,6 +52,7 @@ export interface RenderSettings { unit: boolean; name: boolean; falloutBloom: boolean; + falloutLight: boolean; railroad: boolean; fx: boolean; bar: boolean; diff --git a/src/client/render/gl/passes/LightmapPass.ts b/src/client/render/gl/passes/LightmapPass.ts index 5994b1fc3..935fc958c 100644 --- a/src/client/render/gl/passes/LightmapPass.ts +++ b/src/client/render/gl/passes/LightmapPass.ts @@ -160,7 +160,9 @@ export class LightmapPass { this.pointLightPass.draw(cameraMatrix); // --- 2. Fallout light → extract at tile res, composite into FBO A (additive) --- - this.falloutLightPass.draw(cameraMatrix, this.lightFboA, lw, lh, tick); + if (this.settings.passEnabled.falloutLight) { + this.falloutLightPass.draw(cameraMatrix, this.lightFboA, lw, lh, tick); + } // --- 3. Blur: 2 iterations separable H+V Gaussian --- const zoom = Math.abs(cameraMatrix[0]); diff --git a/src/client/render/gl/render-settings.json b/src/client/render/gl/render-settings.json index b2d3487c7..4c3e0eb39 100644 --- a/src/client/render/gl/render-settings.json +++ b/src/client/render/gl/render-settings.json @@ -10,6 +10,7 @@ "unit": true, "name": true, "falloutBloom": true, + "falloutLight": true, "railroad": true, "fx": true, "bar": true,