Boat and Wave Simulation
by Drew Schulz
Description
Explore the sea on a boat! This graphics demo is meant to be an interactive display of a boat on the sea, using sinusoidal movements to represent boyancy. Users can explore the small sea to look at various islands placed on the water. While interactive, this project is mostly a display of texture mapping, alpha mapping, texture lighting, and small animations. The ocean is the most animated feature, because all vertexes in the mesh are constantly moving, as well as texture coordinates.
Features
- Ability to drive the boat using WASD controls. (To quit press "q")
- Boat physics mechanics. Boat can accelerate and decelerate on the water.
- Boat boyancy physics. Uses a simple sinusoid equation to change boat rotation and y-position translation. Based on an internal delta step. Y-position is calculated by finding derivative of the current sinusoid calculation.
- Use of Triangle strips to create water surface.
- Ripple Tank behavior for water with interference. Calculation of y-position of all vertices using sin(sqrt(x^2 + z^2)). For a simple display of interference, multiple ripples are created, and the average y-position is given to each vertex in the water mesh.
- Dynamic texture coordinate changes for water to simulate real water movement. Calculation of texture coordinates is based off of the Ripple Tank equation.
- Using alpha mapping on textures to create transparencies with certain objects, such as palm leaves.
- Texture Lighting support.
- Texture support for spheres and inverted spheres, such as the sky box.
- Bounds for boat's ability to travel.
- Particle system used to simulate water droplets in front of the boat.
Pictures
TexturesUsed
Sources
- RippleTank - Explanation of a RippleTank
- SphereTexturing - Equations for mapping textures to spheres.
- TextureBlending - Reference to blending textures for transparency.
- Water Tutorial Base Code - Base code for creating water movements. (Note, I did not use any of the rendering code or OpenGL code. I only used the algorithm to update the vertices and to find out the wave equation to use. I modified this code to a large amount to change the number of triangles generated in the water mesh, as well as inserting glm support for vector objects. Use of perlin noise was discarded for my project, only calculation of vertex y-positions and normals remain.)
Texture Sources
I do not own any of these textures, they were only used for this project.
Download
Warning: code only guaranteed to work on linux machines. Has not been tested for Mac.
boatSim.tar