Procedural shore foam preset (Sorta surf?)

Started by Hannes, March 09, 2022, 08:38:24 AM

Previous topic - Next topic

Hannes

Guys, I took a look at both of your scenes.
Jordan, I really like the tidied up stuff. No node mess until you open up the sphere's network. Cool.

But I found that there is a Multiply scalar that isn't plugged into anything. (See attached image). So actually the Shore precision multiplyer only goes into this "dead" Multiply scalar, and so doesn't seem to have any function.
I tried to connect it to the Complement Water Level node below (without knowing why! It's just the closest node...), but then all the foam disappeared.
However, I tried to use 100 in the Water level Constant scalar, and the foam lines were about 100 times larger except the foam pattern (like in my previous attempts).

Ulco, your file almost worked. To make things simpler, I lowered the lake object to 0 instead of 1, and adjusted all the color adjust shaders by hand. I used my previous version for that and then added your Stretch Y-Transform shader and the Minus offset by water level surface layer.
As expected things stayed the same when I only connected the Minus offset... surface layer with the Connection-null shader (See "No stretch" screenshot).
But when I put your Stretch Y shader in between, all "foam rows" seem to be pushed away from the land (see "Stretch" screenshot).
I then used a Displacement offset of -0.8 instead of 0, and the foam rows were roughly where they should be. But that's of course not the desired effect.
Apart from that I realised, that the more I moved the water level away from 0, the more unexpected and incorrect the result was. At a level of 300 the foam didn't match the shoreline anymore.

I didn't expect, that this is so tough!!!
Anyway, thanks a lot for your tips!! Maybe you'll have some more? ;)

WAS

I don't know why TG has such a hard time with internal node networks now. I can't even load the terracing function, and other stuff without fixing them every time. Something is messed up with internal node networks.

The precision modulator may help with some of the issues when your water level is high.

The issue is we are basing on a scalar, so it's pretty dependant on a slice of that data where we applied all the adjustments. When you Y stretch, stuff you want to interpret as depth and not effected by waves, will now be in range of all the masking, do you end up with a huge area effected. 

I'd really look into just offsetting your whole world. It's really meant for issues like this where your functions rely on alt 0.

Hannes

Quote from: WAS on March 10, 2022, 11:40:20 AMI'd really look into just offsetting your whole world. It's really meant for issues like this where your functions rely on alt 0.
Thanks Jordan, I'll do that for sure!

By the way, I continued playing with Ulco's file and found, that it works pretty good, when you're close to the origin (0,0,0). The more you go away from that, the more unpredictable the results are.

WAS

Also, Shore Precision is meant to be 1, it was an add scalar, so 0 was default, but it's not multiply, so 1 is default to keep base settings.

Then you can use positive integers to clamp in the shore precision, or negative to get it out further.

Quote from: Hannes on March 10, 2022, 11:53:59 AM
Quote from: WAS on March 10, 2022, 11:40:20 AMI'd really look into just offsetting your whole world. It's really meant for issues like this where your functions rely on alt 0.
Thanks Jordan, I'll do that for sure!
By the way, I continued playing with Ulco's file and found, that it works pretty good, when you're close to the origin (0,0,0). The more you go away from that, the more unpredictable the results are.


Probably because you're using the Compute Terrain, so the data is normalized along the spheroid (pointing along normal)

WAS

Here is a water level of 100, far from 0,0,0 on my function, with precision of 1. Seems to be working for me.

What I should do is add two precisions, negative, and positive.

Hannes

Quote from: WAS on March 10, 2022, 11:54:29 AMProbably because you're using the Compute Terrain, so the data is normalized along the spheroid (pointing along normal)
No, I didn't use the compute terrain at this moment.

However your idea of offsetting the whole world works great!!! Fantastic idea. I'd never thought of that.

Gonna test your new file right away! Thanks!

WAS

Yeah offsetting is probably the most hassle-free.

Here is a version 2. Basically with this one, you have control over the initial "slice" via precision start, and end. So it doesn't reall matter what elevation you are at, you can use the precision settings to dial in the area.

Hannes

Quote from: WAS on March 10, 2022, 12:03:20 PMHere is a water level of 100, far from 0,0,0 on my function, with precision of 1. Seems to be working for me.
Yes, it works indeed. But since you're using a sphere (that's at least what I think), everything gets larger, the higher the level is. Like the image on a half inflated balloon. The more you inflate it, the larger the image gets. So at level 0 I have a foam area of a few meters, and at a level of 300 the area is a few hundred meters wide.

WAS

It shouldn't be getting larger. It's all working off the same terrain and masking. I think that just has to do with the terrain shape and depth. More slope, more your masks will be pushed away from each other (think contour shader).

I'm not sure you can defeat that without turning all the colour adjusts into smooth step scalars and using constant scalars that math each other to scale according to the water level.Thinking about how to do that makes my brain freeze so I'm not sure I have the solution to that aspect.

WAS

On a totally different note, you can also apply a Smoothing shader after "Terrain Normal Output" or after your disp to scalars, and you can use this to round some of your shapes, to look like waves rolling in. That way when there is hard turning edges in the terrain, they'll be smoother and the wave will have smooth arcs caressing the shore shapes, instead of angled exactly like them.

Hannes

Quote from: WAS on March 10, 2022, 12:39:18 PMOn a totally different note, you can also apply a Smoothing shader after "Terrain Normal Output" or after your disp to scalars, and you can use this to round some of your shapes, to look like waves rolling in. That way when there is hard turning edges in the terrain, they'll be smoother and the wave will have smooth arcs caressing the shore shapes, instead of angled exactly like them.
Interesting thought. Tested it.

WAS

Awesome. You could even play around with it too, like a colour adjusted version of the terrain inputed as the scale modulator. See what sort of effects you can get. Hugging more here, less there, etc. Could even smooth that colour adjust so the effect is more gradual.

WAS

I am still not done with this idea. My thought process now is we could get all these waves via the modulo function, which gives a half sinus effect. Trying to see if I can smooth the hard edges. Than really all we need to do is divide terrain scalar + pf warp duplicates, and you got different scale wakes to easily clamp in solid area, and mask in foam.

Hannes

Sounds amazing! I understood maybe ten percent of the things you mentioned, but I guess, it's gonna be great! Keep going!! ;D

WAS

Just think instead of normal sinus waves like this

Screenshot_120.jpg 

We have one that looks like this

Screenshot_119.jpg

That way you have the defined shapes of the wakes procedurally based on the terrain, no custom clamping needed, you just vary the terrain intensity with a multiply for every variation of waves, and maybe one clmap just for the wake line.