Crosshatch Effects

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.

The model rendered using per-pixel lighting
Rendering with the crosshatch fragment shader

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.

A closer look

The project name is Crosshatch Shaders and can be found in the examples/CrosshatchShaders directory.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.