I’ve implemented a random color scheme in Structure Synth, using a new ‘color random’ specifier.
But what exactly is a random color? My first attempt was to use the HSV color model and choose a random hue, with full brightness and saturation.
This produces colors like this:
Most of my Nabla pictures used this color scheme. It produces some very strong colors.
Then I tried the RGB model using 3 random numbers, one for each color-channel, which creates this kind of colors:
But what about greyscale colors:
I decided that it was necessary to be able to switch between different color schemes.
So I created a new ‘set colorpool’ command. Besides the color schemes above (‘set colorpool randomhue’, ‘set colorpool randomrgb’, and ‘set colorpool greyscale’) I created two additional color schemes:
One where you specify a list of colors:
(For this image the command was: “set colorpool list:orange,white,white,white,white,white,white,grey”. As is evident it is possible to repeat a given color, to emphasize its occurrence in the image.)
And on where you specify an image which is used to sample colors from:
The command used for the above image was: “set colorpool image:001.PNG”. Whenever a random color is requested (by the ‘random color’ operator), the program will sample a random point from the specified image and use the color of this pixel. This is a quite powerful command, making it possible to imitate the color tonality of another picture.
Now this is all good. But I realized that there are some problems with this approach.
The problem is that geometry and the colors draw numbers from the same random number generator (the C-standard library ‘rand()’ function).
This means that changing the color scheme changes the geometry (since the color schemes use a different number of random numbers for each color – randomhue uses 1 random number per color, the image sampling uses two (X and Y) random numbers per color, the randomrgb uses three).
This is not acceptable, since you’ll want to change the color schemes without changing the geometry. Another problem is that C-standard library ‘rand’ function is not platform independent – so even if you specify a EisenScript together with an initial random seed, you will not get the same structure on different platforms.
I solved this by implementing new random generators in Structure Synth. I now use two independent Mersenne Twister random number generators, so that I have two random streams – one for geometry and one for colors.