Animated Ocean Waves

Air 11.08 and later includes a new set of shaders for rendering animated ocean waves based on Jerry Tessendorf’s paper “Simulating Ocean Water”.  The shaders are:

OceanWaves – displacement shader for the waves
OceanSurface – surface shader for deep ocean
OceanSurfaceWithForm – surface shader for deep ocean with foam at wave peaks

The following images use the ocean surface shaders along with the physical sky environment shader.

The underlying wave algorithm can simulate a variety of ocean conditions from calm seas to stormy waves depending on the wind speed:

ocean wind speed 5

The appearance of waves in windy conditions can be improved by adding chop, which sharpens wave peaks and stretches troughs by shifting the surface laterally:

Because the chop displacement shifts the surface in arbitrary directions, you’ll need to tell Air that the displacement is not strictly in the direction of the surface normal by applying the following attribute:

Attribute "render" "normaldisplacement" [0]

Note that too much chop can tear the surface apart.

Finally, the OceanSurfaceWithFoam surface shader allows foam to be rendered near wave peaks.  In order for the foam to appear in the proper location, the common parameters between the OceanWaves and OceanSurfaceWithFoam shaders must be set to the same values.

ocean with foam

If you do not need to render foam, set the FoamEnabled parameter of the OceanWaves shader to 0 to reduce computation time for the waves.

Wave animation is controlled by the current frame number and the FramesPerSecond parameter value.

The waves can be tiled in X and Y; the above pictures are a 2×2 grid of the same wave pattern.

This entry was posted in Shaders and tagged , . Bookmark the permalink.