Skip to content

Add a low-resolution dynamic light map - #21

Merged
vaprdev merged 4 commits into
mainfrom
light-map
Oct 10, 2026
Merged

vaprdev merged 4 commits into
mainfrom
light-map

Conversation

@vaprdev

@vaprdev vaprdev commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Summary

Moving light (the aurora, campfires, lava, neon) only lit itself; nothing around it changed. src/lightmap.ts adds a low-resolution light map: scenes drop light nodes into a coarse grid each frame, and LightMap.apply() spreads it over the ground they light. firelight() gives fires a shared flicker and auroraFold() the aurora's travelling folds.

render()
  lights.clear()
  lights.node(i, j, color, strength, reach)   # aurora folds, fires, lava, neon, lanterns
  lights.apply(hdr)                           # blur the grid up and add it to the scene; touch() each lit run
  • Tundra: the aurora's sheen moves across the snow and lake.
  • Fires flicker (desert campfire, tundra igloos, farm barn door, zen lanterns); prehistoric lava glows on the slope; city neon lights the street.

Refinements:

  • LightMap.apply() touches the runs of blocks it lights, so cells reused by dirty-cells pick up the moving light (--verify-dirty passes).
  • The tundra aurora sheen on the snow is toned down by a quarter.

Evidence

light map
light map 2
tundra night

After the refinements, previews behind text, origin/main (left) vs this branch (right):

previews

Cost, dev/check.ts tundra desert prehistoric city back to back twice: 6.37 → 6.63 ms/frame. Worst flicker unchanged (86 cells).

Verified: typecheck, build, dev/check.ts --max-ms=60 in octant and quadrant mode (0 failed), --verify-dirty 90/90 with every lit pixel inside the touched boxes; screenshots regenerated.

Merge Danger

Door: two-way

Blast Radius: the look of night and sunset scenes with fires, lava, neon or aurora.

…ow, flickering fires, lanterns, lava and neon
# Conflicts:
#	wallpapers/beach.ts
#	wallpapers/city.ts
#	wallpapers/desert.ts
#	wallpapers/farm.ts
#	wallpapers/prehistoric.ts
#	wallpapers/tundra.ts
@vaprdev
vaprdev merged commit e7030cd into main Oct 10, 2026
22 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