The goal of this assignment was to write shaders and to learn various techniques for performing surface perturbation and lighting tasks. Our extension animated waves and added a droplet type effect.

We modified our displacement mapping in our vertex shader so it now took in time as a parameter. With this new parameter we could express our height function as a function of position as well as time. The waves are created by a combination of sine and cosine waves and the droplet affect is also a sine wave that is a function of the distance from the center of the texture as well as time.

The following was used to generate the regular waves:

$val1\; =\; a1*\; cos(\; 2\pi f\; *\; (u\; +\; c1*t))\; *\; cos(2\pi f\; *(v\; +\; c2*t))$

$val2\; =\; a2\; *\; sin(\; 2\pi f\; *\; (u\; +\; c3*t))\; *\; sin(2\pi f\; *\; (u\; +\; c4\; *t))$

$val\; =\; val1\; *\; (t)\; +\; val2\; *(1.0\; -\; t)$

$val3\; =\; a2*\; sin(2\pi f\; *\; ((c5*u\; +\; c6*v)\; +\; c7*t))$

$val\; =\; val1\; +\; val2\; +\; val3$

$val2\; =\; a2\; *\; sin(\; 2\pi f\; *\; (u\; +\; c3*t))\; *\; sin(2\pi f\; *\; (u\; +\; c4\; *t))$

$val\; =\; val1\; *\; (t)\; +\; val2\; *(1.0\; -\; t)$

$val3\; =\; a2*\; sin(2\pi f\; *\; ((c5*u\; +\; c6*v)\; +\; c7*t))$

$val\; =\; val1\; +\; val2\; +\; val3$

where val is the calculated height of the wave at point u v.

To calculate the droplet-like animation we used the following equation:

$val4\; =\; a*\; sin(dist\; *2.0\pi f\; *\; t)$

and this val4 was added to val( the final height of the point). To have the droplet-like effect fade out we used eased it out as we eased the other function in.