Here's nice challenge for you; getting (coastal) water to react on the altitude/distance between water and planet, altering the basic sine curves (though some graphs represent them as simple sine waves, others with elongated, and flatter lower end curves). The variables are there (water level, coastal altitude, angle/slope), it's just a matter of putting it in an equation ;D
Quote from: Dune on September 27, 2020, 02:20:32 AMit's just a matter of putting it in an equation
...should be a piece of cake! ;) ;D ;D ;D ;D
Oh boy... quite a challenge!
Lots of variables here, distance to/from shore, altitude above sea floor, distance between peaks (and lots more I expect) and they look like they all effect each other.
Pretty involved I would expect.
Personally I don't think this is necessary (not that the challenge is invalid in any way, lots to be learnt here!)
What I mean is that much of this can be achieved in most cases by simpler means. Simple shapes, shader arrays and redirect (and/or fractal warp) can go a long way.
I think the hardest part here is the texturing, the way the foam trails behind the wave crest for example.
By the way a quick hack to get the sine waves to be further apart could be to use a soft maximum.
Interested to see what comes up :)
Soft max, good idea.
I know it can be made simpler for local areas, but it would be cool to have a 'click and go' shader for coastal waves/surf, even if it isn't perfect in close-up.
Maybe find the vertical distance between the surface of the water object (lake or sphere) and the underlying terrain, and calculate wave height and shear (and foam) based on that? (Probably could use a constant for the height of the water surface.)
DandelO's solution here (https://planetside.co.uk/forums/index.php/topic,15568.15.html) might be a place to start.
I'm sure some of the features I added to my sand shader could be used that effect sinus waves. Flatter tops, peaked tops, deeper troughs, flatter troughs, etc.
I always have issues with shore waves though, I'll be honest. Hate them in TG xD
I have done previous work on this and learned a lot from some guys here over a decade or so, so I got pretty far. At least as far as to get surf near beach, with wider waves offshore, but some things are still hard to accomplish, hence my quest for ideas. New guys around, so you never know ;)
The most problematic thing is to get the normal off the coastline/beach and translate that into a (stronger) shear (or what you'd call it) towards the beach, like surf. Twist and shear, redirect, vector displacement, all work in a static direction, afaik.
Another thing is to mix two sine waves to get some variety from the basic straight lines (besides warping them a bit). Tried to mix sine and cosine, but they seem not to work together. Shifting them a bit by PF is awkward too, as the mix won't work very well yet. The soft max is therefore a good idea; it works nicely, and is an interesting addition.
Quote from: cyphyr on September 27, 2020, 05:31:33 AMPersonally I don't think this is necessary (not that the challenge is invalid in any way, lots to be learnt here!)
What I mean is that much of this can be achieved in most cases by simpler means. Simple shapes, shader arrays and redirect (and/or fractal warp) can go a long way.
Shader array can be quite effective indeed albeit painfully slow. It gets even slower, the more repeated instances you have.
Fractal warping of a stretched power fractal indeed creates a brilliant wavy pattern. This option, however, is challenging because you still need to align the waves with the shoreline.
I had a crack at this about 4 years ago. There's loads of parameters and it all needs to animate together to get anything anywhere near convincing. I think it's possible, but there's loads of abstraction to get your head around with the vector displacement.
vWaves_20 show's that a curl is possible.
vWaves_20.jpg
vWaves_21 shows the tip of the wave falling along the x axis, which this scene was looking at just that aspect, the tip should curl in more on the right hand side and the wave peak lower. Then there's the splash back to work out, then there's how the shore foam works. All this whilst dealing with vector stretched surfaces and making sure texture space doesn't run off and scale into oblivion. :)
vWaves_21.jpg
Quote from: Hetzen on September 28, 2020, 08:32:10 AMI had a crack at this about 4 years ago. There's loads of parameters and it all needs to animate together to get anything anywhere near convincing. I think it's possible, but there's loads of abstraction to get your head around with the vector displacement.
They look fantastic Hetzen. Nice skills!
Wow, that looks amazing, Jon!
I knew it! ;) You showed me that years ago, but not as far as this. Great! But does it follow the coastline?
I've done some trials lately, and came up with this. By getting the normal off the waves and displacing by a range from coast to deeper water, I got some sort of surf that does indeed follow coastline.
If your terrain is soft enough you can warp very heavy on Y and you get ribbons along the shape of terrain, they can be smoothed too. Haven't messed around with it but kinda easy way to warp a PF around the shore.
I imagine somehow that pinch and bulge function could be used to create larger gaps in waves further out on a basic sine too.
My sand shader as well as peak and trough modifications has meandering too. :) Issue with mixing meandering is intensity of the scalars shifted and mixers softness used
PS that node network looks intense Ulco. Lol
Quote from: Dune on September 28, 2020, 12:16:02 PMI knew it! ;) You showed me that years ago, but not as far as this. Great! But does it follow the coastline?
I've done some trials lately, and came up with this. By getting the normal off the waves and displacing by a range from coast to deeper water, I got some sort of surf that does indeed follow coastline.
Those images look good. I like the rock work as well.
What I was working on will do, I was using the z axis as I would the Altitude below and slightly above sea level. As you know it's quite tough to get a nice looking below water surface gradient to work with, so while testing i set up this rig scene. The approach would have involved making a plan render of the landscape normals and another of the elevation, then setting a wave direction that interacted with the planar direction of the coast, and changing the break position depending on y normal, the altitude driving the wave cycle adding a frame offset to drive it animating. But haven't got that far.
Guys, you are geniuses. I don't understand what you're talking about, but I like it... ;)
vWaves_20 and 21 look nearly like those water simulation program outputs. Great work.
Quotewarp very heavy on Y
That's what I used to get the waves further off coast to adjust a bit to the coastline.
The network is indeed a bit confusing. I'd like it to be simple, but haven't gotten to the crux yet ;) Too many ranges needed, and I like one to feed the other by adding scalars or something. But it's fun to work with, grinding the brain a bit :P
Jon, do I understand you make 2 renders first for the normals and terrain? I'm sure it's possible to get the normals off the displacements in one go, but I'm stuck at the wave sine normals, which point off coast as well as to the coast, so displacing by something like a gradient of the underwater ground is a bit cumbersome. They displace more to the coast than off coast, but there are ugly parts too. Work not done yet....
With a cosine wave following an increasingly shallow gradient, it will always have the front side facing the coast. You can isolate the 'front' side of a cosine, by breaking down 2 x pi, to just pi to get half a wavelength, to 0.5 x pi to get a quarter wavelength.
The normal map render provides you with the lateral direction the wave is facing for you to vector displace. It also means you don't have to add/subtract the land displacement from the wave, which I think you guys are doing?
I'd like to subscribe to this thread, but that feature does not work in the forums :'(
- Terje
I have to get my head around this, Jon. I used a displacement to scalar and smooth steps for gradients, which provide areas for foam and 'surf'. With a power scalar I steepened that gradient to get less and wider sinus offshore and more, smaller inshore. So no subtraction of land from wave.
Can't you make a normal map from those gradients in one go? Dry is white and deep is black (or however it's set up), so if that can be translated into vdisp.....
Probably, but if you bake that data you speed up renders by not having to check what the land displacements are doing.
I guess you're right. Thanks!
Amazing results so far. Pushing the envelope . . .
QuoteI don't understand what you're talking about, but I like it...
Same!
Ulco, try making a sine curve displacement, and then use a Surface Layer to mask certain parts of the wave form with a similar set of blues you used to make the sine curve.
It's important to remember that sin/cos/tan etc work in radians. So a sine wave that is 1 meter apart peak to peak would be written, (axis or gradient) x 2 x Pi, before you plumb it into a Sin node.
If you go a stage further and set the input of a Modulo to your (axis/gradient) and put your wave length as a Constant into input 2, then Divide the Modulo output by the same Constant, you will have a repeating 0 to 1, that can also help with masking.
I wonder if you could create system that takes slope directions X/Z and creates a vector map of intensities which than can be used to warp/skew waves towards the shore.
There will be a limit to the realism you'll get in something like this. It could only ever be a brush stroke. There's no simulation, just you setting up rules on how you want a shape to form.
Quote from: Hetzen on September 29, 2020, 01:42:34 PMThere will be a limit to the realism you'll get in something like this. It could only ever be a brush stroke. There's no simulation, just you setting up rules on how you want a shape to form.
That's why I often setup beach scenes as a z plane distance shader and offsets, or utilize a very soft shape for a island or whatever and use it for the waves, adding detail later.
QuoteI wonder if you could create system that takes slope directions X/Z and creates a vector map of intensities which than can be used to warp/skew waves towards the shore.
This is exactly what I queried about in the first place, and that's my goal. I would like to have a (simple) system that could be used in every terrain, getting a (be it) simplistic surf set bending towards the beach, for semi-close-up stills.
I've been thinking about pulling a slope/angle from the beach by visualize normal, translating that in vector. Theoretically you'd then have a vector displacement 'map'. But the slopes on a beach are very shallow, so you'd actually need something much steeper to pull the waves (tops) towards the beach, not slanted down as the normal goes. Can't rotate the shallow slope into a steeper one, as that can only be done on a certain axis. Stretching the beach beforehand into Y may help, but you have to keep the altitude range in order. Best would be to translate the highs/whites and lows/darks into a vdisp mask.... somehow. But then you might miss the blue/red gradient of a real visualized normal map. The bending would have to go 'around corners'.
Just thinking on paper....
Well, I may have to give up again. I can't get the normals off the waves (or land, even with some sideline of surf integrated) to get the shore wavetops to displace inland (on both sides of the island!). Tried everything that I can think of. I also couldn't make the phase shift, to lift or lower a part of the wave either >:( :( as that would at least be something that looks a bit like a real surfing wave.
So here you go, have a play with it... and do report back! It would be awesome if something like this could be integrated into TG.
Here's a screen grab of the network with the addition of isolating parts of the sine curve. And TGC that just needs to plug into the Planet.
Thanks a lot, Jon. Study material!
Oh cool, definitely interested in how you isolate different parts.
Immediate issue I found with trying to use "get normal" is it uses the normal of the water plane, even if I feed it to the terrains Compute Terrain. I don't feel that's correect logic, should be able to feed directly, or it should be only pulling from a Compute Normal/Terrain in the scene.
I tried using the North, South, West, East masks, hoping they would be based on the terrain, to simply mask surface layers with leans in the right direction. No go. It gets the normals of the water plane and sine wave.
So I rendered out a ortho mask of N,W,S,E faces (N,W,S in RGB and East as just scalar) and used these as masks on my waves for twist and shears on the appropriate directions. Seems to work good for the simple shape, though I forgot to turn off the sun in the ortho and do luminosity, so masks are a little wonky.
I think the get normal needs an update to allow to actually plug a network that the get normal needs to come from. Even when I masked the main terrain, and than converted RGB to scalar, and used that on the waves, the masks converted to normals on the waves. Go figure. Ugh. This would be entirely possible if you could get normals from what you actually want, not whatever it does.
Mmmm, I didn't have a chance to look at it yet, but this seems disappointing. I didn't get the right normals, and the NSWE masking isn't what I was after. It is easy enough for a specific area to twist and shear or vdisp into the desired direction, but was looking for something that always works.
I'll have a look at it today...
It must be possible to write code that twists or redirects or vdisps in the direction of white (versus black) in some mask, not hard X or Z. Maybe that would be a feature request for Matt....
It works if you use a compute normal after the wave displacement and use lateral displacement driven by the heights, instead of the vdisp.
Quote from: Dune on October 01, 2020, 02:22:37 AMMmmm, I didn't have a chance to look at it yet, but this seems disappointing. I didn't get the right normals, and the NSWE masking isn't what I was after. It is easy enough for a specific area to twist and shear or vdisp into the desired direction, but was looking for something that always works.
I'll have a look at it today...
It must be possible to write code that twists or redirects or vdisps in the direction of white (versus black) in some mask, not hard X or Z. Maybe that would be a feature request for Matt....
It works if you use a compute normal after the wave displacement and use lateral displacement driven by the heights, instead of the vdisp.
NWSE masks aren't a certain direction. Lol it's 360 degrees as demonstrates and intensity modulated by fuzzy zone allowing curving of the lean.
I don't know what you are after besides what I just explained and you won't be able to get directions for any vector disp without a proper get normal that works cross-object on only what you specify. So you'll have to render out the masks from get normal like was suggested earlier.
The only way this will be possible in TG is if get normal is updated to work better. Interestingly I remember normal convergence in the past from I think cinema 4d, where you could lean all normals towards a center target (or away).
I see it now, the wonky part on the left made me think it were hard-edged directions. Wasn't awake fully :P
This is what I was trying to get to work. Would be so handy!
@Dune, Visualise Normal maps the values to the range 0..1. For displacement purposes you probably want Get Normal because it provides the raw data which includes negative values. In any case, it isn't possible to get the normal of a different object because of how Get Normal works.
https://www.planetside.co.uk/wiki/index.php/Get_Normal
@WAS, Being able to retrieve the normal of a separate object would be very useful but needs some mathematical definition of what point on the other object we want to sample. One way to do this is to cast a ray to the other object but we also need to define what direction to cast the ray (e.g. down). I hope we can add this feature in future.
Quote from: Matt on October 02, 2020, 04:37:46 PMBeing able to retrieve the normal of a separate object would be very useful but needs some mathematical definition of what point on the other object we want to sample. One way to do this is to cast a ray to the other object but we also need to define what direction to cast the ray (e.g. down). I hope we can add this feature in future.
Forgive my ignorance here, cause it seems that way to me at least, but isn't the "point" we want defined by it's usage already on object A? Isn't there someway to simplify this result to texture or final space as a range 0-1+ or what not to than apply as masks on anything. Perhaps tihs is more functionality of something entirely different based on get normals, but just thinking. I want to say rasterize, but I feel that's just totally wrong and wasteful.
Quote from: Dune on October 02, 2020, 02:10:28 AMI see it now, the wonky part on the left made me think it were hard-edged directions. Wasn't awake fully
That's probably from me, also, not being fully awake, and rendering out the RGB + Scalar maps with the sun and colour instead of blackness and luminosity. Oops.
Additionally, from what I see at beaches and stuff, waves seem to follow the basic smooth form of terrain, and "break" physically on obstacles only very near or at the surface, which can probably be done based on separate shaders like "rocks" and using scalars, so the base "landscape" terrain should be as smooth as possible for wave angles to follow.
Thanks Matt. Too bad about the visualize normals (and that get normal won't work, which is understandable { hoping I never 'get normal' :P }).
I also thought of copying terrain A to object B, visualize its normals there and then smooth the terrain again, to then add the displacement wanted (say wave sinuses), and then apply the visualized by vdisp. But that probably won't work either because of the direction of calculating....
@WAS: I did use the smoothing function to get smoother areas for the sinuses to follow (with its drawbacks).
Quote from: Matt on October 02, 2020, 04:37:46 PM@WAS, Being able to retrieve the normal of a separate object would be very useful but needs some mathematical definition of what point on the other object we want to sample. One way to do this is to cast a ray to the other object but we also need to define what direction to cast the ray (e.g. down). I hope we can add this feature in future.
Coming back to this, maybe we could have this be something in final space. So all the alts of objects, and textures etc all be in final space, so you'd have to use transform shaders, but would align as they do already across objects and final space alt limits etc. I wanted to approach this again for use of wet shores but again forgot about where it derives on objects/planets.