Generative Art, Programs and Algorithms

Life Tips & Miscellaneous Travel and History Zen Philosophy and History Art and Sport  Clojure Java Navigation of this blog

Generative Art, Programs and Algorithms

At Clojure/Conj2018, one of the Clojure conferences, I saw Tyler Hobbs give a talk on generative art called “CODE GOES IN, ART COMES OUT“.

According to wiki, generative art is

Generative art is a work of art that is algorithmically generated, synthesized, or constructed by computer software algorithms or mathematical/mechanical/random autonomous processes. By taking advantage of the computational freedom and computational speed of computers, and by implementing theories derived from natural science, many works of art are made to express themselves in a unified, organic manner, somewhere between artificial and natural.

Generative art is an art form that uses natural scientific systems as its main creative method. The difference between generative art and other art forms is that generative art requires the design and creation of mechanisms that operate autonomously. Works by systems may implement scientific theories such as complex systems and information theory.

The threshold for entry is high, as the creator is required to have highly mathematical imagery and the skills to devise and implement complex algorithms. However, this is also a field that attracts people who are skilled in mathematical formulas and algorithms and who have been exposed to works in this field.

However, until the advent of Processing in the 2000s, programming environments were not developed that allowed people to focus solely on the essence of the content of their creations, and as a result, it is still not a common method of creation. However, with the 2010s’ flourishing of media art in various advertising media (websites, digital signage, etc.) and events, coupled with the spread of Processing and openFrameworks in art school education, it is a field that is expected to develop in the future.

The article goes on to say, “The field is expected to develop in the future.

TeamLab’s computer art is well-known in Japan, but while TeamLab’s work is simply using computers to express art and makes extensive use of algorithms, it is not oriented toward “artworks that are algorithmically generated, synthesized, and constructed through mathematical, mechanical, and random autonomous processes. It is not intended to be “a work of art that is algorithmically generated, synthesized, and constructed through mathematical/mechanical/random autonomous processes.

Generative art, on the other hand, is a bit more inorganic, as described, for example, in “Generative Art: Once You See It, You’ll Be Addicted to It.

This can be said to express the beauty of naturally occurring or artificially created “systems,” or it can be said to express the beauty of algorithms and programs, as described in “The Common Beauty of Art and Programming” in the past. The beauty of the mathematical algorithms for optimization described in “Continuous Optimization for Machine Learning” and the geometric approach to machine learning described in “A Geometric Approach to Data” in this blog can also be appreciated by using appropriate expressions.

As such, Tyler Hobbs in his lecture also stated, “Generative art is a relatively new medium, and it’s significantly different from some of the traditional art forms that preceded it, so there is no need to be afraid to use a new medium. preceded it, so there are a lot of new questions that I think are really interesting about it, and they’re particularly pertinent to us as programmers. Generative art is a relatively new medium, very different from some of the traditional art forms that preceded it, so there are a lot of new questions that I think are really interesting about it, and they’re particularly pertinent to us as programmers.”) He stated.

In generative art, everything that a program outputs is a product, so it is not just the output of a simple image, but also the output of a machine (such as a robot) that is controlled by a program. For example, ken rilando has presented generative art using robots called Autopoiesis.

Generative art (henceforth abbreviated as GArt) has existed since the birth of computers, historically beginning in the 1960s. Early GArt was limited in what it could do due to small computer power. Most GArts also had a “curation” step, in which artists generated as many outputs as they liked, narrowed them down to their favorite sets, and only the curated outputs were made available to the public. This can be seen in the steps of creating AI haiku as described in “AI Researchers and Haiku Poets: Why Do People Create Haiku?

In contrast, with the development of ICT technologies such as blockchain technology used in ArtBlocks, etc., artists create generative scripts, which are placed on a blockchain such as Ethereum, and the artist specifies the number of iterations to be minted by the script. When the collector mints an iteration (i.e., purchases), the script is executed to generate a new output, which is then wrapped in an NFT and transferred directly to the collector, creating a new form.

This platform is now requiring artists to create sophisticated algorithms that always produce “quality” output, rather than the traditional algorithm that generates 100 and only needs to get 5, he said.

Tyler Hobbs stated in his talk that GArt uses Clojure’s Quill as its tool, as described in “Implementation with Clojure’s graphical tools seesaw and Quill“. This tool is a wrapper for Processing, which is the standard tool for GArt.

To use Processing, download the appropriate source for your OS from the official download page.

Click on the downloaded file to use it.

First, from the official Hello World page, enter the following code and click the arrow in the upper left corner.

line(15, 25, 70, 90);

Java will then start and the following graphic will be displayed.

In addition, if you enter the following code

void setup() {
  size(400, 400);
  stroke(255);
  background(192, 64, 0);
}

void draw() {
  line(150, 25, mouseX, mouseY);
}

The following dynamic drawing can be done using the mouse.

As you can see in the code example above, the code is to be written in Java. To input this code in python, it is necessary to enter the python mode. To do so, go to the library import screen by selecting “Sketch” from the top menu, then “Import Library”, then “Manage Library”, select “Python mode for processing 4”, and press “install” to install python mode. (Immediately after installation, you can install the python mode. (If you cannot see the library in python mode immediately after installation, install “PixeFlow” first.)

The above Hello World, written in pyhton code, would look like this

;;Code for drawing lines
line(15, 25, 70, 90)

;;Code for controlling the mouse
def setup():
    size(400, 400)
    stroke(255)
    background(192, 64, 0)

def draw():
    line(150, 25, mouseX, mouseY)

We can see that the code is simpler in pyhton.

Finally, we describe the behavior of the code in clojurescript, the Javascript version of quil.

First, create a quil template in clojurescript with “lein new quil-cljs hello – quil”.

The created code is as follows.

(ns hello-quil.core
  (:require [quil.core :as q :include-macros true]
            [quil.middleware :as m]))

(defn setup []
  ; Set frame rate to 30 frames per second.
  (q/frame-rate 30)
  ; Set color mode to HSB (HSV) instead of default RGB.
  (q/color-mode :hsb)
  ; setup function returns initial state. It contains
  ; circle color and position.
  {:color 0
   :angle 0})

(defn update-state [state]
  ; Update sketch state by changing circle color and position.
  {:color (mod (+ (:color state) 0.7) 255)
   :angle (+ (:angle state) 0.1)})

(defn draw-state [state]
  ; Clear the sketch by filling it with light-grey color.
  (q/background 240)
  ; Set circle color.
  (q/fill (:color state) 255 255)
  ; Calculate x and y coordinates of the circle.
  (let [angle (:angle state)
        x (* 150 (q/cos angle))
        y (* 150 (q/sin angle))]
    ; Move origin point to the center of the sketch.
    (q/with-translation [(/ (q/width) 2)
                         (/ (q/height) 2)]
      ; Draw the circle.
      (q/ellipse x y 100 100))))

; this function is called in index.html
(defn ^:export run-sketch []
  (q/defsketch hello-quil
    :host "hello-quil"
    :size [500 500]
    ; setup function called only once, during sketch initialization.
    :setup setup
    ; update-state is called on each iteration before draw-state.
    :update update-state
    :draw draw-state
    ; This sketch uses functional-mode middleware.
    ; Check quil wiki for more info about middlewares and particularly
    ; fun-mode.
    :middleware [m/fun-mode]))

; uncomment this line to reset the sketch:
; (run-sketch)

Next, compile this source file to javascript with “lein compile” and open the /resource/public/index.html file in any browser to see the following sample image.

For more information on clojurescript, see “Integrating Clojure with Javascript, node.js, and web frameworks,” etc.

コメント

タイトルとURLをコピーしました