Clusters and Particle Life

This is another great example of emergence. Complex behavior results from many individual particles following simple rules.

Jeffrey Ventrella explains his Clusters here.

Here is another particle based life model

I learned about Clusters when Code Parade posted the following video explaining his version of Clusters he calls Particle Life.

The source code to Particle Life was generously shared here so I had a go at converting the code and playing with these myself.

Results

Here are some of my results.

Extension Into 3D

Once I had the 2D version working, extending into 3D was the next step. These movie parts use the same settings as in the 2D movie above.

Availability

Both the 2D and 3D Particle Life are now included with Visions of Chaos.

Jason.

Spring Pendulums

In the past I have done some explorations with double, triple and quadruple pendulums.

Thanks to √Čtienne Jacob‘s twitter post here and the source code he generously shared I was able to have a go at spring pendulums.

Spring pendulums are similar to the previous double, triple and quadruple pendulums, but the fixed length pendulum arms are replaced with springs. This leads to more complex plots.

Here are some examples of a double, triple and quadruple spring pendulum.

To make the plots a little clearer, here they are again with only the pendulum end points being traced.

Spring pendulums are now included with the latest version of Visions of Chaos.

Jason.

Indexed Totalistic Cellular Automata

Inspiration

This new form of Cellular Automata (at least they are new to me) came from a Tumblr post from Neil Makes Games (@NKnauth on Twitter). His post refers to @LorenSchmidt on Twitter, but I could not find the original post. There is enough info in Neil’s post to let me implement and experiment with these CAs.

Due to lack of a name and because I made some changes to the implementation I called them “Indexed Totalistic Cellular Automata”. The rule is totalistic in that it uses the total counts of neighbor cells to determine the new cell state, and the state counts act as an index into the rule array.

Define the rule

The rule for these CAs are based on a 2D rule table like the following.

Indexed Totalistic Cellular Automaton

The table is mapped to a 9×9 2D rule array of integers. That covers all possible state 1 and state 2 cell counts. There is no “fade out” or “die off” period where cells that “die” go into a semi-dead state before fully dying. All cell updates are based solely on the rule table.

Filling the grid array

The original used values between 1 and 3 to fill the grid. I use between 0 and 3. The different results of including and excluding the 0 are outlined below.

Processing the grid each step

Count the state 1 and state 2 cells in the immediate 8 cell Moore Neighborhood.

Use the state 1 and state 2 counts as an index into the rule array, ie result=rule[state1count,state2count]

If the result is 3 then the cell remains the same. If the result is 1 or 2 then the cell becomes 1 or 2. In the original CA there is no state 0 in the rule array, but I added it in so that if the result is 0 the cell becomes empty.

Results

From an initial experiment with these I have seen some interesting results. Click the following images to see an animated gif of the CAs.

There are many unique gliders.

Indexed Totalistic Cellular Automaton

And this fireworks doily like display

Indexed Totalistic Cellular Automaton

Extending the neighborhood size

I also played with extending the Moore Neighborhood to all cells within 2 grid distances (total of 24 possible neighbors).

Indexed Totalistic Cellular Automaton

The extended neighborhood tends to give more blobbly amoeba results. Although I have only started to experiment with these CAs so more unique outcomes should hopefully pop up in the future.

Indexed Totalistic Cellular Automaton

Indexed Totalistic Cellular Automaton

Extending to three dimensions

I did some tests with extending into 3D. 26 neighbors per cell. No results worth posting yet. I will update if I find any interesting results in 3D.

Availability

These new CAs are now included with Visions of Chaos. If you do find any new interesting rules, let me know.

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.

Venus Transit footage from SDO

Here is an awesome movie showing the transit of Venus yesterday.

Watch in highest def possible full screen.

More info about the movie with higher resolution movies and images to download here.

Thanks to The Bad Astronomer for the link. I knew that Phil would find the best example of the transit after it was all over and he didn’t let us down.

Jason.