Contents
Download
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 1600×900, 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
- F5: Switch to manual camera (WASD + Space + Ctrl + Mouse)
- F8: Switch through deferred render buffers
- F9: Switch through depth of field buffers
- F10: Switch back through depth of field buffers
- F11: Switch through bloom buffers
- “1”: Increase depth of field focal distance to change the circle of confusion
- “2”: Increase depth of field focal range to change the circle of confusion
- “3”: Reset the focaldistance and focal range
- “4”: Output on depth of field buffer informations
- “5”: Increase HDR exposure
- “6”: Decrease HDR exposure
- “7”: Fast forward 10s
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
- The hardware requirements are extreme. This is caused by the volume rendering for the clouds. This takes about 9/10 of the computation time.
- The bloom can look strange, probably because no tone mapping is applied.
- On some hardware, e.g. NVIDIA GeForce 840M, the depth of field effect causes two horizontal and two vertical lines.
- On some other hardware, e.g. Intel HD, the image is full of noise.
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
- Programming: Philipp Erler, Robin Melán
- Modelling: Robin Melán
- Music: Adrian Gajda
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 1600×900 (previously 1024×768). Also, multiple lights should now work again.