The fft-based representation of a wave height field expresses the wave height $h(x, t)$ at the horizontal position $x = (x, z)$ as the sum of sinusoids with complex, time-dependent amplitudes:
where $t$ is the time and $k$ is a two-dimensional vector with components $k = (k_x, k_z)$, $k_x = 2πn/L_x$, $k_z = 2πm/Lz$, and $n$ and $m$ are integers with bounds $−N/2 ≤ n < N/2$ and $−M/2 ≤ m < M/2$. The fft process generates the height field at discrete points $x = (nLx/N,mLz/M)$. The value at other points can also be obtained by switching to a discrete fourier transform, but under many circumstances this is unnecessary and is not applied here. The height amplitude Fourier components, $\tilde{h}(k, t)$, determine the structure of the surface.
Another version of the same formula:
Here $X$ is a horizontal position of a point whose height we are evaluating. The wave vector $K$ is a vector pointing in the direction of travel of the given wave, with a magnitude k dependent on the length of the wave (l):
$$k = 2p /\lambda$$
And the value of $h (K,t)$ is a complex number representing both amplitude and phase of wave $K$ at time $t$. Because we are using discrete Fourier transformation, there are only a finite number of waves and positions that enters our equations. If $s$ is dimension of the heightfield we animate, and $r$ is the resolution of the grid, then we can write:
$$K = (kx,kz) = (2pn / s,2pm /s)$$
where $n$ and $m$ are integers in bounds $–r/2 < n,m < r/2$. Note that for FFT, $r$ must be power of two.
Questions:
How many $k$ do I need? Does it mean, that $k$ takes all possible values (on the grid I mean)?
And what do I get as a result - complex number that shows height and (what?) in concrete point so I need make computations for all points on the grid or the whole grid itself?
How to apply fft to this formula?