2

Day 3 of my Shader Nodes learning path. This question is a follow-up to these:

I now managed to create a wavy pattern where the added noise approximates the wave pattern:

Status quo

My next idea is now to repeat the pattern offset, so that the areas shown here in black are also filled with this pattern.

So I thought I would just invert the result of the wave pattern and put the noise there.

However, when I do this, the noise logically no longer matches the wave pattern, since the center of the wave is somewhere else, as you can see here:

Failed attempt

So now I just moved the base vector with $\pi$ and, and this is the problem, because I just can't think of anything better, duplicated a large part of the node tree ...which I personally don't like at all.

The result I currently achieve with this technique, or what I would like to achieve, looks like this:

This is how it should look
(Opposite wave pattern with stronger noise amplitudes)

I wonder if there is not a simplification of this approach.

Any ideas?

This is my current node tree and the corresponding blend file:

enter image description here
(Blender 3.4+)

Of course, some nodes can still be left out here, since some are used in both parts of the node tree, but the question is whether redundancy can be avoided in principle and structurally and performance can be increased. And unfortunately no: Node groups would not be the goal.

quellenform
  • 35,177
  • 10
  • 50
  • 133

2 Answers2

3

Nothing very clever mathematically, here, just restructuring.

Your shader depends on a 'ripple' mask, hidden in the Adds, Subtracts, and thresholds at their ends, to combine two branches with differently oriented noise textures. You can eliminate one branch by using the mask to control the orientation of the noise textures in the first place:

enter image description here

Robin Betts
  • 76,260
  • 8
  • 77
  • 190
  • "just restructuring" is pretty much what maths are all about :D. In maths, however, it's productive to show how to arrive at a solution: here changing the "add" near the end to a mix, using one of the "greater than" nodes as a binary factor. Then you can just look at which parts are shared by both branches, and move the mix node to the left, and remove the nodes that are no longer used. – Markus von Broady May 30 '23 at 09:25
  • @MarkusvonBroady ... Thanks! Phrased much better than I could, Go ahead and edit it in if you like. In the download, I isolated the masking (Mix > Fac) cluster into group, to make it a bit more explicit. Maybe should have illustrated with that. But I didn't want to use the group in the answer, lest I be accused of cheating :) I guess with a pencil and paper, you might be able to crunch the expression a bit further? But I doubt that would be very generally useful. – Robin Betts May 30 '23 at 09:37
  • Exactly, a little localized ;] I think a generalized version of some kind of "node maths" could be written, but that's a little bit over my head right now. A video example of what I mean: https://streamable.com/i4ylpq then the mix node can be moved further left like so: https://i.imgur.com/WJzE1W5.png but in this case the frame contents are so similar you only need to move the factor ("factoring out" has double meaning here) controlling cosine outside and you end up with the same contents of both frames" https://streamable.com/1qqrsj – Markus von Broady May 30 '23 at 10:48
  • 1
    @MarkusvonBroady :) Your procedure looks just like mine.. automatic re-linking is a real pain when editing trees... Alt-X 'delete unused nodes' quite handy for doing stuff like this. – Robin Betts May 30 '23 at 11:01
  • Dear Sir Robin, this is absolutely brilliant! Thank you very much for this enlightenment! I am so grateful to all of you for helping me understand this stuff better! – quellenform May 30 '23 at 12:25
  • But do I understand this correctly: So here you control the offset of the pattern (ripple mask) with a Mix node and thus achieve that the noise texture always gets the "centerline" of the wave as a base!!!? ...I still have a lot to learn here, and apparently I'm still so overwhelmed with Shader Nodes that I've already forgotten everything I learned with Geometry Nodes :D – quellenform May 30 '23 at 12:25
  • Hi, @quellenform! .. To be frank, I haven't really analysed the noise-pattern itself to the point of understanding ( I don't think that would be a very 'clean' internal image, anyway). All that's done, as Markus has said, is to notice you have 2 distinct branches, visually mixed with a mask. This rearrangement just uses the mask to set the distinction itself, making one of the branches redundant. – Robin Betts May 30 '23 at 13:03
  • As simple as this may seem to you experienced shader users, it is even more complicated for a beginner. And it's also good for me as a moderator to once again take the role of the naive answer-seeking user, to not only get to know certain parts of Blender better, but also this platform. ;-) – quellenform May 30 '23 at 13:09
  • @quellenform You often see someone using Mix Shader to mix, say, a red rough BSDF with a blue glossy BSDF, using a mask. But it's more economical to mix the red and blue, the rough and glossy, using the mask (or masks), and plug those mixed parameters into a single BSDF shader, if you can. This is sort of the same. – Robin Betts May 30 '23 at 13:25
0

i am not sure, but you know you can make node groups, don't you?

enter image description here

enter image description here

Chris
  • 59,454
  • 6
  • 30
  • 84