Post

The idea is that you have function F: [-1..1]² → [-1..1]³ which giving a xy coordinates between -1 and 1 gives you an RGB value. So you generate an image by sampling the function with whatever resolution you need. For example F(x, y) = (x, x, x) gives you horizontal gray gradient.

What we do is we generate a random F. We do that by literally generating random syntactical tree of mathematical expressions based on a context-free grammar. So you evaluate F by literally interpreting the syntactical tree like an interpreted scripting language.

So essentially, the whole RandomArt idea is to generate Random Images by generating Random Programs that generate those images in a Small Custom Interpreted Mini-Language. It's actually a really cool Recreational Programming exercise due to it being so interdisciplinary. Really recommend. 👍

If you introduce a third variable t which just oscillates over time, add it to the generation process along with x and y, then compile the AST down to a GLSL shader you can generate cool videos like these.

1 repost49 likes

No replies yet.