Skip to content

Blow wind through the wood, rustle and shed leaves, fix lamp reflections - #56

Merged
loeck merged 2 commits into
mainfrom
t3/wind-cursor-leaves
Nov 8, 2026
Merged

loeck merged 2 commits into
mainfrom
t3/wind-cursor-leaves

Conversation

@loeck

@loeck loeck commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Summary

The wood looked windless, a pointer sweep barely stirred the trees, the cursor's lantern often missed the trees further back at night, and lamp reflections sometimes cut a large black square into the lake. This pass makes the wind visible: gusts roll through the wood in waves, a brisk ordinary sweep rustles the foliage it crosses, gusts tear leaves off that flutter down, the cursor lights far crowns at night, and lamp glows reflect cleanly.

Changes

  • Stronger wind. Crowns swayed only a few centimetres, invisible at the 40–100 m where most trees stand. Wood and foliage now sway 2.4 times further, with a small calm-day lean, and a soft ceiling stops them folding over. Gust patches (new wind-field.ts) roll downwind at 9 m/s in spells of a few tens of seconds, with lulls between.
  • The cursor rustles the foliage. A sweep now raises a gust from 450 px/s, where it used to need 1400 px/s, which rarely happened. The gust is light: crowns lean by at most 0.6 bend units (1.8 before), and each foliage card and blade shakes on its twig at a little over 2 Hz. Wood has no flutter, so trunks and limbs stay put: the leaves move, not the whole tree.
  • Falling leaves. New falling-leaves.ts, one instanced draw of up to 160 leaves (48 on phones), simulated on the CPU. Crown bands shed leaves under cursor gusts and strong ambient patches. The leaves swing or tumble down, ride the wind and passing gusts, then rest on the ground or float on the lake with a faint ripple, and fade. They grow a little with distance so far flurries still read. Reduced motion sheds none.
  • Night lantern on far trees. The ray stops on a crown's pick sphere, in front of most of its cards, so the 4.5 m pool lit almost none of them. Past 25 m the pool now widens and stretches along the view ray. Hops between crowns and the ridge behind also dim it less.
  • No more black squares in the lake. Additive glows (lamp haloes, fireflies, the shockwave ring) also added their alpha into the reflection target. The lake reads that alpha as scenery coverage, showing sky through 1 − alpha, so every reflected halo over the sky cut a black square the size of its quad. They now add light and leave the alpha alone (new glow-blending.ts).
  • Docs updated in vegetation.md, scene-details.md and atmosphere.md.

Validation

  • pnpm check (typecheck, lint, format, 533 unit tests, build, bundle size): passes. New tests cover the alpha-preserving glow blending, leaf shedding, landing, ripples and capacity, the gust field, and the pointer light's far reach and hop dimming.
  • Real-scene checks in GPU Chromium on the WebGL backend:
    • Night: the lantern lights the crowns under the cursor.
    • Sweep: with the camera parallax temporarily disabled, the tree silhouettes stay in place under a sweep while their foliage detail changes.
    • Lamps: the night scene renders without shader errors after the blending change. The available view puts the lamp's reflection over reflected trees, not sky, so the black square could not be reproduced there. The fix rests on the blending code: three's additive mode adds the source alpha.
    • Leaves: temporary instrumentation (removed) counted about 30 leaves falling during a gusty spell with no input. A sweep reached the 160 cap, and none were left about 36 s later.
  • Not run:
    • WebGPU rendering: the headless browser gets no usable WebGPU adapter here. The unmodified main branch fails the same way.
    • Phone performance.
    • An interactive session at full frame rate; the tuning comes from captured frames.
  • Self-review:
    • Fixed: a leaf jumped up to 0.6 m sideways when it landed, because its swing offset was dropped. It now settles where it is drawn.
    • Simplified: free-slot lookup now returns an index, so there is no indexOf call per spawn.
    • Accepted, low impact: leaf ripples (at most one every 0.35 s) share the water contact's 32-disturbance queue with splashes. A floating leaf can drift about a metre without re-checking for the bank.

🤖 Generated with Claude Code

The wood looked windless: crowns swayed a few centimetres, invisible at the
40-100 m where most trees stand. Vegetation now sways 2.4 times further with
a calm-day floor, and gust patches roll downwind through the wood in spells
with lulls between.

A pointer sweep raises a gust from 450 px/s (1400 before, rarely reached)
and pushes over three times harder, so the trees it crosses visibly thrash.

Gusts, the visitor's and the weather's, now tear leaves from the crowns: they
flutter down, drift with the wind, settle on the ground or float on the lake
with a faint ripple, and fade.

At night the cursor's lantern often missed far trees: the ray stops on a pick
sphere in front of most of a crown's cards. Past 25 m the pool now widens and
stretches along the view ray, and hops between crowns and the ridge behind
dim it less.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
dotme Ready Ready Preview Nov 8, 2026 12:41pm UTC

A pointer sweep now stirs the leaves rather than bending the whole tree:
crowns lean at most 0.6 bend units (6 before) while each foliage card and
blade rustles on its twig, by up to six times its own flutter. Wood has no
flutter, so trunks and limbs stay put.

Additive glows (lamp haloes, fireflies, the shockwave ring) also added their
alpha into the reflection target, and the lake reads that alpha as scenery
coverage, showing sky through 1 - alpha. Every reflected halo over the sky
cut a black square the size of its quad. They now add light and leave the
alpha untouched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@loeck loeck changed the title Blow real wind through the wood, shed leaves, light far crowns at night Blow wind through the wood, rustle and shed leaves, fix lamp reflections Nov 8, 2026
@loeck
loeck merged commit 205c076 into main Nov 8, 2026
3 checks passed

This branch was successfully deployed

1 active deployment
Preview — 01c5ef42 Deployed Nov 8, 2026 by vercel[bot]
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