### Previous Work

Much of the previous work in modeling ocean waves has been based on using
height fields. The idea here is that for every point on the plane your surface
has some height value at which it lies. The difficulty with this model from
our point of view was that we wanted to implement breaking waves which
required our surface to potentially have two height values at the same point
on the plane. As a result we took the approach of using a set of parametric
equations that describe the surface of the wave over time. These equations
were based on those presented in a SIGGRAPH paper in 1986 by Bill Reeves and
Alan Fournier. Basically the equations are an approximation of the
Navier-Stokes wave equations, replacing some of the more computationaly
expensive parts of the formulas with approximations. The basic equations are
basically some constants time the sin and cosine of a phase angle. From the
basic equations we procede to add hacks to model select phenomena about waves.

### Wave Phenomena

#### Refraction

One of the effects we wanted to be able to take into account was the effect
of the depth of the ocean on the direction of the wave. Basically as the
depth of the ocean, the height from the ground to the water level at rest,
becomes very small the direction of the wave fronts refracts to take on the
contours of the ground. If you look at the following image you will notice
this effect taking place. The wave is traveling from left to right over a
ground that slopes from a depth about 4 times of the wavelength to a depth
of almost zero. It starts with an angle of refraction slight less than 30
degrees and by the time the wave has reached the wavefront has become nearly
vertical to resemble the shape of the shore. Variation amongst the waves
has been removed here to more clearly show the refractino of the wave.

#### Depth Effect

Another effect that the model takes into account is the shortening of
wavelengths due from decreasing depths. This is accomplished by making the
phase angle a function of depth. Basically what the equations are doing is
taking singular grid points and sending them in cirular orbits acoording to
a phase angle. As we move forward along the wave we incriment the phase angle
by some value k which is dependent upon the height. As height decreases, k
increases and the effect is that we go around the circle quicker and in a
shorter distance, resutling in a shorter wavelength.

#### Wind Effect

Another effect the model takes into account is the effect of a strong wind
on the wave. On a windy day the wind will blow in towards the shore, pushing
against the back of the wave. This results in a steep front of the wave
and a gradual sloping on the back. This effect was accomplished through a
complete hack. Basically we add a component to the phase of a point on the
surface based upon its height, which results in pushing the top of the
wave forward.

#### Breaking

In order to model breaking, the model once again adjusts its equations.
Breaking occurs because the cirucular orbits of the water become more
and more elliptical as the wave gets closer to shore. The circles become
flatter and elongated. This is accomplished by multiplying the height and
width by factors that grow and shrink at low depths. Unfortunately this
does not seem to produce waves that break very convincingly. Also it
introduces possible discretization errors. If the depth changes too radically
with respect to the number of points being sampled, the problem results when
the phase increases too radically from one and a shallower point actually
winds up behind the previous point making it look like the wave goes
backwards. The simple solution was to increase the number of points being
sampled, also it was possible to make the step size in particles dependent
upon the height.

#### Variation

Another aspect we wanted to add to the model was variation amongst the waves.
Since all waves were not created equal we varied both the height and phase
angle along one wave crest and between wave crests. The effect of modulating
the phase is to make the wave crest at one point while the rest of the same
wave is still beginning to swell. In reality this effect is usually generated
from differences in the contours of the ground beneath the wave. However,
we modeled our ground as a series of planar ramps, and so we used variation
in the phase to get the same effect. To produce the variation we used a
very low frequency noise function that barely varied over the width of the
wave while varying more frequently from wave to wave.

#### Spray and Foam

In addition to the model for the surface of the wave, a particle system was
added to get the effect of foam and spray. Whenever a particle on the wave
reached a speed that was greater than the wave speed it would break off. At
this point, if it was above a certain threshold we would send the particle
flying off as spray. Otherwise it would turn into foam at that point on the
surface. Foam would persist for a random life and then die, while spray
would die once it dissapeared below the wave.