OpenGL 2 Alien World

An OpenGL 2 project written using C++ for my Computer Graphics course in university.

>> Source Code <<

Scene Description:

A wavy ocean under a starry sky. A ufo launches and darts around using its powerful spotlight to survey this area of the planet. It has a translucent cockpit, a spinning ring of lights, and flickering lights below used to communicate its findings. Two aliens wander around, exploring a newly discovered small group of islands. The aliens have set up a strange cannon-like apparatus to test the properties of an anomaly in the sky.

Controls:

  • W - Move forward.
  • A - Move left.
  • S - Move backward.
  • D - Move right.
  • Space - Increase height and activate UFO launch.
  • Shift - Decrease height.
  • Mouse Move - Look around.
  • L - Leave the scene.

Features:

  1. Planar shadows -

    Both of the aliens have shadows. The cannon, its projectiles, and the anomaly also have shadows.

  2. Moving spotlight -

    The UFO shines a spotlight down as it darts around.

  3. Sky dome -

    A starry sky dome is used to minimize distortion.

  4. Surface of revolution -

    The UFO shape is constructed by creating quad rings at intervals with their top and bottom radii calculated by a parabola function. Its normals are calculated using the slope of this function via the derivative.

  5. Mathematically generated surface shape -

    The ocean is a grid of quads with a modified sine wave running in the x direction and a different wave in the z direction. These are averaged to define the height of the wave. This approach came with performance issues, and so I programmed it to generate the vertices with larger gaps the further they are from the camera. This allows for an ocean with smooth detail up close and a vast scale from afar without the performance issue.

  6. Physics model -

    The cannon fires randomized projectiles that orbit the anomaly by applying gravity but without affecting the anomaly. Also they explode if they hit the anomaly or after a delay.

  7. Spaceship liftoff -

    On pressing space the UFO turns on and then propels itself, accelerating upwards.

  8. Particle systems -

    I adapted the provided particle system code to have a XZ quad due to the vertical nature of my scene. I created three different emitters; downdraft (Blue), explosion (Orange), and flames (Yellow).

External sources:

I adapted code from the lab for; quadric texture mapping, planar shadows, and particle drawing.

V Textures V

Labs - Glow.bmp

tilingtextures.com - Wall.bmp

polyhaven.com - Sky.bmp

solarsystemscope.com - Sun.bmp