rusty_art icon indicating copy to clipboard operation
rusty_art copied to clipboard

Creative coding and visual illusions in Rust.

Rusty_Art 🌈 🎨

Rust

banner

Creative coding with Rust! 🦀

In this repository, I will create animations and optical illusions that allow for the generation of various patterns in my spare time. So, this repo is consistently updated and current 😄

Most of my files feature a graphical user interface (GUI), enabling real-time adjustments to the animations and opening up the possibility to create thousands of unique patterns.

I hope you enjoy it!

🚀 Usage/Installation:

This section is intended for those who are new to GitHub or Rust and may not be familiar with these tools.

1- Install Rust Programming Language

2- Click on the green "Code" button at the top right of this page. Then, select "Download ZIP" from the dropdown menu. After the ZIP file finishes downloading, extract it to a folder on your computer.

3- Open the terminal (also known as command prompt or cmd) on your computer. You can simply open it in the folder "rusty_art" by right-clicking on the folder and selecting "Open in Terminal".

To run the files, in the root directory of the project, type the commands in the following style (Shader names are the same as rust backend; no need to use extensions)

```bash
    cargo run --release --bin <filename>
```

That's it! If you encounter any issues while opening/running files, feel free to contact me. 😊

Saving Frames 📸

To create high-resolution videos, you can save each frame as a PNG image by holding down the spacebar while the animations are running. This will save each frame in a folder called "frames" which will be created automatically in your current directory (Yes for all files, some of them also work with zoom with mouse wheels, but not all). Once you've saved all the frames you want, you can create a video file by copying the images to a folder and running the following command in that folder:

```bash
    ffmpeg -r 60 -f image2 -start_number 10000 -i %d.png -vf "scale=-2:990,format=yuv420p" -vcodec libx264 -crf 10 output.mp4
```

This command will use the images in the "frames" folder to create a video file named "output.mp4" in the same folder. The video will be encoded with the libx264 codec at a constant rate factor of 10 and with a pixel format of yuv420p. The frame rate will be set to 60 frames per second (-r 60).

Note: You need to install ffmpeg to create videos.

Warning ⚠️

I only tested these codes on my notebook with the following specs:

CPU: Ryzen 7 6800h Ram: DDR5 16GB GPU: Nvidia RTX 3060 mobile

And I must say that some of the files are very computationally intensive. So, if you have a relatively "low-end" computer, you may not be able to run some of the scripts smoothly. I'm sorry about that. 😔 And please don't run the files on your computer if you don't have a good cooling system. I don't want to be responsible for any damage to your computer. 😅

Always open if you have any suggestions or "cheap" tricks (in terms of reducing computational complexity) to improve the performance of the scripts. 😊

Animations that are computationally intensive (in my opinion):

  • peace2 and peace3
  • mandelbrot (both CPU and GPU versions)
  • pixelrain
  • attractors
  • gabor (CPU version)

🖼️ Some Examples:

Click on the images to open the videos 😊

Attractors Expensive Mandelbrot Ernst Chladni's Plate Experiments
Attractors Code mandelbrot Code Erns Chladni's Plate Experiments Code
Draw something with Fourier Cycloid Fake Fluid Dynamics Hilbert Curve Image
Draw something with Fourier Cycloid Code Fake Fluid Dynamics Code Hilbert Curve Image Code
Mandelbrot Set Munker Illusion Neuron Simulation
Mandelbrot Set Code Munker Illusion Clock Code Neuron Simulation Code
Snowflake Voronoi Image Galaxy
Snowflake Code Voronoi Image Code Galaxy Code
Reverse Phi Motion Gabor Patch Asahi illusion
Reverse Phi Code Gabor Patch Code Asahi illusion Code
Love WGPU Lorenz System Neural Net
Love WGPU Code Lorenz Code Neural Net Code
Pinna illusion oscillation lensing
Pinna Code oscillation Code imlens Code
fourier sinh tree
fourier Code sinh Code tree Code
Cafewall Illusion lilac chaser illusion Peace2
Cafewall Illusion Code lilac Code tree Code
imgblob Leviant's Optical Illusion ULAM Spiral
imblob Code Leviant Code ULAM Code
alien brain Kinetic Pupils blobs
darkclouds Code Pupils Code blobs Code