Strange attractor renderer
A library and CLI to generate strange attractors.
By default, this renders the poisson saturne attractor. This should be easy to change through coefficients (when using this as a library), and possibly in the binary (if I add the feature). This can however only render a subset of attractors, those of the polynomial Sprott type (see this page from chaoscope). Adding more should be relatively easy.
All of these are optional.
- PNG & BMP export
- 16-bit
- transparency
- render depth texture
- CLI
- multithreaded
- brightness control
- shell completion
You need to have the latest version of stable Rust installed on your system.
Clone this repo. Run cargo install --path . --profile production
to install the binary to your user's path.
Documentation of the main branch can be found at doc.icelk.dev.
To document with information on which cargo features enables the code,
set the environment variable RUSTDOCFLAGS
to --cfg docsrs
(e.g. in Fish set -x RUSTDOCFLAGS "--cfg docsrs"
)
and then run cargo +nightly doc
.
This should be the fastest possible both in multithreaded and single-threaded mode. When running multithreaded, the main limiting factor is memory speed, not processing power (if you don't have a potato CPU, that is).
Using the sequence
subcommand, you can generate a series of images. Then use the following command to encode it into a H.264 video.
See it's --help
flag for available options.
$ ffmpeg -i attractor%02d.png -vcodec libx264 -crf 17 -pix_fmt yuv420p out.mp4
You need to change the %02d
part to the length of the frame index part of the outputted file name.
Many thanks to Björn von Sydow for the inspiration, initial code design, and continuing feedback.
Using the subcommand completion
, the binary automatically generates shell completions for your shell and tries to put them in the appropriate location.
When using Bash or Zsh, you should run the binary as root, as we need root privileges to write to their completion directories.
Alternatively, use the --print
option to yourself write the completion file.
These are generated using the following commands:
# Build binary
$ cargo build --release
# poisson-saturne.png
$ target/release/strange-attractor-renderer -i1000000000 -b -0.25
# solar-sail.png
$ target/release/strange-attractor-renderer -i1000000000 -h2000 -w1800 -b -0.1 -p solar-sail
# solar-sail-220deg.png:
$ target/release/strange-attractor-renderer -i1000000000 -h2000 -w1800 -p solar-sail -a 220
This library and binary artefacts are licensed under the GNU LGPLv3.