PIRATES!

To compare different methods of creating waves, we created a standard diorama that includes a pirate ship. All use standard plane geometries with segments - which means that each plane has a grid of points (vertices) that can be displaced to create waves. To improve performance, the programs use shader routines to quickly perform these displacements. Each wave field consists of 4 adjacent planes. The waving flag was created with the assistance of prisoner849 (on discourse).

Sine Waves

Here are some examples that use the sine function to generate several waves. Each plane contains 63 segments (64x64 points). They all use a custom shader routine to compute the sine waves and to normal maps. A normal map is used to create small displacements. The map is displaced to create the illusion of movement. Because we know the frequencies of the big waves, we can pitch and bank the ship to match. The shader routines were created with the assistance of prisoner849.

Gerstner Waves

This is a modification of the standard three.js Ocean routine, modified by seanwasere to include Gerstner Waves. Like the standard ocean routine, the surface is a mirror surface. Gerstner waves are different than sine waves because they take into account the lateral movement of the waves and the impact of gravity, which tends to make them sharper at the top.

iFFT Waves

Here are some examples that use the inverse Fast Fourier Transform (iFFT) to create a displacement map and a normal map. In these examples, the iFFT is creating 128 waves. To capture the small waves, each plane contains 512 segments. The displacement and normal maps are displaced to create the illusion of movement. Because the wave heights and frequencies are random, we need to create a special routine to pitch and bank the ship properly. They all use a modified and updated version of the three.js iFFT wave generator created by Jeremy Bouny, based on an original programs (including shaders) created by David Li and converted to three.js by Aleksandr Albert.

Mixed Waves

Here are some examples that use a mix of iFFT Waves and a few larger Sine Waves.