Eric Yancey Dauenhauer
Musings from my desk

Musings from my desk

If you can code, then make art. Else, return false

If you can code, then make art. Else, return false

Eric Yancey Dauenhauer's photo
Eric Yancey Dauenhauer

Published on Jan 23, 2021

12 min read

Generative art is an amazing way for programmers to play with code, explore new concepts, and add beauty to the world.

It is my humble opinion that all software engineers, developers, hackers, programmers, etc should try making generative art at least once.

Let me take a moment to convince you 😁

Void by Studio ANF

Credit: Studio ANF

What is generative art?

I think the definition provided by the /r/generative subreddit is clear and concise:

Generative art refers to art that in whole or in part has been created with the use of an autonomous system [1]

- Reddit sidebar

Generative art (or even more broadly, "creative coding") is a huge community of people who turn code into creative expressions. Some prolific artists choose to not even identify as artists, due to lack of classical training in art. I am less strict and feel that anyone can create art, so I prefer to broadly consider computer-generative visuals or audio to be "generative art".

Aligned Movement by Tyler Hobbes

Credit: Tyler Hobbs

Why would I want to do that?

I get it - you already sit at a computer all day doing things you get paid for; why would you want to spend more time coding when the only output is some cool colors and shapes?

"When people throw themselves into an activity for the sake of the activity itself ... they tend to report long-term well-being and fulfillment."

The Key To A Good Life? Lose Yourself In Something

In addition to the intangible benefits of finding a hobby that you love and plays to your strengths, let me provide you with five concrete reasons:

Substrate by J. Tarbell

Credit: J. Tarbell

1. You get to play with code

When is the last time you played with your code? Sure, we all have times where we work on a project that is interesting or challenging, but how often have you truly played with code? For many engineers - even seasoned veterans - the answer may be never! Generative art gives you a chance to play with code. I am willing to bet that it will feel less like the coding you get paid for, and more like a game.

Remember the spark you felt when you first started to learn programming? How every little problem was exciting and fun because it was new and interesting? You have a chance to revisit that world, and refresh your excitement about code!

Nuit Blanche by Kenny Vaden

Credit: Kenny Vaden

2. You get to explore new algorithms and data structures

I put this near the top of the list because I have a feeling that for many people, having a tangible payoff with be enticing. Let me be clear: learning new algorithms is not my primary motivation for creating art, but I do appreciate it.

Let's be real: how often does the average web developer need to know anything about a linked list. How about pathfinding algorithms? What about a graph? (Talking about the data structure, not an HTML chart, or GraphQL.)

While these concepts are firmly embedded in many developers' minds from either university classes, interview questions, or online articles, it's extremely rare to use these in daily practice for many of us. Yes, I know I'm only talking to a subset of the engineering world - there are plenty of engineers who I'm sure use these concepts every day. But as someone who was worked in the world of web and dabbled in multiple backend languages and frameworks, multiple front-end frameworks, native Android and iOS, and test engineering, I can tell you that for many of us the answer to these questions is "never".

Algorithms and data structures get a bad rap because they are often taught in contrived ways - the demonstrations are often used to build things that already exist in most languages' standard libraries (looking at you, the-entire-family-of-sort-algorithms 🙄). But, when algorithms or data structures are applied to problems that end up producing something fun and beautiful, they suddenly take on a new purpose and interest. Once you get familiar with a new data structure or algorithm from your creative coding, you may just find a practical use for it in a problem you're getting paid to solve! Worst case scenario: it will boost your confidence for that next interview 😎

Here are a few examples of data structures and algorithms I've never needed to learn about until I started making generative art:

  1. k-d tree. Check out the awesome article on shepherding random growth from the fabulous inconvergent.net for a practical example of how to make use of k-d trees to speed up your differential growth algorithm!
  2. linked list. This one should be familiar to most developers, but how often has a linked list actually been required for your project, over an Array or ArrayList or Vector provided by the standard library? For a cool example of how to use a linked list for an efficient fractalization pattern, check out this algorithm from Rectangle World which is one of my all-time-favorite algorithms for generating "imperfect" lines.
  3. contouring a 3D surface. I've always been a map nerd, and no small part of that is due to contours. I absolutely love the way contours can look, and it turns out contours can make awesome designs when combined with generated 3D surfaces. If you do a quick search for contouring, you'll likely find references to an extremely long and complicated algorithm called "marching squares". But if you dig deeper you'll uncover meandering triangles, introduced to the world by Bruce Hill (afaik). It's no small feat to implement this algorithm (I did it in Rust - not recommended), but the result is blazing fast and allows you to explore contouring complex surfaces very, very quickly! It is most satisfying to see the results drawn to screen.
  4. pathfinding. Pathfinding algorithms have all sorts of uses, and this is one example that many developers have likely come across in real-world cases. They have lots of applications for graph data structures. I found myself first trying to implement a pathfinding algorithm after I followed deconbatch's tutorial on the so-call "Poor man's Diffusion Limited Aggregation" (a name I always found hilarious because it's an ingenious algorithm!). After I implemented that I wanted to connect the points so I created a graph structure and then connected the points into lines using a custom recursive, depth-first pathfinding algorithm. I don't pretend that my version is great but it works and it was a lot of fun to figure out to how make the Rust compiler sign off on this implementation 😂. I'll note that my implementation stops short of most pathfinding use-cases because I don't need to find the shortest path. But my brute-force algorithm stops just one step short of that final destination if that is the solution you require. Here's my final product for completeness

A clever reader will observe that these complex data structures are not required to make cool art. Even in these examples, there are other ways to achieve the same result! But it's a fun perk to pick up some new skills and find a practical application for some lesser-used data structures and algorithms.

Hive by Sage Jenson

Credit: Sage Jenson

3. You get to do what you love, but with lower stakes

Many of us got into software engineering because we love it. But lemme guess: the man's gotcha down. Mmhmm, it happens to the best of us.

Well if you're jonesin' for a way to reignite the spark in your coding endeavors, look no further! Creative coding is as low-stakes as it gets, which means you can fuck up your art or even crash you computer with absolutely no consequences. A prevalent philsophy in the generative art community is that mistakes are beautiful. Most generative artists I follow and respect have at least one piece they've posted that they deem a "mistake", but ended up being more happy with than their original intention! In a world with constantly changing requirements and where mistakes cost money and overtime, being able to mess around with code in a zero-stakes setting is really refreshing. Lastly, the result of your work is entirely your own! You can post it online or squander it on your hard drive for all eternity - the choice is yours!

Generative art and creative coding gives us the opportunity to use our skills for a purpose that is completely non-commercial [2], and re-unite with the parts of our work that made us passionate about it when we began.

Road to Nowhere by MacTuitui

Credit: MacTuitui

4. You have a much higher probability of finishing a piece of art than a side project

Every. Single. Developer.

^ That's how many people have started at least one side project that they failed to complete.

There are a plethora of reasons: time, resources, complexity, scope creep. But generative art is quick and easy! Once you get some basics under your belt, you can easily create sketches in an hour or two, or even less!

Don't believe me? Head over to the Generating SVGs collection on Observable by the amazing makio135. Find a thumbnail you like, and click it. Then edit any part of the code and see the image change in real time. There! You made generative art! Maybe you didn't write the whole thing from scratch, but we all know that's not how software is written anyway. By participating in the generation of the image, you have now gotten your hands dirty with creative coding.

Now do it again. And again. And when you run out of ideas, find another sketch to fork, and repeat.

Digital Environment by CLAUDE

Credit: CLAUDE

5. You can bring something beautiful or interesting into the world

Building software is extremely gratifying to me. But I think many of us have felt, at one time or another, that the fruits of our labor might be slightly pointless in the scheme of things. We've all have those projects that are uninspiring and generally feel like busywork. Maybe you're even making an app that generates busywork for others! (looking at you, Jira-developers 😉)

Wherever you find yourself in life, it's worth asking how you want to spend your free time. You only have so much free time outside of work - do you want to spend all your time merely consuming media created by others? Wouldn't it feel nice to bring something fun and unusual into the world?

With generative art, the fruits of your labor will be beautiful, or at least interesting. Can you say the same for your day job? I have no delusions about saving the world with generative art, but I firmly believe that if we pursue endeavors that bring beauty and insight and creativity into the world, we will find more joy in life. 🌻

Unit by Alex Guevara

Credit: Alex Guevara

Final thoughts

Generative art will:

  1. Make you happier [3]
  2. Make you richer [3]
  3. Boost your sex drive [3]
  4. Make you live forever [3]

Do it.

Do it now.

Red by Palmdrone

Credit: Palmdrone

Notes

  • [1]: If you're like me and thought "wtf is an autonomous system" and immediately googled it, you probably got a lot of results about IPs and the internet. Turns out, there are lots of types of autonomous systems and apparently randomness is one type of autonomous system. Who knew. So yeah, most generative art isn't made with IP addresses specifically, but randomness is extremely common in generative art.
  • [2]: Sure, some people make money on generative art, but for most of us it's just a hobby.
  • [3]: These statements have not been evaluated by the Food and Drug Administration. This product is not intended to diagnose, treat, cure or prevent any disease.

Resources

There are so many good generative art resources on the web. I can't begin to do justice, but here are a few from which I've gleaned inspiration and knowledge:

Tutorials and learning

  1. Tyler Hobbs' essays - If you're just starting out, I can't recommend his flow fields essay highly enough
  2. Nature of Code - A classic! Perhaps not the most interest place to start your journey, but some truly invaluable concepts explained in great detail and with code examples!
  3. Sighack - A nice set of essays and resources
  4. Generative Artistry - Not a huge quantity, but great beginner tutorials!
  5. Rectangle World - referenced in the article, and lots more good stuff on the blog!
  6. Book of Shaders - If you are getting into shaders, start here. Seriously. Just read this first.
  7. Inigo Quilez - If you are getting deeper into computer graphics, Inigo's articles are priceless and full of rich information. Particularly recommended for exploring shaders!
  8. Complexification - I was torn of whether to include this in the "Just Beautiful" category or here, but since all the pieces include full code I figured it might be considered a learning resource. That said, some of the pieces here are simply fantastic, worth a look just for the visuals alone.
  9. Karl Sims fluid flow - This is pretty advanced but really cool explanation of fluid simulations! Definitely check out the corresponding flow page for some great examples of application
  10. Frederik Vanhoutte (alias: wblut) - Frederik is author of an amazing 3D rendering library called HE_Mesh, of which you can find copious example on their super-cool instagram page
  11. Morphogenesis resources - this is actually a meta-collection of resources, but it has some great links, descriptions of various topics/disciplines, and some cool animations!
  12. Awesome creative coding - It's kind of meta to link to an awesome list, but hey, tis the internet
  13. Inconvergent - This could easily be included in the "Just Beautiful" category but there are enough writings on here that this felt better
  14. CodePlastic - Lots of cool articles!
  15. Generative Hut - some great beginning tutorials and just an overall cool site!

Just beautiful

  1. Studio ANF - I have no words for the beauty contained within
  2. Tyler Hobbs - One of the main reasons I got into generative art is from being inspired by Tyler's work
  3. http://yiwenl.github.io/Sketches/ - Really amazing gallery of interesting interactive pieces
  4. Generating SVGs - referenced in article, but it deserves another mention. I credit this collection with spurring me to try generative art in the first place, since Observable makes it so easy to fork and edit the code live
  5. Sage Jensen - Chef-kiss!
  6. Robert Hodgin - Meander - while this could be considered a tutorial, I find this to be such an amazingly stunning example of emulating nature with generative art that I had to include it here. Robert's site is absolutely worth a gander

Social

  1. /r/generative - Subreddit for Generative Art
  2. instagram #generativeart - Generative Art on Instagram
  3. discord - Discord dedicated to Generative Art
  4. Plotter Twitter - amazing community of people bring generative art into the physical world with plotters!

Misc

  1. Why Love Generative Art (article)
  2. Casey Reas - One of the founders of Processing, lots of interesting examples and articles

Please comment with any questions or thoughts!

 
Share this