You are on page 1of 16

1

Painting Algorithm Using Cell Developmental Mechanism



Sezin Hwang
Associate Professor
Faculty of Mobile Contents, Daegu Haany University, Daegu, Korea

Moon R. Jung
1

Professor
Graduate School of Creative Media, Sogang University, Seoul, Korea

Abstract
In this paper, we present a painting algorithm that generates paintings by a mechanism
analogous to cell developmental mechanism. In our system, basic shapes with position, size,
and color play the role of cells. Starting from a single cell, children cells are generated from
the parent cell, and the generated cells are arranged with one another by means of simple rules.
The rules determine the attributes of children cells, e.g. their color, size, and displacement from
the parent cell. When the development is finished, the cells are drawn in various figures, such
as circles, lines, and circular arcs. By adding randomness to the attributes of children cells, the
algorithm produces paintings that have unpredicted moods with various shapes and colors.
Also, unlike traditional painting that mixes color pigments, this painting method creates
unpredictable colors by mixing colors directly. The color addition effect is significant
especially when thousands of shape elements are overlapped.

1. Introduction

This research aims to look at painting from a new perspective, that is, by
means of computational capability of computer. In computer arts, computers
are often used as software editing tools for creating shapes or images. The
authors, however, believe that employing computer programming directly
without using an editing or modeling tool is a worthwhile approach to creative
computer arts. In particular, we want to employ cell developmental mechanism
for the purpose of shape generation. All living things in the world are generated
by means of cell developmental mechanism. So, it would be interesting to see
what happens when we apply this mechanism to painting.

In this algorithm a basic shape element acts as a cell. And the first shape is
divided as in cell division, creating numerous shape elements that have various
sizes, colors, and positions, and a painting is created by combining them. Each
cell is divided when it is grown to become as twice as the original size. When a
cell is divided from the parent cell, its position, size, and color is determined in

1
Corresponding Author. This work has been supported by the
Sogang University Research Grant of 2011.



2
its relationship with the parent cell. When numerous cells are overlaid upon
one another, the colors are mixed and create unpredictable colors. When a cell
is drawn in this algorithm, it is drawn in various basic figures such as circles,
lines, and circular arcs.

2. Background

The first case of using computer for artwork was arguably paintings
produced by computer algorithms. From the mid-1960s, scientists and artists
tried such projects, and some of them called themselves algorists
1
.

2.1 Harold Cohen
Cohen is an artist who used to be recognized as top 5 British artists in the
late 1960s, but suddenly stopped painting and started developing an artificial
intelligence-based automatic painting system called Aaron. Cohen, by creating
an Expert System
2
, made a freehand line drawing program. The rules of Aaron
were inspired by childrens doodling styles. Aaron starts to draw a figure from
an arbitrary point on the canvas and stops when an adequate number of figures
are drawn.
3
<Figure 1> is an example of such drawing. Different drawings are
created each time due to random aspect of the painting system.
4

Aaron materialized the traditional genre of line drawing with artificial
intelligence and was expanded to draw concrete forms.

2.2 Growth Model of Kawaguchi Yoichiro (Growth Model)
Kawaguchi, by using a method called growth model, has visualized
developmental process of life forms
5
. Growth model algorithm starts from the
initial form and grows and regenerates it, by repeatedly applying simple rules.
This growth algorithm uses a genetic algorithm. The result of the growth
algorithm is represented in constantly moving animation and <Figure 2> is a
snapshot. Growth model continuously creates an abstract life form starting

1
http://www.algorists.org/algorist.html
2
An expert system is a program that expresses knowledge of an expert by using a number of
If...then... else rules to solve a given problem.
3
Harold Cohen (1988), "How to Draw Three People in a Botanical Garden," Technical Report,
University of California, San Diego.
4
Pamela McCorduck, AARON'S CODE: Meta_Art, Artificial Intelligence, and the Work of
Harold Cohen ( W.H Freeman and Company, New York, 1992)
5
http://design.osu.edu/carlson/history/tree/kawaguchi.html



3
from the initial form. The present study aims to create pure abstract painting
using only forms and colors in the framework of traditional painting.

2.3 Automatic Geometric Abstract Painting by A. Michael Noll
In 1965, Noll had the first computer art exhibition in the US with Bela
ulesz at Howard Wise Gallery
1
. Noll was highly interested in the
unpredictability of drawings created by computer and recreated artworks of
existing painters. <Figure 3> is <Composition with Lines> by Mondrian, who
is well known for geometric abstract painting. <Figure 4> is a drawing
produced by using random numbers of computer. One hundred participants
received a paper in which <Figure 3> and <Figure 4> were printed on one
paper and asked to distinguish the one generated by computer. 59 out of 100
participants judged <Figure 4>, which was generated by computer, to be
Mondrians actual painting, and only 28 chose <Figure 3>, the artwork by
Mondrian.
2
Noll argued many people who participated in the test linked
randomness to human creativity and confused it with Mondrians painting
3
.
Nolls algorithm painting does not allow intervention by an artist and many of
his works (Figure 5, 6) use simple black and white geometric forms and lines.
For interesting composition, the present method allows direct involvement of
an artist and various combinations of geometric forms and colors.
The differences between several existing studies and the present research
are shown in <Table 1>.


3. The Decision Rules of Cell Attributes

3.1. Composition Rule
In this work, a simple cell developmental mechanism is used to generate
painting. In general, rules that compose a painting include so many
elements
4
. However, in this work we want to use simple rules to see what they

1
Frank Dietrich (1986). The First Decade of Computer Art (1965-1975), Vol.19, No.2, 159.
2
A. Michael Noll (1996), Human or Machine: A subjective comparison of Piet Mondrians
Composition with Lines(1917) and A computer-generated picture, The Psychological Record,
pp1-10.
3
A. Michael Noll (1967), The digital Computer as a creative medium, IEEE Spectrum, Vol.4, No.10,
pp89-95.
4
David A. Lauer & Stephen Pentak (2005), Design Basics, Sixth Thomson Wadsworth : According to
Design Basics, which is widely used as a textbook for basic design education in universities in South
Korea and elsewhere, elements to compose a design include unity, balance, emphasis, focal point,
scale, proportion, rhythm, line, shape, volume, texture, and illusion of space, illusion of movement,
brightness, and color.



4
produce when they are repeatedly applied. We introduce three simple rules for
determining the attributes of children cells derived from parent cells.

In the process of devising composition rules, Kandinskys painting of <Figure
7> has been examined carefully. A child cell is defined by three attributes, as
shown in <Figure 8>: (1) the size of the cell, (2) the color of the cell, and (3)
the displacement from the parent. The rules are designed so that the size of a
child cell is determined in inverse proportion to the size and color brightness of
the parent cell, and the color brightness of the child cell is determined in
inverse proportion to the color brightness of the parent cell, and the
displacement from the parent is determined in proportion to the difference
between the color of child cell and the color of the parent cell. These are simple
and intuitive rules designed so that shape elements forming a painting should
be balanced in their attributes, such as size, color, and displacement, rather than
being one-sided in these attributes.

3.2. The Rules Determining the Attributes of Children Cells

3.2.1. The Decision Rule of the Child Cell Size

The child cell size is determined to be in inverse proportion to the size of
the parent cell for the following reason. If the parent cell is big, the feel of its
presence in the painting is strong. It is reasonable for the child cell to have a
weak presence and so be small. If the parent cell is small and has a weak
presence, the child cell is made big so that the cells as a whole have some
balance in size. The child cell size is determined in inverse proportion to the
brightness of the parent cell as well for the following reason. If the parent cell
is dark, it has a weak presence. It is reasonable for the child cell to have a
strong presence and so be big.

3.2.2. The Decision Rule of the Child Cell Color

The brightness of the child cell is determined in inverse proportion to
parent cell brightness for the following reason. When the parent cell is bright,
the child cell is made dark, and vice versa. It is to make the brightness of the
parent and child cells in balance. The brightness of the child cell does not
uniquely determine its color. So the color of the child is determined by
randomly choosing a color whose brightness matches the given brightness.

3.2.3. The Displacement from the Parent Cell




5
The displacement between the parent and child cells is expressed in terms
of rotation and translation in 3-dimensional space.
1
The rotation is determined
randomly while the distance from the parent is in proportion to the difference
between the child cell color and the parent cell color. In other words, when the
difference in color is small, the displacement of the child from the parent is
made small, and vice versa, in order to avoid putting contrasting colors close
together.

4. Painting Algorithm

4.1. Overview of the Algorithm

Each cell is represented as an object in the programming language (a script
language called Python)
2
, and the attributes of an object include the color, size,
displacement from the parent object, and the list of the children objects linked
to the object. Through this children list, the algorithm visits the children objects
of a given object and perform various actions on them. The flow of the
algorithm is shown in <Figure 9>. Each cell grows until it becomes double the
original radius. Then the cell divides and produces a child cell.

4.2. The Decision Rules of Cell Attributes

4.2.1. The Initial State of the Parent Cell

For the development-based painting algorithm, the initial state of the root
cell must be given. The color of the root cell, that is, the R, G, B, A
3
values are
randomly chosen between 0.0 and 1.0 and the maximum cell size is set to be
40
4
. The position of the root cell is set to be (0.0, 0.0, 0.0) so that it is right at
the center of the global coordinate system. The initial size of the canvas is set
at 500x500 pixels. The initial setting can be adjusted.

4.2.2. The Decision Rule of the Child Cell Size


1
Sumanta Guha (2011), Computer Graphics Through Opengl, CRC Press

2
Allen Downey (2008), Think Python-How to Think Like a Computer Scientist, Green Tea
Press,
3
Four channels of 32 bit graphic system. A refers to Alpha channel.
4
The units of measurement used in 3-d computer graphics are arbitrary, and only the relative relation is
important. However, it can be thought of in terms of' cm or m for conveniences sake.



6
As explained in Chapter 3, the child cell radius is set to be in inverse
proportion to the parent cell radius, and the parent cell brightness. The child
cell size is obtained by using the following formula.

Formula 1.
(

)

Formula 2.
(

)

Formula 3.


<Formula 2> shows that the size coefficient of the child cell is in inverse
proportion to the ratio between the parent cell radius and the maximum cell
size, and the parent cell brightness of <Formula 1>. Here, the parent cell
brightness is the average value of (

). <Formula 3> shows that the


size of child cell is determined y multiplying the size coefficient of <Formula
2> by the parent cell radius. <Figure 10> shows a flow chart for determining
the child cell radius.

4.2.3. The Decision Rule of the Child Cell Color

The child cell color is randomly chosen after first determining the child cell
brightness.

Formula 4.


Formula 5.


The brightness coefficient is determined according to <Formula 4> so that
the child cell brightness is in inverse proportion to the parent cell brightness.
The child cell brightness is obtained by <Formula 5>. If the parent cell is
bright and has a strong presence, the child cell has a dark color and a weak
presence, and, if the parent cell is dark and has a low presence, the child cell is
made bright so that it has a strong presence. It is to make the parent cell and the
child cell are balanced in brightness. <Figure 11> shows a flow chart for
calculating the child cell brightness.

The color of the child cell is expressed as (

). The value of the


child cell (

) is set to be in inverse proportion to the value of the parent cell


by <Formula 6>. The child cell color (

) is chosen randomly among the





7
colors that has the same brightness as the child cell brightness obtained by
<Formula 7>.

Formula 6.



Formula 7.
(

)

Formula 8.
( )
if < 0

( )

( )

3
)

elif < 066

( )

( )

3
)

else :

( )

( )

3
)

The child cell color (

) is determined by the rule described in


<Formula 8>. First, select a random number by using f = random ( )
1
. f
becomes a random number between 0 and 1. If f < 0.33,

of the child cell


color is chosen randomly, and, if f < 0.66,

of the child cell color is chosen


randomly. And

is determined by using the brightness condition. <Figure


12> shows a diagram for calculating the color of the child cell.

4.2.4. The Decision Rule of the Displacement from the Parent Cell
The displacement from the parent cell is expressed in terms of rotation and
distance. The distance is determined by a given rule, whereas rotation is chosen
randomly. The distance between the child cells from the parent cell is set to be
in proportion to the distance between the child cell color and the parent cell
color. The color distance coefficient is set as follows:

Formula 9.
|(

) (

)|


1
Function random( ) creates a random number between 0 and 1.



8
When the color distant coefficient is obtained, the distance between the
parent cell and the child cell is calculated by

Formula 10.
( )

Here, basicDistance is the distance between the centers of the two cells.

Formula 11.
( )

If there is a large difference between the child cell color and the parent cell
color, the child cell is located far from the parent, and if there is a short
distance, the child cell is located near the parent. This is to place cells with
similar colors close and cells with contrasting colors far from one another, in
order to reduce the feel of contrast between the parent and the child. <Figure
13> shows a flow chart for calculating the displacement from the parent.

4.3. Morphological Expression of Cells

4.3.1. Shapes of Cells

In this algorithm, to draw a cell, a polygon expressed by <Formula 12> is
used. Specific polygons are defined by specifying the parameters



and in <Formula 12>. This algorithm uses four forms of cells. A
sequential number is assigned to each cell as a cell id, each time they are
created. If the cell id number modulo 4 is equals 0, the first cell form is drawn,
if the cell id number modulo 4 equals 1, the second form is drawn, and so on.

Formula 12.
1

{( cos ((

())) sin((

())))

}

In <Formula 12>, when a > b, it looks like an oval long in the direction of
the x axis, and when a < b, long in the direction of the y axis. Especially, larger
difference between a and b creates an extreme oval which looks like a line
segment.


4.3.2. Examples of Cell Shape
When the parameters are set as in <Formula 13>, we obtain a polygon as
shown in <Figure 14>.

Formula 13.

1
Fletcher Dunn, Ian Parberry (2001), 3D Math Primer for Graphics and Game Development,
CRC Press



9
{( cos((2))) ( sin(())) 0 00}

<Figure 15> shows the result of painting by overlaying 3,000 polygons of
this form.

Formula 14.
{(2 cos((5))) ( sin(())) 0 60}

As another example, a polygon drawn by <Formula 14> creates a polygon
as shown in <Figure 16>. When three different cell shapes are used and 1,200
polygons are overlaid, the result is <Figure 17>.

4.4. Blending of Cell Colors

When the proposed algorithm generates and draws numerous cells, many
cells are overlapped in position. In this case, the colors of the cells become
blended. In OpenGL programing, blending is performed automatically if the
blending function is set in advance. If the initial background image is given for
the frame buffer, each time a new image is drawn, the color blending between
the current frame buffer image and the newly drawn image takes place
according to the given blending function.


5. Conclusion

In this paper, we have described a painting algorithm that uses a simple cell
developmental mechanism. It is analogous to developmental mechanism in
which cells are divided and an individual creature is developed. The painting
algorithm proposes an intuitive algorithm that determines the color, size, and
displacement of a child cell relative to the parent cell, when the child cell is
divided from the parent cell.

In the beginning, we had some doubts that an interesting painting would be
generated by a development-based algorithm, but the result was surprising. An
extremely interesting paintings were by generating and combining basic shape
elements according to three simple decision rules. Although the algorithm is
basically automatic, the paintings were made with an active involvement of the
author in setting the parameters of the algorithm. In this sense, it is
differentiated from conventional automatically-generated paintings. It is a new
painting technique available to artists who know how to do computer
programming.


Figure 1. Aarons Line Drawing 1979



10








Figure 2. Kawaguchi Yoichiro, 1996, soft seaweed moving in the sea, or a result of
growth model algorithm that resembles swimming unicellular organism.

Figure 3. Mondrian, Composition with Lines, 1917

Figure 4. A. Michael Noll, Computer Composition with Lines, 1964.
Composition of Mondrians lines regenerated by a computer




11







Figure 5. A. Michael Noll, legend opposite, 1965.

Figure 6. A. Michael Noll, Kinetic Sculpture, 1960s.
Figure 7. Several Circles 1926.



12







Figure 8. Visual grammar of Several Circles. In this painting, the colors,
sizes, and relative distance among circles seem to be the most distinct attributes.

Figure 9. Tree structure of the algorithm. (1) the root cell divides cell 1 and takes it as its child.
Fig. : the root cell divides cell 2 and takes it as its cell along with cell 1. Also, cell 1 divides cell 3 and takes it as
its child; cell 3 and 2 do not have a child and nodes without a child are leaf nodes.




13











Figure 10. Deciding child cell radius
.
Figure 11. Calculation of brightness coefficient and child brightness

Figure 12. Calculation of child cell color.




14










Figure 13. Calculation of displacement from parent cell.

Figure 14. Expression of <Formula 13>

Figure 15. Result of painting by overlaying 3,000 polygons from <Formula13>



15







Figure 16. Polygon from <Fomrula14>
Figure 17. Result of painting by overlaying the polygon from <Formula 14> and
1,200 polygons of three different shapes



16




Artist/
System
Characteristics
Characteristics of
this study
Aaron by
Cohen
Automatic painting system using
the expertise of the artist
Line drawing with concrete forms
Although the artists
knowledge is used, the
painting is abstract and
geometric in form
Growth
Model by
Kawaguchi
Visualization of developmental
process of a life form
artificial life forms
Pure abstract painting
created only with forms
and colors
Geometric
abstract
automatic
painting by
Noll
Arbitrary recombination of
empirical knowledge of existing
artists
Simple geometric black and white
forms
Various geometric forms
and color combinations by
active involvement of the
artist

Table 1. Characteristics and Difference of Existing Studies.

You might also like