Crosshatching with Eevee

27.09.2018 @ Art(Blender, Eevee, Materials)

Blender 2.8 isn’t even Beta and it already has me hooked! Eevee will (IMHO) open the floodgates for NPR and all kinds of cool styles. This time I worked on a cross hatching material.

The technique is based on this paper from Princeton/Microsoft Research. The gist of it is making several textures to represent the different levels of shading and map them to the lighting in the object. Well, guess who has a shader-to-rgb node now? We can grab the illumination data from a diffuse or glossy BSDF, plug into several colorramp nodes and get masks for each step. I changed one thing from the paper though. In the paper they use textures that have the cross hatching already combined and then mix them. I think keeping them separated and multiplying them in a mix node is more efficient/flexible for Eevee.

I hope you like UV unwrapping :). You will need it to make the lines flow in a uniform way. Other texture coordinates can cause strange or unrealistic results. There is one exception though. Large flat areas that are on grazing angles to the camera look weird, like a blurred mid-90s repeating texture. I haven’t found a good solution yet. One way is to use the Window texture coordinates. But these bring a different problem: they look awful the moment you move the camera and make the objects flatter.

Don’t forget to scale UVs properly to make the lines have roughly the same size. Also, since this effect depends on colorramp-ing the diffuse shader it’s a little illumination specific. Particularly in high-contrast places. You can see for yourself by moving the sun in the blend file and watching the effect on the shadows in the walls.

Subtle paper textures really help sell the effect. You can grab some at Pixabay or Lost&Taken. Since the textures are black and white you can take the render and multiply it on top of the texture. Another important part of the effect is using masks and leaving empty spaces to suggest details. Even more so if you are repeating the textures a lot, since the repetition will look artificial.

Speaking of textures. They are very easy to make using Krita’s wrap mode (press w). Just grab a good brush and start making horizontal lines, then make another layer and make some more lines in other places. Repeat to get three horizontal layers. Then do the same for the three verticals and export each layer as a separate PNG file. For these textures I used the ink-7-Brush Rough brush and drew the lines freehand.I also have another set of textures I made with the Basic-5 brush and the line tool. These look more clean and organized, but I kinda like the rough look better. 

When making your own textures keep in mind it’s important to keep the thickness and spacing of the strokes even. Otherwise you can create local details that will show up when repeating the texture and ruin the effect. You can zoom out while in wrap mode to check this.

You can download the blend, textures and the source krita file. The whole thing is CC-0 so feel free to use it for anything without attribution.
(I wouldn’t mind a link back though!)

All the posts you can read

4 Comments

  1. Iraito(1 week ago)

    Really interesting, i will mess with it in the future, would you say that this technique is good to get results similar to this ? https://www.youtube.com/watch?v=-cw2gXq83n8

    1. januz(1 week ago)

      Hi! Yeah, you could mix those crosshatch textures into others to create a similar effect to what they show on the 4:38 mark. For the outlines you would have to use freestyle.

  2. Gareth(1 week ago)

    That sounds very interesting. Will look at the blend file. I wonder if we can replace the manual textures with algorithmic textures? This might make things a lot simpler, especially when it comes to UV unwrapping and scaling.

    1. januz(2 days ago)

      Hi, I think the only way to do something like with procedurals would be using OSL or some custom shader to generate the whole texture. You could pick random points and paint lines from them. The main problem would how to distribute those points in a random-but-still-regular sort of way. Otherwise you would have lines crumpling together

Leave a Reply

Your email address will not be published.