## Procedural shore foam preset (Sorta surf?)

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

#### Dune

The stretching is indeed a crude methode, that's why I always stretch the terrain Y to begin with.

The modulo always got me a hard/clamped output, so I don't know how that would work properly. The problem with the second curve is that it also needs to point at the coast. Must be possible. Jon has done a lot in that area, but I was never able to replicate.

#### Hannes

Quote from: WAS on March 10, 2022, 06:16:07 PMThat 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.
I see. great!!!

#### WAS

Quote from: Dune on March 11, 2022, 01:38:16 AMThe stretching is indeed a crude methode, that's why I always stretch the terrain Y to begin with.

The modulo always got me a hard/clamped output, so I don't know how that would work properly. The problem with the second curve is that it also needs to point at the coast. Must be possible. Jon has done a lot in that area, but I was never able to replicate.

Check the link I just posted. It's a sinus function with functionality like Modulo, you can lean the edge to either side of the wave with a smooth edge.

#### Dune

I'll check it out, thanks.

#### aknight0

Quote from: Hannes on March 09, 2022, 08:38:24 AMMaybe this will be something for the file sharing section, but it's not finished yet, I guess.

For my last (tropical) images I tried to create a procedural shore foam preset. I carried on with some stuff that was mentioned here:
https://planetside.co.uk/forums/index.php/topic,28028.msg278689.html#msg278689

So far I created three "rows" of foam in real world scale (the cube in the image has the average size of a human). As you can see the setup uses displacement to scalar nodes and some following color adjust shaders, which use the water object's level to create different distances and falloffs to create the foam lines. Additionally I used the "ocean foam texture" setup I shared once in the file sharing section to create the foam patterns. I managed to put all the foam texture nodes into a grouped shader to make it a bit cleaner.
It works with procedural terrains and with loaded ones. So far so good. This setup works nicely with a water level of 1. Of course I could change all parameters of the color adjust shaders by hand, if my water object's level would be different, but that would be rather inconvenient. So, I need some help!

Is there any function or whatever, that I could put somewhere (probably after the displacement to scalar nodes?) to just enter the water level, and that would change the color adjust shaders' values automatically? I guess, they would only have to be shifted up or down, since the relations between the values should stay the same.

So, I hope, someone has a good idea!!
Thanks for sharing this Hannes, I was admiring the waves on your tropical picture and wondering how you did them!

#### dreamzfiction

Quote from: WAS on March 10, 2022, 12:14:09 PMYeah 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.
Hello WAS, I downloaded the tgd and tried to use it in my personal project, I loaded in the two shaders from the water node into my project. However the shoreline foams don't appear.  Only the blue ocean is visible.

I am using a heightfield I generated from world machine, and imported as a ter file in terragen, with a scale of 7996m on both x and y axis. I set the waterlevel to 950

I have worked with terragen nodes on few occasions. But I feel its the start and end multipliers that need tweaking. Sadly, my tweaks don't seem to work.  Please assist me in finding the best settings for my scene. Thanks

I can share the tdg file if needed.