# 3D Sine Wave Study w/ Papervision3D

13 Aug 2007A wavey liquid surface being hit by rocks.

Controls:

**D**lowers the level of detail

**T**cycles through different textures

**B**cycles through texture blend modes

**W**shows the 3D wireframe

**+/-**moves the camera in and out

**Spacebar**pauses the action, allowing you to rotate around the scene

Each 'splash' is a heightmap of z-values that correspond to the vertices of the plane (instance of the PV3D class `Plane3D`

). For each value in the heightmap, we start with a sine function, where the 'angle' is the distance from the center of the splash plus an offset value that is incremented over time. Distance is also used to determine the sine wave's decay. Finally, a multiplier variable going from 1 to 0 is used to flatten the heightmap over the life of the splash.

To make the plane look more dynamic, a wavey-looking heightmap is created (again, using `Math.SIN`

) with some parameters for period and amplitude that decrease slowly, but increase when rocks hit the surface.

Each heightmap is then simply added to the z-values of the flat plane's vertices. (The x and y values stay constant).