# How can I distort randomly generated lines along a pattern so that they flow around the bright areas of the pattern like a gravitational lens?

Day 4 of my personal Shader Nodes learning path.

Please forgive me if the title is worded a bit stupid. I still hope to add value to this platform and ask an interesting question.

Basically, this question is based on the following previously created questions:

...but with a completely different goal.

Let's say I have the following pattern, which I created using the question/answer posed earlier:

And in addition to that, I have created diagonal lines using a Noise Texture:

And now I would like to distort the lines so that they curve around the brighter areas. So to speak, to avoid this or to be distorted/pushed away by it, so something like this, only I imagine it to be much more intensive:

However, if I increase the amplitude of the sine waves on the basis of my current setup, discontinuities arise in the lines, since it is a matter of two functions working separately from each other that are pieced together.

As a reminder, this approach, no doubt bungled by me, is based on two such patterns, one of which is processed inverted:

It is clear to me that the previous approach is not correct for this, and that a completely different mechanism is needed here.

Only which one?

In this example, I am not necessarily concerned with representing exactly as I use it in my examples, but primarily with the question of how diagonally running lines can be bent in a wave-like manner around certain points. It should just look cool, because if it looks cool, it's right!

* In the section

Here is the node tree and blend file I use to create the examples shown above:

(Blender 3.4+)

After receiving some great guidance from @RobinBetts and @MarkusvonBroady on this question, I was able to solve this task to my satisfaction.

And the answer seems to be simpler than I originally thought.

Stupidly, my current knowledge of is not yet sufficient to describe it all with the quality you've come to expect from me on , but I'll post the answer in a nutshell:

Essentially, what I'm doing here is simply adding the value that results from multiplying sine and cosine to the x-axis of the vector for the noise texture.

This pattern looks like this:

And the end result is distorted diagonal curves:

Here is the blend file for it:

(Blender 3.4+)

• .. can't really improve on this answer, but this sort of approach might be of interest. I find it's often useful to think of a 2D texture as a height-map into, or a slice out of, a 3D texture. See here or here, for example. Thinking of your tone as a 'height' map, you can even explore using its gradient as a parameter, by putting it through Vector > Bump Commented May 31, 2023 at 10:00