50000 Rectangles #24

200000 rectangles.

(Continued from 50000 Rectangles #23.) I do not spend a lot of time selecting the functions for the IFS system. I just grab a random set and see how it works. If I do not like it, I try something else.

Some of these IFS function sets work well alone. Some sets are too random or too simple to stand alone. I select a few different IFS sets and superimpose them. Now, the image has an interesting conflict between the too simple and too complex. A typical 50000 rectangle image may have 5000 iterations of each of ten different sets, or five sets of 10000.

There are some loose guidelines I follow when merging different IFS function sets. In general, more functions in an IFS set means more randomness, more messiness. Larger coefficients also generally means more mixing, and more mess. So, depending on the effect I am trying to achieve at the time, I keep these variables within narrow limits.

Today's Special
In today's picture, there is only one function in each IFS function set. With only one function there is no randomness in the function selection. It is just iteration of a single function. The function is constrained (so that is does not escape to infinity), but not contracting (so it does not collapse to a single point). Five different single-function iterations are overlaid.

50000 Rectangles #23

40000 rectangles.

(Continued from 50000 Rectangles #22.) A typical IFS fractal requires many iterations of the chaos game. Each chaos-game point is used to build a histogram. There are as many buckets in the histogram as pixels in the image. More if there is oversampling. If color is used to represent density, many buckets need to be hit many times. One hundred million iterations or more may be necessary for a high resolution color IFS image.

These images do not require as many iterations as a typical IFS or flame fractal. Each point generates a rectangle, so the screen fills quickly. Ten thousand iterations is usually adequate.

50000 Rectangles #22

50000 rectangles

(Continued from 50000 Rectangles #21.) IFS and Flame Fractals are fascinating, but they have also been done to death. I may try my hand at them someday. But for now, I just want to extract a small observation. The result of the chaos game is a random distribution. In our situation, a 2D random distribution. But one that is unlike any studied in statistics. I set up the chaos game on a set of functions, linear and nonlinear. Then use the points generated as the lower left corners of the rectangles.

The reason IFS uses contraction mapping is to ensure that the fixed set exists and is bounded. Without that restriction there may be no fixed set. The moving point in the chaos game may run off to infinity. But when using math for art, we are not so worried about such things. I mix in functions that are not contraction mappings. If they do not work, I just try something else.

50000 Rectangles #21

50000 rectangles

(Continued from 50000 Rectangles #20.) Chaos Game as defined in the wiki uses a specific type of function (move towards vertex). This is an unnecessary restriction. Iterated Function Systems has the looser requirement of Contraction Mappings. Contraction mappings can be nonlinear.

It turns out that playing the chaos game on and IFS collection of functions will reveal the fixed set for that IFS. Even though nonlinear functions are allowed, the wiki page for IFS shows only linear/affine examples. Flame Fractals are examples of IFS that include non-linear generating functions.

50000 Rectangles #20

100000 rectangles

(Continued from 50000 Rectangles #19.) I use some ideas from Iterated Function Systems. The most famous IFS is probably the Sierpiński Gasket. IFS images can be generated by playing the Chaos Game. I use the Chaos Game to generate a 2d probability distribution.

I do not want to dig too deep into the technicalities. I will tread there lightly. I do not know why I bother. This is still too deep for the casual reader and too shallow for someone familiar with the topic. But I try anyway.

An iterated function system is a set of functions on some reasonable mathematical space. The functions are expected to be Contraction Mappings, which means that they make things shrink. We are interested in the "fixed set" of these functions.

The Chaos Game as described in the Wikipedia article is about tracking a point as it moves closer to a randomly selected vertex of a fixed polygon. For the Sierpiński Gasket the polygon is a triangle and each move is one half the distance to the vertex. The move-toward-a-vertex action is an Affine function and a Contraction Mapping.

50000 Rectangles #19

50000 rectangles.

(Continued from 50000 Rectangles #18.) You might think that I looked at the Wikipedia examples, or an old statistics text book to find a cool two dimensional probability distribution. That is not how it went. I created the images before I wrote these word for the blog. Created them before I had the idea that probability distributions might be a way to explore the order / chaos boundary.

The answer is still "a cool 2d probability distribution", but I found it somewhere else. And of course that leads to another lengthy, multiple post digression.

50000 Rectangles #18

50000 rectangles.

(Continued from 50000 Rectangles #17.) All of the probability distribution examples in the previous few posts were one dimensional random variables. There are analogs in higher dimensions. In fact there are new and richer possibilities in higher dimensions.

The lengthy digression into randomness and probability distributions was motivated by the question "where should we put the rectangles?". The stated goal was something random yet not too random, something between order and chaos.

The answer is "Put the rectangles on a cool 2d probability distribution". Preferably a distribution with controls to dial in different degrees of randomness.

50000 Rectangles #17

50000 rectangles.

(Continued from 50000 Rectangles #16.) If you visit the Wikipedia page Normal Distribution, there is a graph showing the effect of different standard deviations. At the limits, the normal distribution with standard deviation of zero becomes the Degenerate Distrbution. With an infinite standard deviation, it becomes the Uniform Distribution. So, not only is the normal distribution in the middle between order and chaos, it comes with a dial, the standard deviation, to control the order/chaos mixture.

The List of Probability Distributions has well over 100 well known, will at least popular enough to be named, probability distributions. All but two of them (uniform and degenerative) live somewhere between totally random and not at all random. Almost all of those have parameters like the standard deviation that can be used to dial in different degrees of randomness.

50000 Rectangles #16

50000 rectangles.

(Continued from 50000 Rectangles #15.) Here is a List of Probability Distributions. The fifth item in the first bullet list is the Degenerate Distribution. There is one outcome and it happens 100% of the time. It is a legitimate, if uninteresting, probability distribution. It is the exact opposite of our intuitive definition of randomness.

Earlier I said that I was seeking something random, but not random. Something between order and chaos. Perhaps the answer lies in these probability distributions. The uniform distribution lines up with the intuitive idea of complete randomness or total chaos, while the degenerative distribution matches the idea of no randomness, absolute order. The normal distribution is somewhere in the middle.

50000 Rectangles #15

60000 rectangles.

(Continued from 50000 Rectangles #14.) If you encounter a uniform distribution in the real life, such as a card game, you think randomness. But if you encounter a normal distribution, such as the height of your friends, it just seems normal, not really random.

The graph of the uniform distribution is just a horizontal flat line. The earlier link has the graph for the normal distribution. You have seen it plenty of times. You can move the peak around and make it steeper or flatter by varying the mean and standard deviation. So much more interesting than a flat uniform line.

50000 Rectangles #14

60000 rectangles.

Today
Later on I will describe how Iterated Function Systems and Contraction Mappings generate bounded fixed sets that are used for most of the images in the series. The previous images are zooms that show only parts of those sets. Today the view is zoomed out and full bounded set is seen.

Ongoing Story
Yesterday, 50000 Rectangles #13, I mentioned the random/not random border. Order and chaos. Even though the idea seems obvious, it got me thinking. Indulge me as I go down the rabbit hole and off on a tangent at the same time.

Randomness is generally equated with uniform probability distribution. Every event is equally likely. Each side of a die has 1/6 probability of being rolled. The odds of drawing the ace of spades is 1 out of 52, the same as the odds for the 3 of hearts. Here is a link on Probability Distribution, but I do not think you need to go there.

There are other types of randomness. Statistics is all about dealing with randomness. While the uniform distribution plays a role, its popularity is far behind the Normal Distribution, the bell shaped curve.

50000 Rectangles #13

50000 rectangles.

After the long description about faux edges and shadows, the next question may be "how do I decide where to put the rectangles"? One sees randomness, but not total randomness in these pictures. There is a hidden pattern, sometimes very well hidden, and sometimes not hidden at all.

I mentioned this many times over the years, and here it is again: I like to visit the boundary between random and not random. It is a wide boundary, and depending on my mood sometimes I land nearer the order side or the chaos side.

50000 Rectangles #12

40000 rectangles.

There is much more potential here. The weight which is used as a parameter to combine colors, is just a number. Also, other pixels can be used for more than computing a normal and ray reflections. A pixel is just a set of numbers x, y coordinates, weight, and rgb colors. These numbers can be combine in infinite ways to distort or enhance an image.

That description is way too general. Applying random calculations to these numbers will just results in random noise. The potential is realized by breaking the rules, but only by a little bit at a time.

I am not going down that path now. This is going on my every increasing list of this to revisit someday.

50000 Rectangles #11

50000 rectangles.

(Continued from 50000 Rectangles #10.) Things got better with these changes. I could scale up the image without noticeable artifacts. But finding the right distance and other parameter setting required way too much fiddling. And the result simply was not that exciting.

Then came inspiration (or perhaps laziness). I decided that I was not trying to accurately simulate lighting on a surface. Rather I was just coming up with a new way to alter an image. I should think of this as just another metaphorical brush in the tool box.

I started applying unrealistic parameter setting. I used larger distances for the triangle coordinates. I modified the dot-product calculation for ray reflection. I added a second "eye" location.

Now the effect was distorted and exaggerated. Interesting, but not realistic.

That is the right answer. This is abstract art. It is not meant to depict any reality. It may vaguely trigger some association, but that association should be loose and fluid. My distorted, imperfect, 3D lighting is like putting the eye in the wrong place on a face.

50000 Rectangles #10

100000 rectangles.

(Continued from 50000 Rectangles #9.) After all of this, the results were underwhelming. Perhaps there was a bug, but I believe the results were accurate. Just not very exciting.

One problem I identified with my method came from using adjacent pixels to compute the normal. Shadows were one pixel wide. The same scene looked different at different resolution. Higher resolution meant thinner shadows. Also at different resolutions, the adjacent pixels are different, so the surface normal calculation gives different results.

To solve this, I choose pixels a certain (resolution-independent) distance from the target pixel to compute the normal. I also used a weighted average of pixels near that target distance rather than a single pixel.

50000 Rectangles #9

100000 rectangles.

It was my intention to create an accurate 3d lighting representation of the surface describe in 50000 Rectangles #8.

I defined a point in space for the eye, and points for one or more light sources. I assigned brightness to the light source, reflectivity to the surface. I added parameters for degrees of diffusion and spot light cone size, and several other things.

For a given pixel I use the pixel to the left and the pixel above to create a triangle in 3D space. Then the surface normal to the triangle is calculated, and from that the angles to the eye and the light.

50000 Rectangles #8

50000 rectangles

If you have not been following along, I described rectangle weight in 50000 Rectangles #2 and pixel weight in 50000 Rectangles #7.

Now we can view the image as a surface in 3D space. The pixel coordinate is x,y, and we use the pixel weight for z, height. We can shine light on the surface and create shadows and reflections.

One could do that. But that is not exactly what I am doing. To be continued…

50000 Rectangles #7

50000 rectangles

I described a rectangle's weight back in 50000 Rectangles #2. This weight could also be considered opacity, or its inverse, transparency.

I keep track of the total weight on each pixel. Each time a rectangle covers a pixel the rectangle weight is added to the pixel weight.

All rectangles, and all pixels covered by each rectangle are assigned the same weight. So the pixel weight is essentially the number of rectangles that intersect the pixel.

Weight varies from image to image, but on a single image it is constant. At least so far. I may experiment with rectangles of different weight, or different pixel weights within a rectangle.

50000 Rectangles #6

50000 rectangles

10000 each of five colors. weight = 5%

I am sure you noticed the black outline or shadows around some of the rectangles, and you suspect there is something else going on. There is. The explanation will take a few days. (I have over 20 of these images to post, and I tend to run out of words before images. So I am spreading the words over many posts.)

50000 Rectangles #5

50000 rectangles

Now 5000 rectangles each of 10 colors, with weight = 2%

← Previous 20 Showing 678-697 of 1420 Next 20 →