![synth ocean waves patch synth ocean waves patch](https://www.vintagesynth.com/sites/default/files/2017-05/oberheim_ob8_angle.jpg)
Morphing between LODs and using a fixed size patch is essentially what tessellation does, so this scheme can be seen as a subset of quad patch tessellation.
![synth ocean waves patch synth ocean waves patch](http://beausievers.com/synth/synthbasics/i/fourthflow.png)
Like CDLOD, we transition between LODs by "morphing" the vertices so that before switching LOD, we warp the odd vertices towards the even ones so that the fully warped mesh is the same as the lower-detail mesh, which guarantees no popping artifacts. Like geomipmapping and geomorphing, the patch size is fixed, and we achieve LOD by subdividing the patch with different pre-made meshes. The Tessendorf paper uses the Phillips spectrum which gives the estimated variance for waves at certain wavelengths based on wind direction and speed.īased on this formula, we generate a random two-dimensional buffer with initial phase and amplitude data for the heightmap and upload this to the GPU only at startup. The ocean is a random process in that the amplitudes and phases of waves are quite random, however, their statistical distributions are greatly affected by wind and can be modelled quite well. Procedurally generating frequency domain samples Bainville which contain more details on how FFT can be implemented efficiently on GPUs. The FFT implementation in GLFFT is inspired by work from E. The GPU FFT implementation used in this sample is based on the GLFFT library. As long as the heightmap is large enough, the tiling effect should not be particularly noticable. Since the FFT assumes repeating inputs, the heightmap will be tiled with GL_REPEAT wrapping mode. To move the water, we simply need to modify the phases in the frequency domain and do the inverse FFT over again. In the frequency domain, we will create waves with certain amplitudes and phases, and use the inverse Fourier transform to generate a sum of sinusoids. This is the core of ocean wave synthesis. In fact, we can simply think of exp(j * x) as a complex oscillator. If we imagine that the real and imaginary numbers form a 2D plane, exp(j * x) looks very much like rotation with angle x. The mathematical formulation of the discrete (forward) Fourier Transform is: The core of the Fourier Transform is a transform which converts from the time/spatial domain to frequency domain and back. There are many excellent introductions to the Fast Fourier Transforms, so only a short introduction will be provided here. The Fast Fourier Transform for Ocean Waves For reasonable values (this sample uses N = 256), this can be done very efficiently on GPUs. The inverse fast Fourier transform does this excellently, using only O(2N * (N * log2(N))) complexity for a 2D NxN grid to synthesize NxN waves. For realistic looking water, we would really prefer the number of waves to be the same as number of samples. With simpler water techniques, very few waves are therefore used instead and the sinusoids are accumulated directly. Increasing this to two dimensions and we end up with a terrible O(M * N^2) complexity. Summing up a large number of sinusoids is very intensive with a naive approach, and has complexity O(M * N) if synthesizing M waves into N samples in one dimension.
![synth ocean waves patch synth ocean waves patch](https://i.pinimg.com/originals/f1/6d/3f/f16d3f707f6c639dc1f8b2c012b40e79.jpg)
The main principle of Ocean rendering is that it can be modelled very well by thinking of it a sum of "infinite" waves at different amplitudes travelling in different directions. Tessendorf which implements heightmap generation by synthesizing a very large number of waves using the Fast Fourier Transform. The ocean rendering technique in this sample is based on the well-known water rendering paper by J. This sample assumes good knowledge of OpenGL ES 3.1 compute shaders. This sample makes use of Tessellation shaders and RGBA16F framebuffer extensions when supported by the device. Introduction Note This sample uses OpenGL ES 3.1.