Parallel Lines using a Sine Node

Started by cyphyr, September 08, 2019, 12:50:00 PM

Previous topic - Next topic

cyphyr

This is a simple node graph to create Parallel Lines.

It can be sued to create any kind of repeating parallel feature such as waves along a shore, ripples in the sand or parallel cloud banks.
The raw output is very small, the distance between the peaks is approximately 6.35m (I have no idea why).
The output can be scaled, rotated and moved with a transform node.
You can replace the X to Scalar with a Y to scalar or Z to scalar to produce Parallel Lines in those axis.

If you disable the X to scalar you get concentric circles


I hesitated to post this because although it works I don't feel I have the maths knowledge to properly explain "why" it works.
Maybe someone with better knowledge in that department can jump in
www.richardfraservfx.com
https://www.facebook.com/RichardFraserVFX/
/|\

Ryzen 9 5950X OC@4Ghz, 64Gb (TG4 benchmark 4:13)

Hetzen

Thanks for posting this Richard.

I'll eventually get to the trig functions, but for now, if you want more control over the wave length, you can insert a multiply scalar after the X to Scalar to adjust the peaks.

Trig functions work in radians, so 2 x Pi x your X to Scalar will produce a full wave length across 1 meter.

N-drju

Thank you so much Richard! :D I've been looking for a way to set up some basic trigonometry in the TG scene! Sines and cosines being absolute basics.

Your example is very helpful and now I know what I have been missing. Converting a scalar to an "x" value now seems like something one would indeed do at the very start...

As to the "why it works" question (trigonometry-wise), I like to use this tool:

funct_vis.png

With the help of this visualiser, you can plan a function that you'd like to obtain in TG and then, little by little, translate it into blue nodes, the way you did!

And it doesn't really require that much of a mathematical knowledge either. All one has to do is to define a few values, and then pick a function from the "Keyboard" tab, where many such elements are listed.
"This year - a factory of semiconductors. Next year - a factory of whole conductors!"

Dune

Ah, that is interesting. Never really built maths like that in TG to obtain a certain curve. Thanks for the link.

N-drju

Come to think of it, one may also use this setup to make the plowed fields effect. You know, small, straight, undulating displacements.
"This year - a factory of semiconductors. Next year - a factory of whole conductors!"

Dune

I use that a lot; just x to scalar, divide by some value to get width of rows, sinus, possibly a rotation, and a fractal warp, masking some ground texture.

Hetzen

#6
You can also add some pinching to the peaks and widen the troughs to taste. The trig functions output -1 to 1. If you Add 1 and Multiply by 0.5 that range will become 0 to 1. Which is what a Bias or Gain node wants as an input. You can then vary the shape of the Cosine by adjusting the Bias or Gains second input. 0.5 is do nothing, towards 1 widens peaks and towards 0 flattens troughs.

I've attached my thoughts below.

Oshyan

I wonder if the Desmos graphing calculator (or another such free resource) would be a good addition to a general instruction/tools thread on function nodes somewhere in this forum area.

- Oshyan

Hetzen

Quote from: Oshyan on December 06, 2019, 03:37:47 PMI wonder if the Desmos graphing calculator (or another such free resource) would be a good addition to a general instruction/tools thread on function nodes somewhere in this forum area.

- Oshyan

Probably is, just inputting 'Cos X' is useful to see the shape.

Dune

Might be handy to have an offline graph visualising method too.

N-drju

#10
Quote from: Oshyan on December 06, 2019, 03:37:47 PMI wonder if the Desmos graphing calculator (or another such free resource) would be a good addition to a general instruction/tools thread on function nodes somewhere in this forum area.

- Oshyan

But then of course, we need a brief instruction on how such a graph could be translated into a textural/displacement TG representation. It's all just maths. :) Since we have divide, subtract and other operators, it's just a matter of putting them in the right order!


EDIT: Just checked the graph for "arctan 4x = 1.5 cos y". I don't really understand how it is calculated. But imagine if we could translate this shape into series of displacement! Wow...
"This year - a factory of semiconductors. Next year - a factory of whole conductors!"

WAS

Quote from: Oshyan on December 06, 2019, 03:37:47 PMI wonder if the Desmos graphing calculator (or another such free resource) would be a good addition to a general instruction/tools thread on function nodes somewhere in this forum area.

- Oshyan

That's a great idea, with a little documentation on how to convert some basic formulas into TG to get people start similar to what N-drju was mentioning.

Hetzen

You can also use the scene I used to generate a cosine curve in the explained series. Attached below.

Cosine_Test_Bed.JPG

Right click on the internal network of the Cosine Generator node and you can use that as a test bed to try out some translations.

WAS

Quote from: Hetzen on December 08, 2019, 02:33:02 PMYou can also use the scene I used to generate a cosine curve in the explained series. Attached below.

Cosine_Test_Bed.JPG

Right click on the internal network of the Cosine Generator node and you can use that as a test bed to try out some translations.

Oh wow that's a good in-house idea, Hetzen.

N-drju

Quote from: Hetzen on December 08, 2019, 02:33:02 PMYou can also use the scene I used to generate a cosine curve in the explained series. Attached below.

Cosine_Test_Bed.JPG

Right click on the internal network of the Cosine Generator node and you can use that as a test bed to try out some translations.

Now, the thing is that the waves cut through the "x" axis. Is it possible to elevate the entire equation so that it never takes on a negative "y" value?

For example, what would you say (and how would you build) the following function (or any simmilar) that essentially does exactly what is mentioned above?

nonegative.png
"This year - a factory of semiconductors. Next year - a factory of whole conductors!"