5
$\begingroup$

I have a sculpted mesh that looks something like this: mesh example (the colors are indicating the height)

And I'm trying to make a striped texture (black and white), where the stripes should be aligned with the slope of the mesh. Like this: striped mesh example

I would like to do this procedurally because the actual mesh is full of these slopes, but I'm not managing to get anywhere near the desired texture.

Is it possible to do this using only the cycles material? The result don't need to be perfect along the top, because there is another shader acting on the ridges. The accuracy on the slopes and on the valleys is more important.

Thanks!

ps: the texture will be used as a factor for mixing shaders.

EDIT:

I think I'm getting closer. I managed do make the stripes perpendicular to the slopes (I needed them to be parallel 😓). At least now looks like it's possible to achieve the desired distortion. enter image description here

$\endgroup$
  • 3
    $\begingroup$ I don't think that this could be achieved only in Cycles. Look here: blender.stackexchange.com/questions/72011/… This one came to my mind. Probably you will need to use Python coding here as well. $\endgroup$ – cgslav Oct 25 '17 at 20:11
  • $\begingroup$ Thanks! I had seen this, but I thought that my problem would be simpler since the stripes I need are quite regular and I don't care too much about making it perfectly seamless. If no better better solution arises, I'll definitely try this approach. $\endgroup$ – rodrigoaltieri Oct 25 '17 at 20:21
  • $\begingroup$ With this example it would be pretty simple to make but for complicated mesh you will need to have a script detecting intersections (from highest points) and from there directions for stripes. I guess. $\endgroup$ – cgslav Oct 25 '17 at 20:49
  • $\begingroup$ I just made some progress and edited the question. $\endgroup$ – rodrigoaltieri Oct 26 '17 at 0:25
1
$\begingroup$

I did now a little bit of work on that problem. I didn't get it perfect but it's pretty good I think so I wanted to share it. My attempt was to take the Normal of the currently rendering Pixel and calculate the slope 90° downwards from the normal (that's a tangent to the surface). My results with that are ok but not perfect because at the 3 edges of your model it will fail almost completly. I tried my best to counteract that with the Pointyness value and different direction of the tangent and so on but nothing did quite work exactly like I wanted it. Here are the results:

enter image description here

enter image description here

You can see how perfect it works an that planes. The stripes are always downwards, no matter how its rotated.

$\endgroup$
  • $\begingroup$ Please add some further explanation as to how you’ve achieved this. $\endgroup$ – Rich Sedman Oct 26 '17 at 12:24
  • $\begingroup$ Nice work! I don't need them to be good at the top edges, but I need those stripes less distorted on the slopes. I'm messing around the file you attached to see if I can make them more straight. Also I'm trying to rotate by 90 degrees the coordinate system that is generating the stripes in the new image that I added to the question. Thanks for your help! $\endgroup$ – rodrigoaltieri Oct 26 '17 at 13:49
  • $\begingroup$ @RichSedman more information is in the blend file that I included $\endgroup$ – HenrikD Oct 26 '17 at 14:00
  • $\begingroup$ Thanks - I saw that but it was difficult to follow. I didn't understand some of what was in there - such as calculating the length of a Normal.... surely that will always be '1'? It's complicated and it would be helpful and more accessible if you could break it down a bit. $\endgroup$ – Rich Sedman Oct 26 '17 at 14:24
  • 1
    $\begingroup$ It would be best if you could include the screenshot of the node network in your answer and comment it a little. I think it can be optimized a lot. Generating the slope vectors is easy - it's cross product between normal and global Z vector, then cross product between the result and normal. The impossible part is choosing a subset of these slopes to form nice stripes. $\endgroup$ – Jaroslav Jerryno Novotny Oct 26 '17 at 19:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.