Crosshatching with Eevee
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!)
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
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.
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.
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
I had time to test the shader and see if i could mix it with the principled one and it works BUT only in eevee, can you tell me what i should do to use the effect in cycles ?
I was also interested to achieve the same result with shadows, any idea how to achieve it in eevee\cycles ?
Hi, it should mostly work. However since it’s using shader-to-rgb, the results of the diffuse shader from Cycles might be different from Eevee. You might have to tweak the shader, the lights or the result of shader-to-rgb. For shadows, the process is similar. Check out the “Floor” material in the blend file, play with the colorramp coming out of the shader-to-rgb node. You can use it as a mask for shadows (using a thick crosshatch).
Thank you a lot, i’m not an expert in shading so i need as much help as i can get, i’m trying to develop a personal visual style and your approach seems perfect for me.
I will try when i have time, sorry for being annoying, i really want to get this work; thank you again.
Hey, no problem! Lookin forward to check out your style in the future
Damn i asked on the blender artist forum if the shader to RGB node was in any way usable in cycles but it seems to be eevee only, at this point i either use eevee for my projects with a NPR style or the development team make the node available for cycles.
Ah sorry, I gave it a quick look and thought it was somehow working. Turns out it’s outputting pure grey :/ It’s probably not possible to capture the output of BSDFs in Cycles, since it’s a raytracer. You could still use both engines and composite the result, but it’s probably not worth the extra work.
maybe use some noise to blend it all randomly ?
Do you mean having noise added to the factor of the mix nodes?