UNITY - Gerstner Waves in Unity


I have implemented a Gerstner system in Unity. This was done with the help of several tutorials I found on the internet. I am quite happy with the result. I guess the next step is to add a proper water shader!

The waves are generated in the shader directly and it supports up to 3 waves added together.
Another thing I would like to have a look in the future is to calculate this in the CPU and movingthe verteces directly in the CPU.

Kind regards,

UNITY - SDF in Unity



So just to continue with my SDF and Ray marching adventure I implemented it inside unity, using a very similar shader. This was done with the help of all the great people on theinternet!




Gerstner waves



A few months ago I was interested in recreating the Gerstner algorithm to recreate ocean waves in without going into fluid simulation.

To undestand it better I decided to start with graphing it in Desmos, and so I did.
Gerstner waves are parametric functions, which means that the function's x and y depend both on a third parameter, which in our case is goning to be time.







The parameter t is time, k is a constant related to the wavelength and c is another constant that involves gravity. Finally a is another constant that regards the steepnes of the wave, or how sharp they are.

Here you can find two different Gerstner waves with different values of k, c and a.
The blue curve is the result of the addition of the previous two. You can see that the blue one get it's highest crest when the black and the orange are as aligned as they can be. This is a clear example of  the constructive and destructive interference properties of waves.



As a final exarcise I tried to find the tangent and normal vectors for a given point along the curve, which can be acomplished by getting the derivatives of those funcitons at a ceratin point:

 
 


Have a great rest of your day,


Season 4 of Talking Tom and Friends Finale is here!!

We have finally launched the last episode for this season! I am very happy to be working with such an amazing team with people coming...