Broken Magic

Description

"Broken Magic" is a graphics demo showing a world full of magic. The camera follows the protagonist, an eagle, which breaks into the scene inside a snow globe. It arrives at a mage tower, where it finds something... On a bookshelf is another snow globe, containing a miniature version of the mage tower. The eagle flies towards the snow globe and breaks into it, where it finds a mage tower with a bookshelf. The snow globe is crushed on the floor, which breaks the magic.

How to start

Edit the "start.bat" to set your resolution, monitor refresh rate and full-screen state. Then double click the "start.bat". Or start the broken_magic.exe directly to use the default settings. With a resolution of 1600x900, the NVIDIA GeForce 780 GTX reaches approx. 30 fps at the most computionally expensive part around the tower. We recorded the video with this set-up.

If it says that DLLs are missing, install the Visual C++ 2017 Redistributable Packages and / or DirectX End-User Runtimes.

Controls

Implementation details

Libraries

We used GLM for all the math stuff with vectors and matrices. We used OpenGl with GLEW for all the OpenGl extension. We used GLFW for input handling, window stuff and OpenGl initialization. We used FMOD to play the music.

Camera

At first, we used a camera moved and rotated by a PID-controller. Later-on, we used a path exported from Blender.

Deferred combined with forward renderer

We want to have the performance improvement of the deferred shading but also want the transparency of the volume rendering. We used the tutorials OGLdev 35, OGLdev 36 and OGLdev 37, which include a nice stencil test for improved performance with small lights.

Volume rendering (for clouds)

We re-use the slice-based volume renderer from the previous project. It bases on the GPU Gems Chapter 39 including the shadowing technique. Instead of sheep wool, it is now used for clouds. We took the cloud generator from the example on Future Data Lab. We switched to a ray-marching approach, because the old slice-based approach was slow due to alternating frame buffers that caused pipeline stalls and a bottleneck in the fragment shader. The clouds themselves are now rendered almost instantaneously. However, the shadows for the clouds are very slow.

Onmi-directional shadow mapping

Our implementation of onmi-directional shadow mapping is based on the lecture scripts from the TU Wien. It uses the geometry shader to render into all faces of a cube map at once.

Known Issues

About the project

We created this demo during the real-time graphics lecture of our studies at the TU Wien. We re-used parts from our engines for the computer graphics exercise. One limitation is that libraries may load e.g. textures from disk to main memory but may not upload it to the graphics card.

Credits

The credits for the models, textures, libraries and so on are in the included license file.

Update 2017-09-10

Switched from slice-based volume rendering to ray marching. The performance is now much better. The demo runs at 30 FPS with a resolution of 1600x900 (previously 1024x768). Also, multiple lights should now work again.