I've already mentioned Jared Tarbell in this text, but I will mention him once more still. One of the first pieces of generative art I ever saw, and took notice of, was Tarbell's Substrate. It's a genius algorithm in all it's simplicity: Lines grow in a particular direction until they reach the boundary of the domain, or until they collide with another line. When a line stops, at least one new line is spawned perpendicularly off of one of the existing lines at an arbitrary position.
Recreating the city-like structures of Substrate is an interesting exercise in itself. However I wanted to combine (some of) the behaviour of Substrate with other features of the previously mentioned leaf venation algorithm. The goal was to mimic the fracturing patterns that occur in brittle materials like glass or porcelain. You might have seen this yourself if you've been unfortunate enough to drop your mobile phone, or if you own some old tableware. When related to (among other things) paintings these patterns are referred to as Craquelure.
Similar to the method used in the leaf venation algorithm we distribute a number of sources into the domain. We then start any number of seed fractures. The following growth steps of these fractures are controlled in the following way:
- Find all sources within a fracture's field of vision (FOV). Varying the field of vision will yield very different results; greater FOV results in more meandering.
- Calculate the (mass) centre of the sources in the FOV.
- Take a step towards the mass centre.
- We terminate the fracture if it has collided with an existing fracture, or if there are no sources in the FOV.
In addition to controlling the growth of the fractures, we need to add new fractures. The strategy used in the images displayed here is to randomly spawn new fractures from the tip of the fractures that are currently active (i.e. have not yet collided with anything). Yet again the frequency of new fractures will have a major impact on the final result.
If you have ever seen a broken phone screen you might have noticed that the fractures are rarely uniformly distributed: the density of fractures tends to be greater near the point of impact. In order to fake this effect you can introduce a fracturing speed. As a fracture grows the speed is gradually reduced. When a fracture is spawned, it inherits a ratio (e.g. 0.8) of it's parent's current speed. In this case the fracturing speed is not used to control the rate of growth, but rather the rate of spawned new fractures. The effect looks like in the following image.