Skip to content

flostellbrink/SkyHockey

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SkyHockey - Air Hockey in Space

This is a small physics based Air Hockey game. The project is part of the 2018 CG Course DAT205/DIT226 at Chalmers.

The following features are relevant for the course:

  • Game
  • Deferred Shading
  • Variance Shadow Mapping
  • Motion Blur
  • FXAA
  • Collision detection and basic physics
  • Performance overlay

You, the player, control the blue striker with your mouse and try to push the puck into the opponent's goal. The "AI" opponent is a bit overpowered and will probably stop you from scoring most of the time.

The score board above the field indicates the current score, which is most likely a pretty remarkable lead for your opponent.

In the lower left corner you can find a performance overlay. This indicates the time required for the last 100 frames. The red line indicates a frame time of 1f/30fps, the green one 1f/60fps. As you can see my poor laptop manages 10fps quite easily!

Screenshot

Credits

I am using the following libraries:

I adapted these shader:

This software contains source code provided by NVIDIA Corporation.

Controls

Key Action
SPACE Start the game.
R Change between deferred and forward rendering.
S Toggle animated background on and off.
U/J Increase/Decrease smoothness of shadows.
I/K Increase/Decrease number of motion blur samples.
O/L Increase/Decrease sample step size for motion blur.
T/G Increase/Decrease anti aliasing quality.
P Toggle performance overlay on and off.
Y/H Increase/Decrease performance overlay size.

Rendering

This game has two render modes: Forward and deferred.

When using forward rendering everything is very straight forward. The process for deferred rendering involves a few intermediate states. Let's look at the actual steps:

  1. The Shadow map is rendered from the light's perspective.
    1. 1 Channel: The depth value is normalized and stored. Depth
    2. 1 Channel: The square of the depth is also normalized and stored. DepthSquared
    3. The entire texture is blurred to enable smooth shadows with VSM.
  2. All objects properties are collected in 4 textures. These are the stored channels:
    1. 1 Channel: The objects ids, for looking up material properties: Ids
    2. 3 Channels: The albedo colors, contain the object textures: Colors
    3. 3 Channels: The worldspace coordinates, for shadow mapping: Coords
    4. 3 Channels: The surface normals, for lighting: Normals
    5. 2 Channels: The camera space object velocity, for motion blur: Velocities
  3. The information from all textures is composited into a single texture.
  4. Motion blur is applied to the rendered image.
  5. FXAA is applied to hide aliasing artifacts.
  6. The blurred image is combined with the sharp background.
  7. Finally the performance overlay is drawn ontop of the frame.

Installation

Don't you just love setting up C++ projects? Here we go.

Preparation

  1. Setup your C++ compiler of choice.
  2. Install CMake (Tested with 3.10.3)
  3. Install Python for Conan (Tested with 3.6)
  4. Install Conan as admin: pip install conan

Dependencies

  1. Clone the repository
  2. Navigate into directory: cd SkyHockey/Engine
  3. Get dependencies: conan install . --build missing --install-folder build

Build

  1. Build with conan conan build . --build-folder build

About

OpenGL Air Hockey Game for CG Course at Chalmers

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages