Creative Coding v4
Creative Coding v4
Coding
Edition 2020,
Class at LMU Munich
Creative Coding
Implementing an ∞-Exhibition
4 Virtual Brushes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.1 Programming a "virtual brush" 18
4.2 Implement: Finite Color 20
6
5 Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
5.1 Frieder Nake 21
5.2 Implement: Specify Angles 23
5.3 What else to implement? 23
5.4 Tasks - 3rd lecture 23
The oeuvre of many famous modern painters includes very abstract paintings reduced to simple
geometric forms, primary colours and clear pictorial structures. When you look at such paintings,
many of you will think that they are easy to copy. At first sight you can grasp the colour palette, the
organisation of the forms or simply the whole picture pattern. This allows us to visually separate a
Mondrian from a Malevich. But can our understanding of these images be easily formalized and
captured as an algorithm?
The program should create a new picture every 120 seconds or when the user presses a button on
the keyboard.
10 Chapter 2. Aesthetics and Information
Useful Commands
void keyPressed();
random();
randomSeed();
second();
minute();
hour();
2. Implementation: Create a display that shows the time. Take Mondrian algorithm and encode
the time in your visualization (a 15 minutes resolution is sufficient).
3. Collect feedback on your implementation. Record 3 videos from people seeing your
implementation (15 seconds each).
Programming a "Pixel Converter"
Convert to: Pointillism
Convert to other styles
Tasks - 2nd lecture
Figure 3.1: The shown examples demonstrate the translation of a color information to a interpreted output.
The program should take a predefined image from your file system or a snapshot over the integrated
webcam of your computer.
Useful Commands
PVector vec;
loadImage("testfile.jpg");
IntList list;
color c;
red(c);
green(c);
blue(c;)
3.1 Programming a "Pixel Converter" 15
PImage source;
int area = 25;
void setup () {
size(900,600);
source = loadImage("test.jpg");
noStroke();
for (int y=0; y<source.height; y+=area) {
for (int x=0; x<source.width; x+=area){
fill(getAverageColor(x,y,area,area,source));
rect(x,y,area,area);
}
}
}
color getAverageColor ( int x, int y, int w, int h, PImage img) {
float r = 0;
float g = 0;
float b = 0;
for (int i=0; i<w*h; i++) {
int index = x+(i%w)+y*img.width+(img.width*(i/w));
r += red(img.pixels[index]);
g += green(img.pixels[index]);
b += blue(img.pixels[index]);
}
return color(r/(w*h),g/(w*h),b/(w*h));
}
scene. Further, we try to go beyond these two styles an approach new ideas and concepts.
Breakout Session
During the following task we try to think of our algorithms as transfer functions. With an image
given we take the contained information (colors of pixels) and transfer it into: colored shapes, ASCII
characters, ...
In this model the image is the input, which is then analyzed on a subarea level. The contained
information is transformed by a small instruction set and thereby applied to the whole image.
• Search on the internet for pointillisitc images and for examples of ASCII art.
• Discuss the different concepts how colors, shapes and more are abstracted.
• Start to implement your analyzed concept based on the previously given example code.
• Where are the weak points of the algorithm? Can you spot its algorithmic nature? How can
theses problems be addressed and solved?
Discussion
What are the most interesting aspects of this approach? Let us discuss your impressions and thoughts
along the way. As a starting point think about the following questions:
• Can you call the product of these algorithms "art"?
• For now, we have reduced information (subareas), can we also extend to a higher richness of
detail?
• Could you imagine to use such a technique in your own work?
Homework
1. Reading: Read the following papers http://www.cse.cuhk.edu.hk/~ttwong/
papers/asciiart/asciiart.pdf to get an idea about the challanges and approaches
to ASCII art.
2. Implementation: Look into the following webpage http://paulbourke.net/
dataformats/asciiart/ and adopt these rules for ASCII art to our algorithm. Im-
plement a "Convert to: ASCII" sketch.
3. Think of the following: For the moment our ASCII sketch produces random character sequences
based on the color value of the source pixels. Can we use words instead of random sequences?
What do you have to do to take as an additional input something like Shakespeare’s collected
work and search in there for matching "color/character" sequences? Try an implementation.
Frieder Nake
Implement: Specify Angles
What else to implement?
Tasks - 3rd lecture
5. Lines
In this section we will look into the algorithmic art of Frieder Nake. Nake is famous for his first
explorations of the "Graphomat" (today we call such machines plotters). He decided to experiment
with this new type of machines in an artistic way during his task to write software for this new
hardware which was targeted at architects and engineers to speed up and ease the drawing process.
Instead of typical calibration tests he wrote algorithms that "created" artistic and randomly generated
drawings.
Figure 5.1: Rule sets can specify angles minimum and maximum distances, ... .
We will try to implement an algorithm that generates similar aesthetics. Further, it would be
interesting to "watch" the algorithm draw. How can we follow along with the "plotter" during the
"creation" process?
22 Chapter 5. Lines
Useful Commands
PVector vec;
PVector.random2D();
PVector.add(vec1,vec2);
PVector.sub(vec1,vec2);
PVector.mult(vec1,f);
random();
constrain();
Figure 5.2: Nake’s work is manifold and nevertheless beautiful in its simplicity.
6.1 Nature
In this section we will look into common structures known from nature called "Fractals". Fractals
are structures that reoccur in them self. Common examples would be: mountains, snow flakes,
trees. All these structures show the same features from a distant point of view as well as under
close examination. A tree is just a single branch from which other branches emanate, from which
smaller branches emanate from which ... In nature these structures come to an logical end. The
last branch emanates into leaves which mark the end of the structure, but on a mathematical level
these structures can go into infinity. The most prominent example for mathematical fractals is the
Mandelbrot Fractal.
Figure 6.1: Even every day objects as broccoli reveal fractal qualities.
We will try to implement a fractal in a generic manner and from there explore the impact of
different rule sets, randomness or geometrical elements (lines, circles, ...) on the visual outcome.
Useful Commands
translate();
6.1 Nature 25
rotate();
push();
pop();