Using the GPU Gems Article https://developer.nvidia.com/gpugems/GPUGems/gpugems_ch01.html I have implemented Gerstner Waves into UE4, I have built the function both on GPU for the tessellated mesh displacement and in code for the purpose of sampling height of the waves, but the issue I have run into is that the points by nature of the formula move away from their original points, so when using the gerstner function to get the height of a point, it is not necessarily at the point you are sampling so provides an incorrect height for that coordinate.
So somehow I need to solve for the point in the gerstner function that is actually lines up with the world position. Ive taught myself enough to implement the waves, but i'm stuck on this solution, though I suspect there is some sort of matrix or way to take the inputs, apply the cos values and use it as a lookup for the actual point to sample. Any ideas and help is greatly appreciated.
For Reference the Gerstner Wave Formula
Q = Slope
L = WaveLength
A = Amplitude
D = Vector2 Direction
x = x world coordinate
y = y world coordinate
t = time
Where Qi = Q/wi * A * NumWaves
Where wi = 2pi/L
Where phase = Speed * 2/L