# Hatching shader that conforms to terrain elevation

Hey everyone and thank you for checking this question out :)

I'm trying to come up with a stylized shader for a mountainous landscape. Basically, it's kind of like an elevation line shader, but the lines themselves should be perpendicular to how they would normally be with this type of shader. They would connect the ridges of the mountains with the valleys instead of just flowing along at certain elevation points.

Here's an example image I found online that's close to what I have in mind:

I'm really hoping to avoid UV mapping and texture painting since this terrain is massive, and I need to switch between large "aerial" type shots and "on-the-ground" close-ups. I've tried to get this to work by taking the normals and the default XYZ axis through some vector math nodes, but I can't figure out how to get the lines to follow the terrain.

Any help is greatly appreciated! :)

Working entirely in World Space..

• The cross-product of local Normal with 'Up', will give you a vector across the principal slope.
• The cross-product of that, back with the Normal, will give you a vector straight down the principal slope
• The dot-product of Position with each of those, normalized, measures Position along those axes.

The resulting X and Y can be used as the basis for a 2D texture. Here, the texture is 2D Noise, non-uniformly scaled:

Some variation on this method might work with your landscape?

• Hey man, thanks for taking the time to look into this! Sadly this tends to break down the more geometry/smoothing I add, so it's not really a solution. :(
– inx
Commented Feb 22 at 16:33
• Okydoky.. ... hence my hesitation.. Your illustraion's hatching depends on large facets, or at least, the illusion of them. There may well be a way of transferring the texture-space from a faceted version to your smoothed version, if that's of any interest. Perhaps share a chunk of your landscape Commented Feb 22 at 16:48