Basic sine wave displacement

Started by sboerner, September 25, 2020, 10:23:30 PM

Previous topic - Next topic

sboerner

A very basic utility clip that I use a lot. Good for making waves in water or sand. Thought it might be useful, or a simple introduction to blue nodes for new users.

KlausK

Thank you!

I started a thread here: Using the Basic Sine Wave Displacement tgc by sboerner
with an example of how to use the tgc.

CHeers, Klaus
/ ASUS WS Mainboard / Dual XEON E5-2640v3 / 64GB RAM / NVIDIA GeForce GTX 1070 TI / Win7 Ultimate . . . still (||-:-||)

Dune

What I like to know is how one can increase the distance between 2 sinus waves, that's something that has eluded me for years. Not the frequency. So wave.....wave.....wave....

WAS

Quote from: Dune on September 26, 2020, 11:15:35 AMWhat I like to know is how one can increase the distance between 2 sinus waves, that's something that has eluded me for years. Not the frequency. So wave.....wave.....wave....
That's a good question. If there was a Soft conditional scalar, this would probably be easy by simply canceling out the sine waves by whatever formula you want like "X % 3" if 0 no sine, else do sine sorta deal. A soft conditional (Where whatever it effect has a smooth zone) could be used for a lot.

Dune

Richard's suggestion of using a smooth maximum works to flatten out the negative part of the wave... but not always! Depends on the setup. A multiply by a larger sine could work, where the postive sine allows a number of small sinuses, but that needs some sort of hardening or they gradually fade in and out, and the phase must be a whole number, sort of.

WAS

#5
Quote from: Dune on October 12, 2020, 01:24:30 AMRichard's suggestion of using a smooth maximum works to flatten out the negative part of the wave... but not always! Depends on the setup. A multiply by a larger sine could work, where the postive sine allows a number of small sinuses, but that needs some sort of hardening or they gradually fade in and out, and the phase must be a whole number, sort of.

I suppose if you match the frequency in the larger one, you could mask out varied sinus without too much trouble. You'll have to turn off coverage masking in a surface layer or it will clamp the child input.

Dune

Yes, the clamping is something to take care of, but you also need to clamp the low end, or the negative large phase sinuses will enhance (instead of annihilate) the small phase sinuses.

WAS

Yeah you would have to have the line sinus soft to its maximum, and clamp the floor as well. This would limit the floor range though, but for waves I think would be acceptable.

Dune

Btw, the setup you illustrated above will work with a constant range, but not when it's biased (more waves towards coast). Too bad, actually. I think an irregular sine wave would be interesiting, some small, some big, some wider apart. Might not even be too hard....

WAS

Yeah the bias scalar seems to clamp the range. It doesn't work on displacement that has scalar ranges beyond 0-1. Wonder why.

Dune

Noticed that too, so bias isn't always helpful.

Hetzen

Quote from: Dune on October 22, 2020, 01:57:05 AMNoticed that too, so bias isn't always helpful.
Yes it is. A sine wave goes from -1 to 1. To make that 0 to 1, you add 1 and multiply by 0.5.

Dune

Mmm, interesting. Have to try that. Thanks Jon. Sometimes the logic of math fleets past me :P

WAS

#13
Quote from: Hetzen on October 22, 2020, 08:12:38 AM
Quote from: Dune on October 22, 2020, 01:57:05 AMNoticed that too, so bias isn't always helpful.
Yes it is. A sine wave goes from -1 to 1. To make that 0 to 1, you add 1 and multiply by 0.5.

Wouldn't the bias be clamping, though, so the actual data is lost, and adding/multiplying only effecting what is visible between 0-1?

Also, gamma is a similar effect in the colour adjust shader, and isn't clamped.

Too bad this shader didn't have scalar inputs for it's settings though for use in configurable shaders.