Fast Fourier Transform in Unreal Engine for Ocean Simulation

Hi ,

I am trying to implement FFT for creating my Ocean material , and after reading some papers on it , I found that I need to run a nested two dimensional summation of wave height fields , so there has to be a loop for MxN times, So if M=N=512 , I need to use nested forloop iterating 512x512 times. So for me it wont be possible to do this manually in material. So I am trying to implement this in Blueprint. Now I want to pass the entire displacement vector as a parameter from blueprint. Will it be possible ? WIll the material show changes in wave height over time and other passed variable , if I pass the entire FFT summation result as a Vector parameter through my ocean blueprint construction script? Or the dynamic matrerial instance is only meant to identify RGB vector color and not displacment or normal vector logic?

Hi Sameek4,

There is a nice plugin that you could base your investigation on. It already comes with FFT shaders and lots of cool stuff: [Plugin] Ocean surface simulation plugin (VaOcean) - Engine Source & GitHub - Unreal Engine Forums

The code is on GitHub so its available.



Though I am not very much impressed with the plugin , as it looks very basic , and shoreline is not there , yet I took a look at the code and got to learn few things from it yesterday. Before that , I was able to create a water body with Gerstner Wave equation , with basic shore outline , as shown in the last picture(at the bottom) of the below link :

But I am looking for something even more realistic , with proper wave ripples , and realistic interaction with shore , underwater caustics , etc. Something you get when you search for “California ocean beach” in youtube. I want to know how the waves create that rotational effect among itself.

Thanks for the links! They will go directly into my bookmarks :smiley:

There has been some study in this area, maybe it will help you find an answer.

Paper: Real-time Breaking Waves for Shallow Water Simulations

Video: Real-time Breaking Waves for Shallow Water Simulations - YouTube

Another approach:
Real-Time Parametric Shallow Wave Simulation

thanks , yeah just saw the last link that you posted a couple of hours ago , will implement it today itself.

Great, glad you worked it out. If you can post some shots on the forums when you get it working.

Here is another paper you might like for making a surface foam effect. Combined with some particles it could be good for the wave crashes.

Very Fast Real-Time Ocean Wave Foam Rendering Using Halftoning

Another link, maybe it can help you on your way. This is a very interesting topic.

An interesting water surface implemented in UDK

edit:: and UE4 too Good results here