Procedurally Generated Art

 

I've recently started making a lot of procedural generated graphical art in Rust. Rust is a multi-paradigm, general-purpose programming language that is compiled and not interpreted like Python. Rust emphasizes performance, type safety, and concurrency. Developed by Mozilla with a start in 2006, Rust has developed into a wonderful programming language, really taking off in the past few years especially as it finds many applications in several Web3 and blockchain codebases. Rust has a wonderful error checking mechanism in its compiler which saves a lot of time in debugging (just don't talk to me about strings in Rust). Rust code can be made to run really fast, much faster than Python in a lot of cases.

 There were a few reasons why I started doing this, the first primarily being to get better at Rust and I wanted a cool hobby project to work on. Another reason is Rust has some fucking cool graphics libraries for generating cool looking images. Visualizing data can be a useful skill to acquire, and I've used Rust to generate some cool graphical representations for particle tracks given different parameters for electromagnetic and other vector fields. 



As you can see the results are pretty neat looking. Using chaotic noise fields and then coloring the particle tracks, unique visual artifacts can be constructed. There are many different graphics libraries that are available in Rust, but the main one I've been using has been nannou. Nannou is an agglomeration of many different up to date graphics libraries that has a very useful codebase for making all sorts of interesting graphical projects. You could probably code a pretty simple video game using nannou, it might end up being a later project I endeavor upon. One problem I do have with nannou though is that it takes awhile to compile the library, which isn't good if your just trying to mess around with a new project.

 


here's a github link to some of the code for generating particle tracks. 

Github Link 

I haven't uploaded all my code to github as its mostly just a hobby project that I just mess around with. The main trick is learning the nannou commands, the rest is just math and then translating that into code. I still work with some of this stuff, it's pretty neat to just see your code make something in real time rather than just adding to some abstract idea you might never see the fruits of.

I really like Rust as a programming language so far. It takes a little getting used to, but once you get the hang of it its absolutely wonderful to code in it. Also, its fast.



My background is mostly in physics and right now my current project is modelling complex EM fields using nannou, the results should be pretty cool once its working. So far the problem I've been running into is actually speeding up and making it more efficient, since right now I have to run my laptop all night in order to even get it running.

In the meantime, its nice to just mess around with creating messy images of chaos.





Comments

Popular Posts