How does it work?

This is a little rundown of how the unicorns are created. It's still based on the previous version of the unicorns, but the basic ideas have not changed.

Different and identical

The problem to make the unicorns distinct, but create the same one when the same hash is given, is actually the easiest one to solve: The hash is just a number (given in hex) that is used to seed the random number generator. Nothing more. If you don't know what that means: Just believe me, it's not a big deal. It just leads to the same random numbers being generated if the same hash is given.

The background

Random color for the sky (with a gradient), random color for the ground, random placement of the horizon, random size and position of the rainbow.

That's it. We keep the background for later.

The basic shape

The basic shape of the unicorn is made of spheres in 3d space. I have created these from the picture of a horse or pony or unicorn (I don't even remember anymore). Anyhow, it's just position and radius for simple spheres, and possibly additional connection information.

For example, the unicorn's face is the connection between the snout (sphere) and the head (sphere). The size of the spheres and the lengths and angles of some connections are chosen randomly, so sometimes we have a long cylindrical face, and sometimes a short and cone-shaped one.

Looks pretty weird, doesn't it? With some color, it starts to make a little sense:

The wavyness of the hair results from the connections not being drawn in straight lines, but following exponential curves with random exponents. The base colors are chosen randomly, with different lightness values for different parts (e.g. the snout sphere has the same hue and saturation as the head sphere, but a different lightness).

Three dimensions

Now we rotate the unicorn around the vertical and horizontal axis. The rotation angles are chosen randomly (although within a certain range; we don't want to see just the unicorns rear end). We also scale the unicorn by a random amount, so that sometimes we see the full animal, sometimes just the head. In this expample, it looks like this:

And behold …

Put the resulting unicorn onto our background, and we're done: