Skip to content

som1990/eWave

Repository files navigation

CPU prototype of eWave and Surface Wavelet algorithm. UE4 GPU Implementation description found below

Purpose : To compare a slightly older but modified algorithm with latest Siggraph paper(2018) solution to wave interaction. The goal is to do an analytical analysis of these two methods to come up with a faster and more accurate wave simulation as compared to what's currently been using in game production.

Latest Video (Dec 2019)

Latest Teaser found here.

Requirements


You would need

1) eWave Algorithm


Motivation: To implement and develop a faster and more accurate method for player water wave interaction which can be utilized in production in game companies.


Problem: Current game methodologies utilize shallow water equations to simulate player water wave interaction. The issue with this approach is that shallow water equations do not take into consideration dispersion in the wave equation. Traditional shallow water equations are also resolution bound hence simulation quality is dependent on the resolution of the grid.


Note: What is dispersion?


Dispersion in layman terms refers to waves of different frequencies traveling at the different speeds. Shallow water equations do not account for dispersion so waves of all frequencies travel at the same speed. In the image below we see various frequencies of ocean waves dispersing out at different speeds.


Goals :-


I will be using as much code provided by the Surface Wavelet algorithm to compare with my enhanced eWave algorithm to stay true to the original author's vision. I will not be comparing channel flow or other methods utilized by the Surface wavelets.


MileStone :

  • End Date: October 15th, 2019.


Existing Solutions : There are several solutions to the problem of having more accurate wave interaction which leads but each have their drawbacks.

  • iWave and eWave : Dr. Tessendorf proposed a Convolution filter based approach of solving the iWave and eWave equations derived from combining Bernoli's Equation and Energy Conservation Click here for author's slides. The problem arises in the resolution of the kernal You can read about it here and here
  • There are various improvements to these interactive fields where several people tried to make these convolution kernals more optimized and less noisy to varying degree of success. The problem with these methods were that it became heavier and more time consuming to generate clean results. Canabal's method of using pyramid filters
  • People have used other convolution based methods to generate correct dispersion speeds Ottosson 2011
  • Some researchers utilized hybrid solutions of emiting particles which contain details of a wave crest. Yuksel Wave Particles and Jeske Surface Wavelet


Proposed Solution :

  • In the eWave paper Dr. Tessendorf proposes a resolution independant and non-kernal method. He transforms the generated equation to the Frequency realm by Fast fourier Tranforming(FFT) the Height Equation.
  • Since FFT can be done parallely in the GPU, I wanted to use this method to generate the waves. At the moment with CPU tests, the results look promising. In the CPU with 4 CPU threads this algorithm without any enhancements runs smoothly > 15 fps. The surface wavelet at this point run with the same setup at < 1 fps. This is expected as the true speedup claimed by the paper comes from running it in the GPU. Hence preliminary test produce promising results.

EWave Base below


WaveLet below


Enhanced Version


In the Enhanced version we add

  • Ambient waves.
  • The faster the object moves , the more waves it generates. Stationary/stable objects do not produce new waves rather just reflect existing waves.
  • Wave propogation via Semi Lagrangian Method. There is a velocity flow field that pushes our wave. This simulates rivers and custom flow fields.

We can see the advanced eWave below


Unreal Engine 4 implementation.

This GPU based solution is lightening fast. The Compute Shader simulation taking 0.6-0.8 ms and Displaying using Pixel Shader takes about 0.15 ms. So if we consider in fps , we get around 1000 fps with the simulation. This is done on a 512x512 patch, using SDF (signed distance fields) to generate the intersections, captured by a scene render target.


Note: This gif doesn't accurately represent the framerate or speed.

Updated Video Link of Test below (11/18/2019)

Video of it working with self-advection found here.

You will see more detail and a slight fix to the symmetry of the resultant wave. You will also see choppyness and the waves pushing itself via self-advection.

I realized Semi Lagrangian (SL) advection was losing detail in the waves. So I implemented a Modified Macormack advection scheme which preserves lot of the detail that was lost with the SL.

You may also realize the waves being choppier and having a direction as compared to the GIF. This is achieved via a horizontal displacement of the heightfield (We differentiate the heightfield).

Breakdown to come in a bit.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published