Cross Hatching Shader

Disclaimer: I’m a total newbie when it comes to shaders, materials in the Unreal engine, so please forgive misunderstandings/errors.

I am trying to create a cross hatching shader effect based on light as seen in this example:

Now I know the process should be something like this in UDK:

But Unreal Engine 4 does not seem to have the CUSTOM lighting nodes on materials so now I am stuck again.

I read somewhere that I should do it in Post processing, but as I am a total noob… i cant even figure out how that would work. If anyone feels like helping a beginner i would totally appreciate it.

In UE4 You have no access to LightVector inside Material that are not Lights.
I’ll try to experiment with it, there should be some hack (better than pointing to light actors).

Hey, I’m also trying to do the same thing. What I’ve tried so far is getting the light vector manually from the primary light actor as a vector parameter… but this approach will require you to manually manage the light vector, which could be a pain depending on your scene. Another way is to try to compare the differences between the SceneTexture:BaseColor and SceneTexture:SceneColor in your post-process material, and try to derive the light intensity from there… This can give good result, but if your BaseColor is already fairly dark, it’ll be difficult to tell how much it has been darken…

If anyone has a better idea, please let share your thoughts.

Yep. I’ve tested on post process and it seems work. But. Since there is Exposure control feature it could be problematic without normalization.
And there is also some weird ghosting glitch appeared. -_-

Hey thanks :slight_smile: that seems like an idea to start with. I am mostly using paper as a base colour, so pretty light (mostly white), so most of my shadows will be hatch shaded i guess.

I am mostly an animation artist, so for me the step into unreal is pretty recent. Which node would i use to compare the BaseCOLOR with the SceneColor? a DOT? could you post visual of a rough setup? anyway Ill start and figure it out by myself today first:) but any help would be great

hmm… im not getting anywhere today. Ill continue in the weekend… lets hope I have something at the end of the weekend

You can use SceneColor settings (like specular, diffuse) to switch between effects.
I’ve made a simple example.

That is a great starting point. Thank you!

hatch continued

Hey thanks thats a great starting point. indeed! How would I be able to add more shades? like different types of hatchings per blackness value?

I’m trying to get the highlighted parts pure white and the parts that are now completely black should be hatched in different intensities based on the light value… aarg. I am such a beginner. Thanks for all the help allready.

best example of what I am trying to achieve is this:

(I like the customisability in this, check it out!)

You can use multiple bias scalings / clamps to gradually lerp different hatching textures based on one greyscale mask.

Here’s a post-process example for 3 textures:

You can do the same on a material/object level, the important part of the material is where the mask output splits up for multiple Lerps.

Duh, I’ve wrote ‘BaseColor’ instead of ‘Scene Color’, dumb…

Nice shader!

Hi, I know this is an old thread, but I was wondering the layering thing, , where should i put that? It seems in the post-process i can’t use scenecolor anymore.

I would love some help with it. Thanks!

Sorry for noob post; really slowly going into post-process and material function.

@Superxcm Its been a while but hey… I was also trying the same thing. Here is the answer. In short, it does not work anymore because the engine disabled it a wile ago.