mercredi 24 juin 2009

samedi 20 juin 2009

Kusama's patterns II

This is a follow up of this post. I implemented the algorithm I had in mind and here is the raw output:

Before I explain how it is made, try to find some regularity in the pattern... I think it is possible to see some.

Let me first say that I'm not satisfied at all with this algorithm. It is extremely slow (that's why the image above was rendered without antialiasing at 350x350 pixels). I cannot imagine rendering it at high resolution, let alone use it in pattern piling algorithms. And even at a more fundamental level, the dots are not nearly as densely packed as in Kusama's pattern.

The algorithm works in the following way. First decompose the plane into a regular tiling by squares. The idea is that for each pixel, we will draw random dots into the square it belongs, and color the pixel differently if it belongs to one of the dots. Problems may occur near the boundaries of the squares. We do not want to force the dots to belong to a single square (it would give some obvious and unwanted feature to the resulting pattern), but instead allow them to overlap between the squares. The randomly chosen dots crossing the boundary between our square and a neighbour should be the same as the random dots chosen when computing the color of a pixel in the neighboring square. If not, the pattern cannot be continuous across the boundary.

One way to achieve this could be to compute for each pixel all the dots with center lies in the squre it belongs or in one of the eight neighboring squares. But this is not very efficient. There are many circles in the neighboring squares which do not touch the central square.

So instead, I proceeded as follows. First, we do not like the pixels which lies near the corners of the square, because they can potentially belong to dots overlaping with the three other squares around the corner. Let us eliminate them right away by drawing a dot with a random center and radius, but such that it contains the corner. To choose the "random" center and radius, we use a pseudo-random generator which takes the coordinates of the corner as seed. In this way, the same dot will be drawn at the corner when performing the computations for any pixel belonging to the neighbouring squares, and the pattern will be continuous. Here is the pattern we get:

In contrast, here is what you get if you do not choose the seed of the pseudorandom generator to be at the corner. In each square, we chosed the radius and center of the dot idependently and we do not get a continuous pattern.

We put dots at the corners. To reproduce Kusama's pattern, we will of course require that the extra dots we will add do not intersect the dots already drawn, so none of the extra dot can come close to a corner. Still they can come close to the edges, so in the same spirit, we put dots along the edges, making sure that the dots drawn by two neighbouring squares along their common boundary coincide. We get this kind of patterns:

Finally, we will the remaining space in each squares with random dots. Now, to see if a pixel belong to such a dot, we do not need to know what's happening in the other squares.

To achieve the continuity of the pattern, it turns out to be necessary to choose the dots at the corners to be slightly larger than the mean size of the dots drawn inside the square, and I think it is possible to see it in the first image above. I doubt someone would notice it by themselves, though.

I thought this would allow to reproduce Kusama's pattern, but it's not really the case. It turns out to be impossible to pack dots as densely as she does just by choosing randomly the centers and radius of the dots. One slight improvement is to start to draw the large dots first, and then try to fit smaller dots. The first image below uses this technique, whereas the dots were choosen completely randomly in the second one.


Still, it is not as close as I would like to Kusama's pattern. So we have an interesting question... how to reproduce the densely packed dot pattern of Kusama with an algorithm? Randow dot throwing doesn't work. As was mentionned in the previous post, we could realize it as a Truchet pattern, writing down explicitly in the algorithm the center and radius of the dots on each tile, but this is not very elegant.

If anyone has an idea, please comment...

mercredi 17 juin 2009

dimanche 14 juin 2009

Kusama's patterns

Yesterday, I wandered in the art galleries of Chelsea. Here are some great artists I discovered :
But the most inspirational exhibition was probably the one by Yayoi Kusama at the Gagosian Gallery. Among other works, she had paintings displaying various patterns covering uniformly the canvas, without being periodic. In particular, I love the dot pattern displayed below.

YAYOI KUSAMA, COSMIC SPACE(TWBBAA), 2008, Acrylic on canvas, 51 1/4 x 51 1/4 inches (130.3 x 130.3 cm), Gagosian gallery

This kind of patterns are precisely the ones which are interesting for "pattern piling" (see the explanations here), the technique used to build my works. So I started thinking a bit about how to draw this pattern with an algorithm.

The most natural way to draw it would be in a gradual way, by throwing randomly disks of various size on the surface of the image, with the requirement that they do not overlap. But as is explained here, the algorithms that Ultra Fractal can use have to work "pixel by pixel": they accept the coordinates of the pixel as basic data, out of which they must return a color. The image is produced by running the same algorithm for each of its pixels. This makes the implementation of the natural algorithm we hinted to more cumbersome. First we would have to store the information about the size and the location of each disk, and then for every pixel, to check whether it belongs to some disk. For pattern piling applications, we need patterns containing a very large number of disks, what would lead this type of algorithm to require huge quantities of memory and a lot of computations.

So we have to find a better way of drawing this pattern. One simple but not very satisfying solution would be to draw a periodic pattern. For instance the background of Yayoi Kusama's website is periodic, even if this is not immediately obvious. If we restrict ourselves to a periodic pattern, then the previous algorithm has to be applied only on a relatively small elementary tile, so the memory and computing problems disappear. But this is not suited for pattern piling, because the periodicity would be obvious for the small scale (ie. zoomed out) copies of the pattern.

A smarter idea would be to draw it as a Truchet pattern. A set of decorated square tiles is chosen such that all the decorations intersect the boundary of the tiles in a unique way. Then, by choosing randomly the decoration of each tiles of a square tiling, we get a non-periodic pattern. It is not difficult to imagine a set of Truchet tiles decorated by the pattern of Kuzama. Still, the fact that the decorations have to coincide on the boundary would give this pattern a pseudoperiodicity which would not be very appealing in my opinion.

I believe there is an much better way of drawing this pattern algorithmically. Hopefully I'll be able find some time to implement it, and if it works, I will describe it in a future blog post.

dimanche 7 juin 2009

Page 93 updated...


...at p-gallery.net. There is also a little bit more in the About section of Algorithmic worlds, but it is still under construction.

jeudi 4 juin 2009

Piling hexagons

As I tried to explain here, all of my images are constructed by piling simple patterns. Piling patterns is a truely addictive activity. It's impossible to predict what you will get and, provided the pattern is simple enough, the result is bound to be esthetically pleasant. Consider for instance the hexagonal tiling by black and brownish hexagons shown below.

The hexagons are colored such that around each vertice of the tiling, there are always two black hexagons and a brown one. Such a coloring is called Archimedean. For those understanding these words, this coloring is even uniform, because the symmetry group of the colored tiling acts transitively on the vertices. Anyway, it is a desperately simple pattern. Let us see what happen when we pile several copies of it, each copy being three times smaller than the previous one. Adding three copies, we get these nice shapes.

Going on and adding enough copies so that the smallest ones cannot be distinguished anymore, we get this :

Among other things, one can spot Koch snowflakes ! Even better, a closer look reveals a tiling of the plane by Koch snowflakes. Actually, the procedure consisting of removing from the plane the (open) brown hexagons from each copies of the tiling results in a fractal subset of the plane (pictured in black in the image above) which is the boundary of the tiling of the plane by the Koch snowflakes. There are many tilings by Koch Snowflakes (see for instance here), but I counldn't find this one... I would guess that the boundary of this tiling can be generated as an iterated function system. Anyway, here is a polished image to explore.

mardi 2 juin 2009