Combinations Cellular Automata

Combinations Cellular Automaton

This is a new idea for a 1D cellular automata that came from Asher (blog YouTube).

Combinations Cellular Automaton

Trying to explain this clearly is harder work than programming it.

Combinations Cellular Automaton

Rule string

Combinations CAs can have between 2 and 10 maximum states per rule. 2 states means the cells can be either on or off. 3 states mean cells have 1 dead state and 2 living states.

The CAs are governed by a rule string.

The rule string needs to be states^2 characters in length. For 2 state rules the rule string will need 4 characters, for 4 states the rule string needs 16 characters, for 10 states the rule string needs 100 characters.

For 2 states the rule string characters are in base 2, so binary values of either 1 or 0. For 3 states the rule string is base 3, so the characters are all between 0 and 2. For 10 states the rule string is base 10, so the characters are all between 0 and 9.

An example 2 state rule is 0110 which creates the following;

An example 3 state rule could be 012120200 that creates the following result;

An example 10 state rule could be

50391696401156117866581414266160495600057647563383
52633979845117861158665940485681011955680007489199

which gives this result;

Number of possible rules

When you have a maximum of 2 states, the rule string has 4 digits of either 0 or 1. The maximum rule string is 1111, which converts to 15 in binary. That gives you 16 possible rules (0000 is also counted) for state 2.

Increasing to 3 states has a 9 digit rule string with base 3 digits. 222222222 is the maximum base 3 number which translates to 19682, so there are 19683 possible 3 state CA rules.

4 states is 16 characters. 3333333333333333 is 4,294,967,295 in decimal, so 4,294,967,296 possible 4 state rules.

10 states is 100 characters. No need for decimal conversion as base 10 is decimal. So 1 with 100 zeros after it possible rules. That may as well be an infinite space to look for rules within.

Combinations Cellular Automaton

How the cells are updated

Each cell in the CA is updated by taking into account 2 cells from the previous step. These 2 cells are converted into a decimal value that is used as an index in a rule string to give the new cell state. I bet that makes loads of sense! Let me try and explain.

An example with a 2 state CA using rule 0110, so cells can only be either state 0 or state 1.

If the first step is a single center cell, then the values would look like;


00000100000
?

Cell at ? looks at the cell above it and the cell next to it. These are 00. 00 converted to decimal is 0. So we look at the 0th entry in the rule string, so the cell value becomes 0.


00000100000
0

Same for the next 3 cells


00000100000
0000

Then we get to the next ? cell


00000100000
0000?

This cell has the cell above it and next to it as 01. 01 converts to decimal 1, so we look at the 1th (second) digit in the rule string. The second digit in the rule is a 1, so the new cell becomes a 1.


00000100000
00001?

The next ? cell now has 10 above it. This converts to a 2 in decimal, so we look at the third rule digit. Again it is a 1.


00000100000
000011

The rest of the row has 00 above them, so they get set to 0.


00000100000
00001100000

If you continue this process, you get the following result;

Brick wall neighborhood

This CA also uses the brick wall neighborhood idea for selecting neighborhoods. See here for an animation of brick wall. Basically you shift the neighbor locations being checked every other line.

For the Combinations Cellular Automata in this post this means the location of the 2 neighbor cells changes every line.

For even lines you use the cell directly above and to the right. For example, in this next diagram the ? cell would use the 3 and 4 locations.


12345
  ?

For odd lines you use the cell to the left and the cell above. This would be the 2 and 3 neighbor cells.

Combinations Cellular Automaton

Interesting Rules

Rule 002200121 behaves similar to Wolfram’s Rule 30. During bulk runs of rules I have seen other results that also look like this one.

Combinations Cellular Automaton

Another result that has been observed to occur are these “counting triangles” rules. The splitting of bifurcation like structure on the right hand side is like a binary counter. This is rule 010221200.

Combinations Cellular Automaton

Rule 200122011 also gives a binary counter structure.

Combinations Cellular Automaton

More example images

See my flickr gallery for more example results.

Combinations Cellular Automaton

Availability

Combinations Cellular Automata are now included in Visions of Chaos.

Jason.

Comments Off on Combinations Cellular Automata Posted in Uncategorized

Visions of Chaos movie tutorials

For years now I have been asked for some more in depth tutorials on Visions of Chaos. One recent comment on my YouTube said a movie watching me use it may help them.

I have wanted to do movie tutorials but I was never happy with my voice. After doing these first 3 parts I have nothing but the utmost respect for anyone that can do this easily. Even with a full script pre-written of what I want to say it is not easy.

I used the free OBS Studio to capture my screen and then the Davinci Resolve free version for editing. Davinci has been great for chopping out all my seemingly endless umms, errs, pauses, stutters, flubbed lines, etc. It does crash frequently on multiple PCs when rendering to the final movie, but this looks like a graphics driver issue as when I use it on a very old PC it works fine without crashing. Hopefully the next Nvidia updates will stabilize the performance again.

For the first 3 tutorials I used a super cheap headset with a built in microphone so the sound is very rough, but hopefully they can help people and get some feedback on other areas of the program people want tutorials on.

After buying a better microphone I recorded the following TensorFlow tutorials.

There are occasional very low end thumping noises. They were a mystery at first (sounds almost like construction noise, but there was none that I could hear at the time of recording) but turned out to be the lift in my building. Otherwise you may hear cicadas and other Australian wildlife in the background.

Another tutorial about the Physarum Simulations in Visions of Chaos.

Number 6 is a more relaxed non-scripted tutorial on Video Feedback simulation. This one was a bugger to edit.

The 7th tutorial covers how to print Mandelbrot Fractals across multiple pages to make large wall sized posters.

The 8th tutorial covers DeepDream functionality in more depth.

The 9th is all about Style Transfer

I wouldn’t say I am getting good at this yet, but the recording and editing process is getting easier. If you have any specific requests for tutorial topics let me know.

Jason.

Automatic Color Palette Creation

Fractint MAP format palette files

Going back 30 years, Fractint was a fractal generation program for DOS based systems. For its time it was the fractal program of choice for enthusiasts.

Fractint used a simple text format for its color palettes. These *.MAP files were text files with each color’s RGB values separated by spaces each on a new line. So, for example if you wanted the first color in your palette to be blue the first line would be “0 0 255”.

When I first started creating Visions of Chaos I adopted the format. The most common map files had 256 colors (you could have palettes with other color counts but I only use 256 color palettes).

The rest of this post covers the palette creation methods that have been included with Visions of Chaos. Although I use these methods specifically to create 256 color MAP files the principles could be applied to any number of colors for different sized palettes.

If you are just looking for a Fractint color palette collection, scroll down to the end of this post and grab the archive provided.

Smoothly blending colors

Visions of Chaos Color Palette Editor

This is probably the first and most obvious method to use. Take a small number of base colors (I allow up to 16) and blend them into a palette.

How you get the colors to blend can be;

1. User selects them from the standard color picker dialog.
2. User can use eye dropper functionality to pick them out of a photo.
3. Set them at random.
4. Use the color wheel. Allows selection of complmentary colors, tetrads, and other color theory based colors.

Visions of Chaos Color Palette Editor

5. Extract colors from an image. See this previous blog post explaining how that works.

Visions of Chaos Color Palette Editor

Once you have the colors there are numerous ways you can blend them;

1. Smooth blend. Smoothly interpolate the colors.

Visions of Chaos Color Palette Editor

2. Fade out blend. Fade each of the colors to black.

Visions of Chaos Color Palette Editor

3. Fade in blend. Fade each of the colors from black.

Visions of Chaos Color Palette Editor

4. Neon blend. Fade from black to the colors then back to black.

Visions of Chaos Color Palette Editor

5. Stripe blend. Alternate each color for the duration of the palette.

Visions of Chaos Color Palette Editor

Using curves to create palettes

The idea here is to use various mathematical functions to generate curves for the RGB components of the palette. The following is a list of the various methods I use so far.

Sine. Each RGB color component is its own sine wave. Randomize the wave amplitude, frequency and period.

Visions of Chaos Color Palette Editor

Multiple Sine. Add multiple sine waves together for each RGB component and then scale down to between 0 and 255.

Visions of Chaos Color Palette Editor

IQ. Idea from Inigo Quilez.

Visions of Chaos Color Palette Editor

Perlin. Use repeating noise loops as in this coding train video. Map the resulting noise values to each RGB channel. Using a looping noise function is best because it means the palette wraps around smoothly and using it for fractal zooms does not show a sharp break when the palette ends and restarts. I have only implemented this method over the last few days (at the time of writing this post), but so far it gives some really unique color palettes.

Visions of Chaos Color Palette Editor

Here are some examples palettes created using Perlin noise. Click to see the full sized image.

Visions of Chaos Color Palette Editor

Simplex. Same as Perlin, but uses Simplex noise.

Visions of Chaos Color Palette Editor

Simplex + Perlin. Create each RGB value by adding Simplex noise to Perlin noise.

Visions of Chaos Color Palette Editor

Here are some examples of Simplex and Simplex + Perlin palettes. Click for full size.

Visions of Chaos Color Palette Editor

Multiple Perlin – Add/subtract multiple Perlin Noise curves into RGB amounts.

Visions of Chaos Color Palette Editor

Random Walk. Random curve for each RGB component between index 0 and 127. Reverse for the rest of the palette. Each step the RGB is changed by +random(5)-2 to randomly go up and/or down.

Visions of Chaos Color Palette Editor

Terrain Fault. Take 2 random points between 0 and 255. Between the points randomly raise or lower by a small amount. Repeat this a number of times.

Visions of Chaos Color Palette Editor

HSL to RGB. Random HSL curves converted to RGB.

Visions of Chaos Color Palette Editor

RGB. Random curves for each RGB component. Use various easing functions to tween curve control points.

Visions of Chaos Color Palette Editor

YUV to RGB. Random YUV curves converted to RGB.

Visions of Chaos Color Palette Editor

Combine palettes. Take 2 previously created palettes and combine their RGB components by addition, subtraction or multiplication.

Visions of Chaos Color Palette Editor

Multiple RGB. Combine multiple RGB curves.

Visions of Chaos Color Palette Editor

Multiple YUV to RGB. Combine multiple YUV to RGB curves.

Visions of Chaos Color Palette Editor

Modify an existing palette

Once you have palette files, you can also use various techniques to modify them;

1. Increase or decrease the individual RGB channel amounts
2. Brightness
3. Contrast
4. Increase or decrease the individual YUV channel amounts
5. Wrap. Take the existing palette, halve it, then add the flipped half to itself. This is useful when you want a non repeating palette to wrap around.

Visions of Chaos Color Palette Editor

Visions of Chaos Color Palette Editor

6. Double. If you have a palette that is too smooth/sparse for the current fractal image, doubling can add more lines/gradients to the palette.

Visions of Chaos Color Palette Editor

Visions of Chaos Color Palette Editor

7. Blur. Just like a blur function in image processing. Averages out the palette values with neighbor colors.
8. Sharpen. Just like a sharpen function in image processing.
9. Shift RGB. R->G,G->B,B->R.

Visions of Chaos Color Palette Editor

Visions of Chaos Color Palette Editor

Visions of Chaos Color Palette Editor

10. Invert. R=255-R, G=255-G, B=255-B.
11. Reverse. Flip the order of the palette colors.
12. Histogram equalize palette. Like the auto-levels in Photoshop. My method tends to make the results slightly too bright. Needs fixing when I get a chance.

Visions of Chaos Color Palette Editor

Visions of Chaos Color Palette Editor

13. Matrix multiplication. Take a 3×3 matrix and multiply the 1×3 RGB components by the matrix to get new RGB amounts.

Visions of Chaos Color Palette Editor

Any other ideas?

If you know of any other ways to generate palettes, or have an idea for ways to create new unique color palettes, let me know.

Availability

The color palette editor shown in this post is included with Visions of Chaos.

Just give me the palettes!

If you are using another program that uses Fractint palette files you can download the 3371 color palettes I include with Visions of Chaos here. Some created by me, others found on various Internet sites over the years, some converted from gradient packs. No copyright on them so do with them as you wish.

If you do have any other sets of MAP palettes you would like to share, send me an email. You can never have enough colors when creating fractal images.

Jason.

2018 In Review

Another year gone. Over the past year Visions of Chaos has had many new features added, bugs fixed and loads of smaller enhancements. In this blog I managed to cover and experiment with a wide variety of topics over the last 12 months.

Post Summary

Here is a list of posts I added to this blog in 2018;


More Adventures With 3D Gravity
Updated simulation code for 3D gravity.


MergeLife Cellular Automata
Yet another CA explored this year.


Cellular Automata Explained Part 1
Trying to explain CAs from the ground up for newbies. Idea is to expand this into a series.

1D CA


Mandelbrot Foam
A new variety of fractal from Fractal Forums.


Clusters And Particles
Awesome emergence.


Extended Neighborhood 1D Cellular Automata
Inspired by a Reddit post this time.

Extended Neighborhood Cellular Automaton


3D Multiphase Smoothed-Particle Hydrodynamics
3D fluids.


Hybrid Fractals
Quick explanation for hybrid fractals. An area with huge potential for exploration and experimentation.


Multiple Rules Cellular Automata
From a YouTube comment idea.

Multiple Rules Cellular Automaton


Searching For Pleasing Looking Flame Fractals
My attempts at trying to make software smart enough to detect good looking flames.

Flame Fractal Mutator Dialog


Stochastic Cellular Automata
Introducing randomness into CAs.


Spring Pendulum
Extending double and triple pendulums but using springs for their segments.


More Explorations With Multiple Neighborhood Cellular Automata
More experiments with these awesome CA.

Multiple Neighborhoods Cellular Automaton


Rock Paper Scissors Cellular Automata
RPS and variations in CA form.

RPS Image Cellular Automaton


Multiple Neighborhoods Cellular Automata
Fantastic new CA.


Stacked Generations Display For 2D Cellular Automata
These turned out very nice.

History Dependent Cellular Automaton


History Dependant Cellular Automata
A new (old/rediscovered) CA method.


Alternating Neighborhoods Cellular Automata
A new CA from an idea I had one day.

Alternating Neighborhoods Cellular Automaton


Zhang Cellular Automata
A Twitter post inspires another new mode.

Zhang Cellular Automaton


Two Steps Back Cellular Automata
Another new CA (for me) from a Twitter post.

Two Steps Back Cellular Automaton


Indexed Totalistic Cellular Automata
A new CA thanks to a Twitter post.

Indexed Totalistic Cellular Automaton


Line Based 3D Strange Attractors
A group of strange attractors that are plotted from a series of joined points rather than a point cloud.


2D Accretor Cellular Automata
Experiments with a 2D version of the Accretor CAs.

2D Accretor Cellular Automaton


Variations of Ant Automata
Trying a new variation of Langton’s Ant. Nothing too spectacular.

Ant Automaton


Accretor Cellular Automata
Interesting structures from a new CA thanks to a Dutch artist.

Accretor Cellular Automaton


The Stepping Stone Cellular Automaton
An interesting CA from the C64 days of 1980.

Stepping Stone Cellular Automaton


Blog

I have tried to include more useful information as this blog has gone on over the years to hopefully help others, but mainly blogging is most helpful to me. There is an old adage saying that if you cannot explain something clearly then you do not understand it well enough. Writing blog posts has helped me clarify many topics in my mind.

Another big advantage of blogging is that you get contacted by like minded people. Many of the interests I have blogged about have been greatly enhanced by someone emailing me a new idea or fix for an issue I am having.

I really do recommend that everyone blog. Everyone has a “something” they are good at or knowledgeable about. Share that knowledge. You may be surprised how much you benefit from the process.

Looking Forward

I have no intentions of stopping development on Visions of Chaos any time soon. I still have loads of ideas for new features. That also means this blog will continue to grow for the foreseeable future. Onward to 2019 and beyond.

Jason.

Visions of Chaos now supports Pixar RenderMan

Visions of Chaos can now use Pixar‘s Free Non-Commercial RenderMan to render 3D scenes.

This is the same RenderMan engine used in movies like Finding Dory

Finding Dory Screenshot

and Rogue One

Rogue One Screenshot

I am only using a tiny fraction of RenderMan’s features. Rendering millions of spheres or cubes with nice shading and lighting covers my requirements, but it is good to know that I have the extra power of RenderMan to expand if needed in the future.

All the end user needs to do is download the stand-alone Pixar RenderMan and point Visions of Chaos to the main command line RenderMan prman.exe renderer file. After that Visions of Chaos constructs the RIB format files RenderMan understands and gets prman to render the images.

Currently RenderMan support is added to the following Visions of Chaos modes;

3D Ant Automata

3D Ant Automaton

3D Cyclic Cellular Automata

3D Cyclic Cellular Automaton

3D Cellular Automata

3D Cellular Automaton

3D Hodgepodge Machine

3D Hodgepodge Machine

3D Hodgepodge Machine

3D Voxel Automata Terrain

Voxel Automata Terrain

3D Diffusion-Limited Aggregation

3D Diffusion-Limited Aggregation

3D Cube Divider

Cube Divider

RenderMan seems to be able to handle a massive number of objects so far. This next test 4K image was over 33 million little cubes. RenderMan churned away for over 2 hours on this one image. The main slowdown was my lack of memory and constant hard drive paging. 32 GB of RAM just does not cut it when rendering this sort of data. The RIB scene file alone was 13 GB.

Voxel Automata Terrain

RenderMan is slower than Mitsuba at this stage. But that could be down to any number of reasons including my lack of RenderMan knowledge.

Jason.

Eroding Fractal Terrains with Virtual Raindrops

A long while back I added a very simplistic fractal terrain simulator to Visions of Chaos. I had an idea to try and add erosion simulation into the existing code to get some more realistic terrain shapes.

Generating the inital terrain

There are many ways to generate a terrain height array. For the terrain in this post I am using Perlin noise.

This is the 2D Perlin Noise image…

Fractal Terrain

…that is extruded to the following 3d terrain…

Fractal Terrain

An alternative method is to use 1/f Perlin Noise that creates this type of heightmap…

Fractal Terrain

..and this 3D terrain.

Fractal Terrain

Simulating erosion

Rather than try and replicate some of the much more complex simulators out there for wind and rain erosion (see for example here, here and here) I experimented with the simplest version I could come up with.

1. Take a single virtual rain drop and drop it to a random location on the terrain grid. Keep track of a totalsoil amount which starts at 0 when the drop is first dropped onto the terrain.
2. Look at its immediate 8 neighbors and find the lowest neighbor.
3. If no neighbors are lower deposit the remaining total soil carried and stop. This lead to large spikes as the totalsoil was too much. I since changed the drop rate to the same as the fixed depositrate. Technically this removes soil from the system, but the results are more realistic looking terrain.
4. Pick up a bit of the soil from the current spot (lower the terrain array at this point).

soilamount:=slope*erosionrate;
totalsoil:=totalsoil+soilamount;
heightarray[wx,wy]:=max(heightarray[wx,wy]-soilamount,0);

5. Move to the lowest neighbor point.
6. Deposit a bit of the carried soil at this location.

deposit:=soilamount*depositrate/slope;
heightarray[lx,ly]:=heightarray[lx,ly]+deposit;
totalsoil:=max(totalsoil-deposit,0);

7. Goto 1.

Repeat this for millions of drops.

The erosion and deposit steps (4 and 6 above) simulate the water flowing down hill, picking up and depositing soil as it goes.

To add some wind erosion you can smooth the height array every few thousand rain drops. I use a simple convolution blur every 5000 rain drops. This smooths the terrain out a little bit and can be thought of as wind smoothing the jagged edges of the terrain down a bit.

Erosion Movie

Here is a sample movie of the erosion process. This is a 13,500 frame 4K resolution movie. Each frame covers 10,000 virtual raindrops being dropped. This took days to render. 99% of the time is rendering the mesh with OpenGL. Simulating the raindrops is very fast.

and here are screenshots of every 2000th frame to show the erosion details more clearly.

Fractal Terrain

Fractal Terrain

Fractal Terrain

Fractal Terrain

Fractal Terrain

Fractal Terrain

Fractal Terrain

Fractal Terrain

Fractal Terrain

Fractal Terrain

Fractal Terrain

Fractal Terrain

Fractal Terrain

Fractal Terrain

Future ideas

The above is really just a quick experiment and I would like to spend more time on the more serious simulations of terrain generation and erosion. I have the book Texturing and Modeling, A Procedural Approach on my bookshelf and it contains many other terrain ideas.

Jason.

3 Years Of Softologyblog

3rd year anniversary

Today marks the 3rd anniversary of this blog. Over that time I hope it has been interesting for those who happen to check in and read it from time to time. When I started I wasn’t sure what the contents would be, but once you get blogging it all seems to flow.

I do recommend everyone try blogging. Pick whatever topic(s) you have a passion for and blog away. I tend to use mine as a journal of my ongoing progress with Visions Of Chaos with some interesting info for fellow nerds. It is always great when someone takes some info here, extends it and lets me know about it. That is the true shared knowledge power of the Internet at work.

Jason.