Ripple Equation

Contents

Introduction

Perturbations

Ripple Equation

First Simulation Using Sphere Mapping

To generate ripples on the mesh, a similar equation is derived from the sine wave equation combined with the circle equation. By looking at the Figure 6, the circle equation can be written as:


Figure 6. Circle on XZ plane.

If the sine wave equation is applied to the radius, ripples are created; therefore the final ripple equation can be written as:

y(r) = a * sin(kr - p) (Equation 5)

where
x = X-axis value
y = Y-axis value
a = wave amplitude
k = wave number (frequency)
p = phase shift
r = radius, or

Perturbations Combined

If each perturbation function (ripple or directional wave) is written as wk(x, z), the final mesh perturbation is the sum of all functions such as:


(Equation 6)

n = number of perturbations.
y = Y-axis value
p(x,z) = final perturbation function

Implementing of all these equations (4, 5, and 6) together is straightforward. The program just loops though all vertices of the mesh applying equation 4 or 5 (depending on the type of perturbation) to the X and Z mesh values. Then it sums the Y coordinate results of each perturbation and stores the final result back on the mesh vertex data. It is important to note that as the original mesh was created as flat rectangular mesh divided into slices, the finer the mesh (that is, the more polygons), the more accurate the waves are. However, more calculations are necessary. The pseudocode in listing 2 shows how these sums of perturbations can be implemented, as well as the perturbation data structure used in the sample program. [view Listing 2]

________________________________________________________

First Simulation Using Sphere Mapping