The hatching I use in 1PDG is my attempt to reproduce Dyson hatching. Dyson hatching is a common name of a shading method which is very widely used in dungeon maps, but not much anywhere else as far as I know. Dyson hatching is named after Dyson Logos, the inventor (or a popularizer?) of this style.
Here is a link to the tutorial by Dyson himself on how to draw this type of hatching by hand. The idea is to draw sets of three short strokes "pushing" each next set against previous ones. How it could be translated into an algorithm?
First, let's try to draw an arbitrary number of these sets of strokes (I call them clusters) at random locations and random angles.
What's wrong with this result? Two most obvious things:
- Some clusters overlap and cross each other.
- There are empty areas, which should be filled.
We can't fix these issues by adjusting the number of clusters: more clusters would lead to more overlapping, fewer clusters would produce more empty areas. We need a different distribution for clusters.
So now let's try Poisson disk sampling. Poisson disk sampling is a distribution of points where any two points are not closer to each other than a certain limit. If we set this limit to the size of a cluster (right now all clusters are of the same size), clusters won't overlap.
This is much better and actually it's pretty close to how the hatching is implemented in 1PDG. But:
- Some lines still overlap. It happens because we treat clusters as circles while in reality they are more like squares. I think it may be ignored.
- There are still gaps between some clusters. Poisson disk sampling doesn't produce tightly packed circles, the distance between any two points is always slightly bigger than that limit parameter.
We can address the second issue by scaling up a cluster by increasing the length of its strokes and the distance between them. It is safe to make its "diameter" equal to the distance between the center of this cluster and the center of the closest one.
Now we get more crossed lines, but in my opinion the overall effect is better.
That's all, that's how Dyson hatching is implemented in 1PDG. I also tried to improve angles to get fewer neighbouring clusters with (almost) parallel strokes, but now I see that my method doesn't produce much difference, so I'm not going to describe it here.
It is still possible to make the hatching look better "cosmetically". In my opinion imperfections are less visible with smaller clusters and relatively thick strokes. In 1PDG I draw strokes not like plain lines, but like actual strokes - slightly curved and a bit thicker in the middle shapes. This makes the hatching more "casual" and its defects kind of more forgivable.
Here are variants with 2 and 4 strokes per cluster:
And finally an example of "dynamic" hatching - how a "cave painter" could look: