Title: **Parallel Lines using a Sine Node**

Post by:**cyphyr** on **September 08, 2019, 12:50:00 PM**

Post by:

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*

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

Title: **Re: Parallel Lines using a Sine Node**

Post by:**Hetzen** on **October 10, 2019, 11:25:19 AM**

Post by:

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.

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.

Title: **Re: Parallel Lines using a Sine Node**

Post by:**N-drju** on **December 03, 2019, 03:42:03 PM**

Post by:

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 (https://www.desmos.com/calculator) 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.

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 (https://www.desmos.com/calculator) 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.

Title: **Re: Parallel Lines using a Sine Node**

Post by:**Dune** on **December 04, 2019, 01:44:05 AM**

Post by:

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

Title: **Re: Parallel Lines using a Sine Node**

Post by:**N-drju** on **December 04, 2019, 03:05:37 AM**

Post by:

Come to think of it, one may also use this setup to make the plowed fields effect. You know, small, straight, undulating displacements.

Title: **Re: Parallel Lines using a Sine Node**

Post by:**Dune** on **December 04, 2019, 05:04:19 AM**

Post by:

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.

Title: **Re: Parallel Lines using a Sine Node**

Post by:**Hetzen** on **December 06, 2019, 12:08:27 PM**

Post by:

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.

I've attached my thoughts below.

Title: **Re: Parallel Lines using a Sine Node**

Post by:**Oshyan** on **December 06, 2019, 03:37:47 PM**

Post by:

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

- Oshyan

Title: **Re: Parallel Lines using a Sine Node**

Post by:**Hetzen** on **December 06, 2019, 04:21:42 PM**

Post by:

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.

Title: **Re: Parallel Lines using a Sine Node**

Post by:**Dune** on **December 07, 2019, 01:54:54 AM**

Post by:

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

Title: **Re: Parallel Lines using a Sine Node**

Post by:**N-drju** on **December 08, 2019, 03:45:48 AM**

Post by:

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...

Title: **Re: Parallel Lines using a Sine Node**

Post by:**WAS** on **December 08, 2019, 01:32:12 PM**

Post by:

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.

Title: **Re: Parallel Lines using a Sine Node**

Post by:**Hetzen** on **December 08, 2019, 02:33:02 PM**

Post by:

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.

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.

Title: **Re: Parallel Lines using a Sine Node**

Post by:**WAS** on **December 08, 2019, 06:23:38 PM**

Post by:

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.

Title: **Re: Parallel Lines using a Sine Node**

Post by:**N-drju** on **December 09, 2019, 04:29:46 AM**

Post by:

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 "

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

Title: **Re: Parallel Lines using a Sine Node**

Post by:**cyphyr** on **December 09, 2019, 05:11:56 AM**

Post by:

I would suggest that an add scalar after the last internal node with a value that matches the amplitude should do the trick :)

Title: **Re: Parallel Lines using a Sine Node**

Post by:**Hetzen** on **December 09, 2019, 08:47:36 AM**

Post by:

It's a bit of a hack on two displaced red planes, one to show the top and the other the underside. With a 10 meter grey plane at 0,0,0.

You can add what ever you like inside the node called 'Cosine Generator'. As Richard says by adding two at the end of the cosine calculation, that will indeed raise the red line above the X axis. You could just plug a PF in to the Main Input at the bottom to see how its colour displaces the red plane too.

You can add what ever you like inside the node called 'Cosine Generator'. As Richard says by adding two at the end of the cosine calculation, that will indeed raise the red line above the X axis. You could just plug a PF in to the Main Input at the bottom to see how its colour displaces the red plane too.

Title: **Re: Parallel Lines using a Sine Node**

Post by:**WAS** on **December 09, 2019, 09:36:01 AM**

Post by:

Quote from: N-drju on December 09, 2019, 04:29:46 AMQuote 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

Wouldn't that just be an equation that doesn't enter the negative realm?