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 Teaser found here.
You would need
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 :
Existing Solutions :
There are several solutions to the problem of having more accurate wave interaction which leads but each have their drawbacks.
Proposed Solution :
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.
In the Enhanced version we add
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.
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.