Unfortunately, Flash doesn't support floating point textures, so everything had to be stored per vertex. Due to limitations in how (I think that) Flare3D works, custom vertex data can be assigned to a Surface3D on top of a mesh (such as a Plane, as is used in this simulation). Due to either a bug or misunderstanding, only a single piece of additional data could be added to each vertex, with a maximum of four components. With that in mind, I added a single color channel to each vertex; in other words, each vertex had X, Y, Z, and W components in a Surface3D in addition to its usual XYZ. Using PixelBender, the vertex data is sent into various shaders, such as simulation update, normals update, and water droplets (which is used when the mouse is moved to disturb the surface, and also for rain). The four components mentioned earlier represent the height, velocity, normal X, and normal Z respectively. In the final shader, the complete normal is recomputed from the Z and W components of the vertex color (normal X and normal Z), and the position of each vertex is offset by its corresponding height. The shader also includes blended normal maps, specular highlights, diffuse lighting, sunlight simulation, cubemap reflection, scene reflection and refraction, wave colors, and foam colors.