Quick update on Gerstner wave displacements

Feel free to share: Share on LinkedIn
Linkedin
Tweet about this on Twitter
Twitter
Share on Facebook
Facebook
Share on Google+
Google+

Hi,

Just before we move into the next year/decade, I’d like to post a quick update on the wave system. I’ve by now almost fully integrated the new Gerstner based wave displacement logic into my breaking wave system. It’s mostly used for now to generate higher level waves on top of the surfing waves. I have some further developed idea’s on how I can integrate the animatable waves completely into a Gerstner based wave system which would be really powerful, but that’s definitely for next year. For now, I can show a new Gerstner wave render test that really shows the advantages of using the Gerstner formula’s over ‘normal’ noise based displacement. What’s interesting about the new displacement logic is that it combines ‘horizontal’ (in relation to the normals of the wave surface rest position) and ‘vertical’ displacement. This is what the render below nicely illustrates.

If you look at the foam texture on the wave surface you can clearly see that this ‘horizontal’ displacement creates very realistic stretching and moving of the foam over the surface. This would be very hard to achieve using ‘normal’ displacement using a noise functions.

I did rewrite quite a lot of the ‘original’ VEX code in the previous post. I’ve moved the noise inputs that were used to add randomness to the amplitude, position and ‘choppyness’ to the generated waves inside of the displacement shader. This allows me to influence the noise for each octave of the generated wave which adds a lot of randomness. I’ve found that it was quite hard to generate waves that look natural and not too regular. In the end the Gerstner calculations are not much more than an elaboration on a sinus and a co-sinus function. So its very easy to generate very synthetic looking waves. I’ve found that a combination of noise added to amplitude, position and wave length creates the best results. As the relationship between amplitude and wave length determines ‘choppyness’, I’m no longer adding noise to the ‘choppyness’ directly. In addition to this, I’ve found that using three levels of waves (low, medium and high frequency) on top of each other, with three octaves each, works very well.

In the wave setup you could see the low and medium frequency waves to play the role of refracted waves coming of the shore or near by cliffs of something like that. The high frequency waves can represent very small waves directly created by local wind. This also means that these can have different directions each in relation to each other as well as the ‘surf wave’ direction. The noise functions that influence Amplitude, position and wave length can be used to simulate differences in ocean floor depth on the low and medium frequency waves (so it makes sense to use a gentle noise with a fairly low frequency and few octaves for this). For the high frequency waves you can create very interesting effects by using a more turbulent noise that moves around to simulate changes in the local wind (like turbulence, wind gusts).

Anyway, it took more time to ‘tame’ this new wave displacement system than to build it. But I’m starting to get a feel for how to use it and what range of parameters makes sense. This I will use to setup proper default values that give a reasonable starting point.

I’m now almost done with the integration of the new wave displacement into the breaking wave system including using the displacement functions to generate the ‘lip foam’ in the ‘rough area’ as discussed in previous posts. As mentioned this ‘lip foam’ also forms the basis for the particle source that generates the lip foam. Now this will be based on much more realistic wave displacement I think the results will be quite a bit more realistic for these as well. One big advantage of the new displacement is that its much easier to determine the minimum and maximum values of displacement (as in the end it’s just a sinus with a known amplitude). This helps a lot in generating the texture of the foam and control the particle source. So all in all this development has taken quite some time but I think the end results will be more than worth it.

Happy New Year and Cheers,

Erik