Ocean Waves

Joe Rho

Introduction & Goals

For my final CPE 471 project, I created a scene. More specifically, I procedurally generated ocean waves with an infinite effect. I also added a skysphere in the scene to make it look more real.

The main goals for this project were:

  • Render realistic ocean waves.
  • Create an infinite effect for the waves.
  • Create a skysphere to make the scene more realistic.

Scene of Project

Interaction

To interact, the camera can be moved with mouse scroll and the WASD keys. The y - component of the camera position was fixed so that users could not go through, or above the water level.

Generating Waves

The platform for the waves was created with a 50 x 50 plane. This was done with the usage of VAO and IBO. I manipulated the vertices of the plane using trigonometric equations. Then, I added a water texture to make it look more realistic.

Waves

To give the infinite effect of the waves, I sent an offset of the x and z values of the camera position to the shaders. Then, in the shaders, I added these offsets to the plane. This creates a treadmill-like effect which is one way to mimic an infinite plane.

Skysphere

To create a skysphere, I rendered a sphere with a sky texture. First, I disabled depth test, translated the sphere to the camera position, so that the sphere would be directly on top of the camera. Then I enabled depth test again so that other objects can be seen in the scene.

Skysphere

Resources

  • General OpenGL tutorials http://learnopengl.com & http://ogldev.atspace.co.uk/index.html