2
$\begingroup$

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.

$\endgroup$

2 Answers 2

3
$\begingroup$

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

$\endgroup$
9
  • $\begingroup$ "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. $\endgroup$ May 30 at 9:25
  • $\begingroup$ @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. $\endgroup$
    – Robin Betts
    May 30 at 9:37
  • $\begingroup$ 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: streamable.com/i4ylpq then the mix node can be moved further left like so: 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" streamable.com/1qqrsj $\endgroup$ May 30 at 10:48
  • 1
    $\begingroup$ @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. $\endgroup$
    – Robin Betts
    May 30 at 11:01
  • $\begingroup$ 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! $\endgroup$
    – quellenform
    May 30 at 12:25
0
$\begingroup$

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

enter image description here

enter image description here

$\endgroup$
3
  • $\begingroup$ Ah, "node groups", great! What is that? ...never heard of it! :D ...no seriously, of course that would be a possibility, but I thought there might be a variant where I can reduce the redundancy even further. $\endgroup$
    – quellenform
    May 29 at 12:38
  • $\begingroup$ i don't no any other way, sorry $\endgroup$
    – Chris
    May 29 at 14:49
  • $\begingroup$ Thanks anyway @Chris, I'll just ask a better question next time ;-) $\endgroup$
    – quellenform
    May 29 at 14:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .