Over the last two Christmas seasons, I've been playing with algorithmically generating and 3D printing snowflakes. This Instructable begins with printing hints, and then discusses each of the three algorithms.

## Step 1: Printing Hints

**Material**

I've been using transparent PLA.

**Thickness**

Generating about 2mm thick snowflakes lets Christmas tree lights shine through them and produce nice visual effects. Any thinner, and it's going to be very hard to separate them from the bed.

**Slicing**

You might as well set 100% infill. These snowflakes don't use much filament.

Ideally, you'll want to preview the sliced layers on the flakes with more delicate tendrils to make sure they are properly connected. I use Repetier Host's print preview and look at the first two layers. Don't worry if the first layer has some disconnected pieces as long as they get connected on the second layer.

**Removal from bed**

The higher resolution flakes can have very delicate tendrils and are difficult to remove from the bed.

First use a razor blade all around to lift up the outer edges.

Then use the razor to hold up an outer edge, and slide a larger spatula under one of the arms of the flake. I use the corner of the spatula, and push it gently along the thickest part of the arm, and then wiggle it to the left and the right to get the thinner branches sticking out of the arm. The trick to avoiding breakage is to peel as much as possible starting from the thicker branches and then moving outward. If you can get the spatula to the center of the flake without breaking anything, then you can peel the other arms starting from the center and going to the periphery.

**Repair**

If you break a piece, you have two choices. All these snowflakes have 12-fold symmetry. So, if you break one piece, you can just break off the 11 other copies of the same piece, and the snowflake might still look great.

The other option is to glue it or weld it. The one time I did that, I used a soldering station set to about 250C to melt the broken piece and the main piece and then stuck them together.

## Step 2: Binary Cellular Automaton

All the three algorithms I am using work on a hexagonal grid. Only 1/12th of the grid is simulated in order to enforce symmetry (with reflection/rotation used to get the rest of the grid). Each algorithm has a randomized and a deterministic version.

**TL;DR****version**: The binary cellular automaton makes fast, easy to print but less realistic snowflakes. To play with it, go to my Thingiverse page for this and click on the Customizer.

The simplest algorithm is a binary cellular automaton: each cell of the grid is either filled (1) or empty (0). The automaton starts with the center cell filled, and then follows rules. There are two kinds of rules. Generation rules specify the conditions under which an empty cell gets filled, and survival rules specify the conditions under which a filled cell stays filled. Each rule is specified in terms of the number of neighbors of the cell.

The snowflakes from this algorithm print very nicely and because they tend to have a low hex resolution, they are easier to peel off the bed. But they don't look all that realistic.

Stephen Wolfram proposed a rule set where a cell gets filled if it has exactly one filled neighbor (generation) and cells always stay filled once filled (survival). The video above shows the growth of a snowflake with this rule set.

You can also add probabilities to the rules. For instance, one of my favorite variations, which produces more realistic looking snowflakes, gives a cell only a 50% chance of being filled if it has exactly one filled neighbor in each step of the algorithm. This seems to make the snowflake grow more outward-pointing arms.

You specify the rules by giving a sequence of seven numbers between 0 and 1 that specify the probability of the cell being filled given a particular number of cells. For instance, the generation rule 0,0.5,0,0.1,0,0,1 says that an empty cell with one neighbor has a 50% chance of being filled, an empty cell with three neighbors has a 10% chance of being filled and an empty cell with six neighbors has a 100% chance of being filled.

You can download or generate STL files from my Thingiverse page for this simulator. Click on Customizer to play with different parameters.

## Step 3: Reiter Algorithm

**TL;DR version**: The Reiter algorithm produces a good balance of realism, generation speed and printability. To play with it, go to my Thingiverse page for it and click on the Customizer.

The remaining two algorithms keep track of real-valued numbers, and not just zeroes and ones. The algorithm by the mathematician Clifford Reiter keeps track of how much H2O is found in any given hex, and once the amount reaches a certain amount, the cell counts as frozen. There are three main parameters, alpha, beta and gamma, that are described in Reiter's paper, plus I added some random beta and gamma variation that you can use to add some randomness.

## Step 4: Gravner-Griffeath

**TL;DR version:** The Gravner-Griffeath algorithm produces highly realistic, harder to print snowflakes and uses a lot of computation time. You can browse Martin Krzywinski's precomputed collection here, and click on his STL generation links to my Javascript page that generates 3D-printable versions.

The most realistic 2D hex algorithm I know of is by Gravner and Griffeath. It keeps separate track of the amount of ice, water and vapor in each hex and has many customizable parameters described in their paper. I first wrote some Python code to run the simulation and generate 3D-printable STL files. But the code was slow (four minutes per snowflake) and there are so many parameters to tweak.

Fortunately, Martin Krzywinski has computed many Gravner-Griffeath snowflakes already and put them on a gorgeous website. The snowflakes all have computer-generated names, and I made a Javascript page where you can put in the name of a snowflake, and the page will pull in the data from Krzywinski's website and generate an STL file. When I told him about my page, he then added links to my page from all his snowflakes.

So, now, you can just browse his website and if you like a snowflake, you can click on "Generate STL file for 3D printing" and you'll go to my page that generates the STL.

You can play with tweaking various parameters. If you set Levels to 1, you get a uniform-thickness snowflake. If you set levels to a larger number, like 8-10, you will get a variable-thickness snowflake, with thickness determined by the amount of ice in a cell.

Some of the Gravner-Griffeath flakes have delicate features that may be hard to separate from a printer bed, so I added a widening parameter. This adds extra cells around the original cells. The default is 1: each original cell is surrounded by an extra layer of cells. If your slicing software preview shows areas that are disconnected or barely connected, you may want to increase this. On the other hand, you can also decrease it.

The STL files generated by this are very large. You can reduce the resolution if you wish.

## Discussions

2 months ago

These are great snowflake designs :)