I have often wanted to create cross-hatching using the computer, since it is a favorite drawing technique. In the previous two parts of the Texture post series, I have described how it is possible to create speckles, mutually avoiding points in the tiled plane (like stippling patterns), create cells around each point, cleanly delineated using Voronoi tessellation, then construct crossfade mask sets for the cells, enabling you to place images within each cell to create arranged textures. This technique may be further exploited to create hatching patterns by expressing a hatching within each cell.
Speckle patterns are the key to arrangement in a random, pleasing pattern. And Voronoi tessellations are the key to providing a natural partitioning of the tiled plane into adjoining cells.
But what about the hatches themselves? What function makes them look best? What can be done with them?
The first thing is to control the crossfade amount. This is the amount of softness between the cells. With z-buffer cell merging, this creates a kind of interpenetration of hatches.
Next, we try changing the crossfade amount with linear additive cell merging. This creates a very pleasing regularity like rolling over clay with a roller with evenly spaced ridges, but with different angles in different places.
In fact, the last one is so convincing that we try it with different hatch spacings. Awesome regularity of the pattern quickly becomes chaos. Because we are using hatches that are regularly spaced with different angles, we end up with extremely band-limited results.
It's as if we applied a notch filter to some random texture! But this is not produced using Fourier transforms or notch (combined lowpass and highpass) filters. It is straight linear synthesis.
Also, it's tough to make pleasing hatches that satisfy the eye. This is done by assigning random angles to each of the cells, but looking at the neighbors and trying to not match the neighbors' angles. In fact, once we see the neighbors' angles, we look for the biggest gap and simply bisect that angular gap to create the angle for our cell. It makes for a pretty random-looking result. Pure randomness would not look as random, oddly enough.
If we restrict ourselves to only put out one hatch per cell, then we get a curious pattern of random sticks.
We can vary the number of hatches that occur inside each cell. If we increase the crossfade to a large amount and increase the spacing to a similarly large amount, we get a really complicated mesh of sticks strewn into a pile.
Cut down on the spacing and we end up with a very complex fibrous structure not unlike a kind of matting.
It is very satisfying to see the range of cool patterns that can result from hatching. Other patterns will probably be even more interesting inside crossfade masks.
So now we have a way of making stippling patterns, hatching patterns, and cellular patterns. And we have found that combining the techniques can lead us to incredible texture synthesis possibilities.
I want to end this post with a really interesting texture I created today, using Fourier synthesis. The original source was a hatching, derived from linear additive cell merging with an incredibly large crossfade, and then processed with a notch filter. Finally, I viewed magnitude and changed the edge of the filter to provide some interesting shines in between the main convolutions of the pattern. The result is dark and visceral, like something from H. R. Giger. Enjoy!