Texture Perpedicular to SLOPE

Hello, i am searching for a way to keep my texture oriented PERPENDICULAR to slope (or paralel … depends how you describe it). Do not confuze it to “Slope DEPENDENT texture” … i saw many articles about it… Thank you Blender Comunity, but what i am looking for is a texture that automaticly alignes to Slope, while i am modeling.

The example is simple, i am modeling a roof, the Blue Slope is the same with the orientation of the Texture.
But the Red Slope is not auto orienting itself. How can i use the Cycles nodes in my favor to make it happen.

One work-arround is to make 2 separate materials with diferent orientation. But one month ago i had a complecated roof with 13 different orientations, so i had 13 materials … :((( … it was not fun at all.

Tx for your time, emilian.

This is something that should be addressed in the UV layout, not in the shader. You can align the faces to the tangent vector (the horizontal U axis), wich will work extremelly good.

Something could be done in the shader, but it involves some vector math to correctly calculate orientations, plus even more math to be able to control it correctly, and still won’t work in some cases.

I can think of a solution with vector mapping, but the thruth is that with UV you get it quicker and better

Here is a quick and dirty example: slope_based_rotation_with_scaling.blend (250 KB)

Obviously seams are still an issue. First rotate the coords around Z to have correct orientation (top of texture always points up), then rotate the coords around x to align with the slope (to remove scaling problems).

Also flat (perfect xy plane) surfaces create a funky radial blur effect full of artifacts in opengl material preview mode, but are fine in cycles.

EDIT: Updated example to correct for scale.
EDIT2: Forgot to remove the ABS node. Just pretend it’s not there in the screenshot.

This is it !
I entered Edit mode and when i reshape the roof with more random slopes the Texture updates in real time.
Thank you so much SynaGl0w :cool: