Skip to content

Downsample fallout bloom + light extract for fillrate-bound GPUs#4157

Merged
evanpelle merged 1 commit into
mainfrom
bloom-perf
Jun 4, 2026
Merged

Downsample fallout bloom + light extract for fillrate-bound GPUs#4157
evanpelle merged 1 commit into
mainfrom
bloom-perf

Conversation

@evanpelle
Copy link
Copy Markdown
Collaborator

@evanpelle evanpelle commented Jun 4, 2026

Description:

On low-end machines, the fillrate was too high causing framerate to drop. The graphical difference is pretty negligible since fallout & light are meant to be blurred anyways.

Reduces fillrate cost of the fallout bloom and fallout-light passes on low-end GPUs:

  • Extract step now renders at mapW/8 × mapH/8 (64× fewer fragments). Output is heavily blurred + LINEAR-magnified, so the visual difference is minimal.
  • Bloom blur reduced from 2× 9-tap to 1× 5-tap Gaussian (the smaller kernel is sufficient given the lower-res source).

Please complete the following:

  • I have added screenshots for all UI updates
  • I process any text displayed to the user through translateText() and I've added it to the en.json file
  • I have added relevant tests to the test directory

Please put your Discord username so you can be contacted if a bug or regression is found:

evan

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9b57af5f-4586-4353-91b5-239874a95a9f

📥 Commits

Reviewing files that changed from the base of the PR and between 43911db and b838dd6.

⛔ Files ignored due to path filters (3)
  • src/client/render/gl/shaders/day-night/fallout-light.frag.glsl is excluded by !**/*.glsl
  • src/client/render/gl/shaders/fallout-bloom/extract.frag.glsl is excluded by !**/*.glsl
  • src/client/render/gl/shaders/shared/blur.frag.glsl is excluded by !**/*.glsl
📒 Files selected for processing (2)
  • src/client/render/gl/passes/FalloutBloomPass.ts
  • src/client/render/gl/passes/FalloutLightPass.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/client/render/gl/passes/FalloutBloomPass.ts

Walkthrough

Bloom and light extraction passes now render into reduced sub-tile framebuffers instead of full map resolution. Each pass computes scaled dimensions from tile-scale constants, updates texture/FBO allocation, and adds tile-scale uniforms to the extraction shaders while keeping composite stages full-resolution.

Changes

Fallout Effects Sub-tile Resolution

Layer / File(s) Summary
Bloom pass constants, fields, and uniform initialization
src/client/render/gl/passes/FalloutBloomPass.ts
FalloutBloomPass class documentation updated to describe sub-tile extraction. New uExtractTileScale uniform location field and bloomW/bloomH dimension fields added. Constructor queries and stores the extract shader's uTileScale uniform.
Bloom texture allocation and extraction viewport
src/client/render/gl/passes/FalloutBloomPass.ts
Bloom textures/FBOs allocate at reduced bloomW/bloomH instead of full mapW/mapH. Extract pass sets viewport to sub-tile dimensions and uploads uExtractTileScale uniform alongside existing map-size uniforms.
Bloom blur stage separable convolution
src/client/render/gl/passes/FalloutBloomPass.ts
Blur implementation simplified from iterative separable H/V loop to single two-step pass: horizontal draw from texA into fboB, then vertical draw from texB back into fboA, with blur offsets computed from sub-tile dimensions.
Light pass constants, fields, and uniform initialization
src/client/render/gl/passes/FalloutLightPass.ts
FalloutLightPass class documentation and LIGHT_TILE_SCALE = 8 constant introduced. New uFalloutTileScale uniform location field and lightW/lightH dimension fields added. Constructor queries and stores the extraction shader's uTileScale uniform.
Light texture allocation and extraction draw pass
src/client/render/gl/passes/FalloutLightPass.ts
Light extraction texture/FBO allocate at computed lightW/lightH (floored map size divided by LIGHT_TILE_SCALE, clamped to minimum 1). Draw step 1 sets viewport to sub-tile dimensions and uploads LIGHT_TILE_SCALE via uFalloutTileScale while composite stage keeps full-resolution map-size uniforms.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🌟 Bloom and light now scale their dance,
Sub-tiles whisper through the frame,
Extraction leans, composites glance—
Each pass knows its rightful name. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: downsampling fallout bloom and light extraction for performance optimization on fillrate-bound GPUs.
Description check ✅ Passed The description clearly explains the purpose (reducing fillrate cost), the specific changes (mapW/8 × mapH/8 downsampling, blur kernel reduction), and provides relevant context about visual quality trade-offs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (3)
src/client/render/gl/passes/FalloutBloomPass.ts (1)

17-17: ⚡ Quick win

Move BLOOM_TILE_SCALE to render-settings.json.

This tuning constant is hardcoded at module level. Per coding guidelines, all per-pass tuning constants should live in gl/render-settings.json so they can be tweaked without code changes.

Consider adding it under the falloutBloom section and reading it at construct time like other settings.

Suggested approach

In render-settings.json:

  "falloutBloom": {
+   "tileScale": 8,
    "broilSpeedCold": 0.0018,

In this file:

-const BLOOM_TILE_SCALE = 8;
-
 // ...inside constructor:
+const tileScale = settings.falloutBloom.tileScale;
-this.bloomW = Math.max(1, Math.floor(mapW / BLOOM_TILE_SCALE));
-this.bloomH = Math.max(1, Math.floor(mapH / BLOOM_TILE_SCALE));
+this.bloomW = Math.max(1, Math.floor(mapW / tileScale));
+this.bloomH = Math.max(1, Math.floor(mapH / tileScale));

Store tileScale as a field if needed in draw().

As per coding guidelines: "All per-pass tuning constants (alpha, radii, colors, etc.) should be defined in gl/render-settings.json".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/client/render/gl/passes/FalloutBloomPass.ts` at line 17, BLOOM_TILE_SCALE
is a hardcoded per-pass tuning constant; move it into gl/render-settings.json
under a falloutBloom.tileScale field and read it in the FalloutBloomPass
constructor (the class FalloutBloomPass and its draw() method currently rely on
BLOOM_TILE_SCALE). Update the constructor to accept or load settings (e.g., from
the existing settings loader used by other passes) and store tileScale on the
instance for use in draw(), replacing references to the module-level
BLOOM_TILE_SCALE with this instance property.
src/client/render/gl/passes/FalloutLightPass.ts (1)

14-14: ⚡ Quick win

Move LIGHT_TILE_SCALE to render-settings.json.

Same issue as in FalloutBloomPass — this tuning constant should live in the settings file. Consider adding it under the lighting section.

Suggested approach

In render-settings.json:

  "lighting": {
+   "falloutTileScale": 8,
    "ambient": 1,

In this file, read it from settings.lighting.falloutTileScale at construct time.

As per coding guidelines: "All per-pass tuning constants (alpha, radii, colors, etc.) should be defined in gl/render-settings.json".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/client/render/gl/passes/FalloutLightPass.ts` at line 14, Replace the
hardcoded constant LIGHT_TILE_SCALE in FalloutLightPass with a value read from
the render settings: remove or stop using the const LIGHT_TILE_SCALE and, in the
FalloutLightPass constructor, read settings.lighting.falloutTileScale (from
gl/render-settings.json) and store it on the instance (e.g.,
this.falloutTileScale) for use where LIGHT_TILE_SCALE was referenced; also add a
new fallback/default in render-settings.json under "lighting" named
"falloutTileScale" so existing behavior is preserved if the setting is missing.
vite.config.ts (1)

225-225: ⚡ Quick win

Make network binding configurable for security.

Setting host: true exposes the dev server to the local network. While this can be useful for testing on mobile devices or remote development, it should be opt-in rather than always-on. Consider making this configurable via environment variable.

🔧 Suggested approach
     server: {
       port: 9000,
-      host: true,
+      host: process.env.VITE_HOST === "true",
       // Automatically open the browser when the server starts
       open: process.env.SKIP_BROWSER_OPEN !== "true",

Add a comment documenting when to enable:

// Set VITE_HOST=true to expose dev server on the network (for mobile testing, etc.)
host: process.env.VITE_HOST === "true",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@vite.config.ts` at line 225, The dev server currently hardcodes host: true
which always exposes the server to the network; change the Vite config's host
property to be opt-in via an environment variable (e.g., use
process.env.VITE_HOST === "true") and add a brief comment explaining when to
enable it, updating the host assignment in the exported config object (where
host: true is set) so network binding is only enabled when the env var is
present.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/client/render/gl/passes/FalloutBloomPass.ts`:
- Line 17: BLOOM_TILE_SCALE is a hardcoded per-pass tuning constant; move it
into gl/render-settings.json under a falloutBloom.tileScale field and read it in
the FalloutBloomPass constructor (the class FalloutBloomPass and its draw()
method currently rely on BLOOM_TILE_SCALE). Update the constructor to accept or
load settings (e.g., from the existing settings loader used by other passes) and
store tileScale on the instance for use in draw(), replacing references to the
module-level BLOOM_TILE_SCALE with this instance property.

In `@src/client/render/gl/passes/FalloutLightPass.ts`:
- Line 14: Replace the hardcoded constant LIGHT_TILE_SCALE in FalloutLightPass
with a value read from the render settings: remove or stop using the const
LIGHT_TILE_SCALE and, in the FalloutLightPass constructor, read
settings.lighting.falloutTileScale (from gl/render-settings.json) and store it
on the instance (e.g., this.falloutTileScale) for use where LIGHT_TILE_SCALE was
referenced; also add a new fallback/default in render-settings.json under
"lighting" named "falloutTileScale" so existing behavior is preserved if the
setting is missing.

In `@vite.config.ts`:
- Line 225: The dev server currently hardcodes host: true which always exposes
the server to the network; change the Vite config's host property to be opt-in
via an environment variable (e.g., use process.env.VITE_HOST === "true") and add
a brief comment explaining when to enable it, updating the host assignment in
the exported config object (where host: true is set) so network binding is only
enabled when the env var is present.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5f003daa-d279-4171-8ab8-2c0e8216a6b8

📥 Commits

Reviewing files that changed from the base of the PR and between 0ab437e and 2c7b48c.

⛔ Files ignored due to path filters (3)
  • src/client/render/gl/shaders/day-night/fallout-light.frag.glsl is excluded by !**/*.glsl
  • src/client/render/gl/shaders/fallout-bloom/extract.frag.glsl is excluded by !**/*.glsl
  • src/client/render/gl/shaders/shared/blur.frag.glsl is excluded by !**/*.glsl
📒 Files selected for processing (4)
  • src/client/render/gl/passes/FalloutBloomPass.ts
  • src/client/render/gl/passes/FalloutLightPass.ts
  • src/client/render/gl/render-settings.json
  • vite.config.ts

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 4, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 4, 2026
@evanpelle evanpelle changed the title bloom Downsample fallout bloom + light extract for fillrate-bound GPUs Jun 4, 2026
@evanpelle evanpelle marked this pull request as ready for review June 4, 2026 23:40
@evanpelle evanpelle requested a review from a team as a code owner June 4, 2026 23:40
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 4, 2026
@evanpelle evanpelle added this to the v32 milestone Jun 4, 2026
@evanpelle evanpelle added the Performance Performance optimization label Jun 4, 2026
@evanpelle evanpelle merged commit 2c2390d into main Jun 4, 2026
13 of 14 checks passed
@evanpelle evanpelle deleted the bloom-perf branch June 4, 2026 23:53
@github-project-automation github-project-automation Bot moved this from Triage to Complete in OpenFront Release Management Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Performance Performance optimization

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

1 participant