I came across this article about how to implement a crosshatch effect in WebGL to produce some non-photorealistic effects. Here’s the link to the article:
It turns out that it’s a simple technique. Once lighting is calculated, a fragment shader is used to draw the cross-hatch lines as the shadows get darker. So I created a simple demo in order to try it out. The following are a couple of screenshots taken from it.
In the first image, the model is rendered using a fragment shader implementing per-pixel lighting. In order to achieve the results shown in the second picture, the fragment shader is modified based on the position of the fragment being drawn, doing a bit of geometric calculation to detect whether or not it lies on a line. If so, the pixel is rendered as a black. Otherwise, it’s white.
The project name is Crosshatch Shaders and can be found in the examples/CrosshatchShaders directory.