The Physics of Psunami

The Psunami ocean simulator contains some basic ocean wave physics models that allow the animator to create a reasonably realistic ocean scene. These notes discuss the basic ideas that drive the simulation engine, in order to help you understand the various properties and how they affect the image.

Overview of simulator

The simulator consists of two parts. The first is the ocean wave generator that creates and animates the waves on the ocean surface. The second is the ocean lighting calculation that creates the color on the ocean surface based on the sky and the sun.

Ocean Waves

Psunami models the ocean surface as an undulating height field that covers an infinite flat plane. Because of this assumption, waves can not curl and break, so Psunami can not simulate very stormy seas or beach breakers. By making this assumption, however, the ocean can be described by a fairly simple model that gives good performance for use in computer graphics.

How waves are created

In any body of water, waves can be caused by solid objects interacting with the water. For instance, if you throw a rock into a pool, waves ripple out from the impact. If you drive a boat through a lake, waves (in the form of a wake) propagate away from the boat. In a huge body of water like an ocean, however, very little wave activity is due to solid objects.

The vast majority of the waves are caused by the wind blowing against the ocean surface — and are thus called 'wind waves'. If the wind blows long enough over the entire surface, an even distribution of waves is created. For a given wind speed and direction, Psunami will randomly generate a large number of waves that have the correct size, shape, and motion for the given distribution of wind energy.

Wind sets the wave direction

In general, waves tend to propagate in the direction of the wind. In low winds, all of the waves tend to have small wavelengths and small heights. As the wind speed increases, waves with longer and longer wavelengths and greater and greater heights get added to the ocean surface, and the surface becomes increasingly active. By increasing the wind speed you can generate waves that are both taller and have longer wavelengths.

It is worth noting that taller waves always require longer wavelengths — because otherwise the ocean surface slopes would become large and the wave would break. Psunami waves cannot break, so a stable ocean wave distribution never has slopes that are too large.

Finally, many times the color will appear too dark when looking into the waves, but will be fine near the horizon. In this case the simplest solution is to use gamma scaling to bring the colors into a more desirable balance.

Below-Water Ocean Lighting

When below water, the ocean surface looks very different. When you look up into the surface you see mainly the above water environment refracted through the ocean surface and very little reflection of the underwater environment. As in the above water case, the color has a contribution due to the sky and a contribution due to glitter. The glitter appears in the general direction of the light.

Total internal reflection

As you look down towards the horizon, there is a rapid change in the ocean color. This is due to an underwater phenomenon known as 'total internal reflection'. When your viewing angle with respect to the underwater surface normally exceeds around forty degrees, light no longer refracts through the surface, it only reflects. Hence, beyond this angle, you only see the reflection of the underwater environment. Since Psunami models the underwater environment as a solid color, you see a solid color on the water surface when viewing beyond this angle.

The transition to total internal reflection is very abrupt and gives the underwater environment its characteristic look. Since the color in the total internal reflection region is completely determined by the underwater color, you can adjust this color by changing the ocean color. Outside the total internal reflection region you see sky and glitter, so the surface colors in this region are changed by changing the sky color and glitter color.

Because of total internal reflection, underwater scenes are very boring if you look towards the horizon. They are most interesting if you view the surface at an angle that encompasses both total internal reflection and high transmission regions of the ocean. If you are looking up at an angle where you don't see any total internal reflection, then moving lights into the scene so that you can see the glitter pattern will make the scene much more interesting.

As you watch the waves move, observe the main characteristic of ocean wave propagation: Waves with longer wavelengths move faster than waves with smaller wavelengths. As a large wave passes by, the small waves will appear to move up and over the large waves. The more waves you generate, the more realistic the simulation looks. You control the number of waves in the simulation with the ocean complexity property.

Swells are long-distance waves

A second class of waves is swells. Swells are long wavelength waves that are generated by storms or seismic activity a long way away. They can travel long distances without breaking up, so are frequently present in a scene independent of the wind condition. It is the swells that turn into large beach breakers when they approach the shore.

The basic structure of a swell is determined by its wavelength, height, and direction. In Psunami, a swell appears as long rows of waves propagating in a given direction. It has an identical peak at every wavelength and looks uniform when viewed down a crest.

To make the swell more realistic, Psunami adds controls that introduce height modulation along the direction the swell is propagating and along the crests. The Roughness property adds structure along the crest of a swell, and the Oscillations property adds structure in the direction of propagation, making successive wave trains have different heights. By further increasing this property you can break each wave train up into multiple wave trains and make the swells increasingly complex.

Ocean Lighting

The ocean surface itself is a partially reflective surface. When a light ray hits water, it breaks into two rays: a reflected ray and a refracted ray. The reflected ray bounces off the surface as if it was a mirror and the refracted ray gets bent and then passes through the surface.

The energy of the initial ray is divided between the two rays depending on the angle the light ray hits the ocean surface, and whether it hits the surface from below water or above water. Because of this, a water surface looks much different when viewed from above or below.

Above-Water Ocean Lighting

When you look down on an ocean surface you see a combination of the above water environment reflected off the surface and the below water environment refracted through the surface. The relative proportion of the two is determined by the angle at which you look at the water surface. If your view is just grazing the surface, you mainly see reflections of the above water environment and very little of the below water environment.

As you look into the wave you see more and more of the underwater environment and less and less of the above water environment. When you are looking straight into the water, almost all of the light you see comes from underwater.

You can control the transition from seeing mainly above water reflections to mainly below water refractions by changing the index of refraction. As you increase this value of the index of refraction the image becomes increasingly dominated by above water reflections.

Glitter

In Psunami, the above water environment consists of volumetric air and some light sources, both of which reflect off the water. Since the air is a diffuse light source, it reflects off the ocean no matter which direction you look, so the color on the peaks of waves will always be that of the sky. In addition, when you look towards a light source you will see the direct reflection of the light off the ocean.

This is known as 'glitter' and appears as very bright highlights on the waves with the color of the light. When the light is near the horizon the glitter pattern is narrowly focused in the light direction. As the light rises from the horizon the glitter pattern broadens out and breaks up. As the light passes overhead the glitter disappears.

If you are looking straight down the effect is the opposite. When the light is overhead you see a strong glitter pattern and as the light approaches the horizon the glitter disappears.

Water color

In deep water when you look down into it you see a solid color, which represents the color of the water volume just below the surface. The color is generated by the light sources in the sky refracting through the surface, scattering through the volume many times, and ending up back at the surface. The lower the lights are to the horizon, the darker the water gets, since less light refracts through the surface.

Psunami models the ocean color as an effective reflection coefficient that multiplies the color of the lights in the sky times a darkening factor that reduces the contribution of a light as it gets lower in the sky. In Psunami, this effective reflection coefficient is called the ocean color. If your lights are white then this will be the actual ocean color; otherwise it will be the ocean color times the light color. You can simulate different types of water by simply changing the ocean color.

Tips for simulation

In summary, the total color of the ocean is determined by the sky color when you look towards the horizon and the underwater color as you look down. Both of these colors can be independently controlled and are equally important for getting the desired ocean look.

For simulating a deep ocean, make the ocean color a dark blue. If you want to simulate a gray, winter day then make the sky gray. The combination of the gray sky reflection and dark blue underwater color gives an excellent looking winter ocean. If you want to simulate a muddy river, make the ocean color brown and use a natural sky. The combination of the blue sky reflection and the brown upwelling color gives an excellent muddy river look.