Search Unity

Breaking ocean waves

Discussion in 'Scripting' started by Octane-Test, Sep 27, 2019.

  1. Octane-Test

    Octane-Test

    Joined:
    Aug 23, 2016
    Posts:
    23
    I am working on a project where I have to approximately simulate the ocean waves. Currently, I am using a mesh modification approach. I am able to simulate low amplitude waves using the following equation:

    Code (CSharp):
    1. yVal = Mathf.Sin(180 * Mathf.Deg2Rad / freqUpdated + Time.time * speedOFWave) * halfWaveHeight;
    Now, I want to extend this equation to simulate breaking waves for a high value of "wave height".

    Approach tried:
    1. I tried creating code similar to this plugin but the smooth transition between low amplitude waves to these breaking waves is not possible with that approach.
    I have the following questions:
    1. What kind of modification can be done to the above sin wave equation to simulate breaking waves?
    2. Are there any other mathematical techniques that can simulate low amplitude and breaking waves?
    3. Is it feasible to do this type of ocean simulation using water particles?
    I would appreciate any suggestions and thoughts on this topic. Thank you.
     
  2. StarChick971

    StarChick971

    Joined:
    Nov 28, 2015
    Posts:
    118
    Hello, I am also interested into developing myself something to make a realistic wave.
    Concerning 1) I only have a nice ocean plane look using Gerstner waves instead of sinusoidal ones ( https://en.wikipedia.org/wiki/Trochoidal_wave ) using shader first.
    I opened a post a while ago on the same topic https://forum.unity.com/threads/realistic-breaking-wave.700019/
    Now I am reading pages of different theses and articles about animating a wave so that it breaks on the shore but still didn't find an easy way to simulate in unity though... (2)
    I don't think it would be a good idea to do all this runtime with particle but you can still give a try with latest version of unity thanks to VFX Graph and Shader Graph maybe (I am currently playing a bit with both)
     
  3. Octane-Test

    Octane-Test

    Joined:
    Aug 23, 2016
    Posts:
    23
    Thank you for the reply @StarChichk971. I was able to find a free mesh deformation plugin similar to Mega-Fiers. However, it was difficult to get the breaking waves using mesh deformation. But you can try that plugin on your end and let me know your thoughts.

    Currently, I am trying simulate breaking waves using the metaballs and fluid dynamics. Is it computationally intensive to use metaballs for ocean simulation?
     
  4. StarChick971

    StarChick971

    Joined:
    Nov 28, 2015
    Posts:
    118
    I saw same free asset Deform on the store, I didn't tried yet tough.
    I would not consider using fluid dynamics because it is too much expensive in term of performance, especially for a complete ocean surface.

    By the way I found this interesting video from another thread, it is a 3D software approach but looks the best for the moment...
    https://forum.unity.com/threads/rigging-3d-wave-for-making-a-surfer-game.344378/
     
    Last edited: Oct 16, 2019
  5. Octane-Test

    Octane-Test

    Joined:
    Aug 23, 2016
    Posts:
    23
    Thank you for your reply. I looked at that approach earlier and looks good for simulating breaking ocean waves. But I need an approach where I can modify static ocean mesh from low amplitude rolling waves to high amplitude breaking waves in real-time.