Skip to content

Bloom and tone-map the static background once - #13

Merged
vaprdev merged 2 commits into
mainfrom
static-bloom
Oct 10, 2026
Merged

vaprdev merged 2 commits into
mainfrom
static-bloom

Conversation

@vaprdev

@vaprdev vaprdev commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Summary

Bloom and tone mapping ran over the whole scene every frame, though most of it never changes. Now layout() blooms and tone-maps the static background once; each frame only the 4×4 bloom blocks whose light differs from the background are blurred and tone-mapped again. The blur and tone map loops are faster too.

 render()
   restore background
   draw what moves
-  finish(): bloom + tone map every pixel
+  finish(): bloom + tone map only blocks that differ from the background

Evidence

Scene cost per frame (step + render at 320×180, every wallpaper and time, teeming), origin/main vs this branch back to back:

main after
scene 2.95 ms 2.38 ms
finish() 1.10 ms 0.55 ms

Output stays within 1 level of 255 of the full-frame bloom:

static bloom
static bloom night

Verified: typecheck, build, dev/check.ts --max-ms=60 in octant and quadrant mode (0 failed), screenshots up to date.

Merge Danger

Door: two-way

Blast Radius: Canvas.finish() for every wallpaper; a scene that changes pixels without going through the background diff would show stale bloom.

@vaprdev
vaprdev merged commit e9d9fcb into main Oct 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant