From 7ed1f95566fd30cb0fe7dab1311725c493b9f4ed Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Sun, 3 May 2026 15:14:54 +0100 Subject: [PATCH] Add README with project overview and embedded animation Co-Authored-By: Claude Opus 4.7 (1M context) --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..d1ee8dc --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +# Ember + +A particle simulation that renders drifting embers carried by a Perlin-noise wind field, recorded to an MP4. + + + +If your viewer doesn't render the embed inline, open [`animation.mp4`](animation.mp4) directly (variants: [`animation-day.mp4`](animation-day.mp4), [`animation-night.mp4`](animation-night.mp4)). + +## How it works + +- `ember.py` — each `Ember` spawns at the bottom edge with a randomized size, color offset, lifespan, and updraft, then fades out as its time-to-live expires or it nears a screen border. Drawn as a soft anti-aliased circle blended into the previous frame's trail. +- `wind.py` — `WindField` samples 3D Perlin noise (x, y, time) on a downscaled grid for each axis, with bilinear interpolation back up to pixel coordinates. +- `main.py` — drives the loop: fades the previous frame slightly each tick (the trail effect), advances the wind field, updates and draws every ember, and writes each frame to an MP4 via `imageio`. + +## Run it + +```sh +pip install pygame numpy imageio imageio-ffmpeg noise tqdm +python main.py +``` + +Tweak `EMBER_COUNT`, `WIND_STRENTH`, `RUNNING_TIME_IN_SECONDS`, or `FRAME_RATE` at the top of `main.py`. Set `IS_DEVELOPMENT = True` to watch the simulation in a window instead of writing to disk. Resolution lives in `config.py`.