All Projects → kondrak → quake_bsp_vulkan

kondrak / quake_bsp_vulkan

Licence: MIT license
Quake BSP renderer written in C++ and Vulkan

Programming Languages

C++
36643 projects - #6 most used programming language
java
68154 projects - #9 most used programming language
c
50402 projects - #5 most used programming language
CMake
9771 projects
GLSL
2045 projects
Makefile
30231 projects

Projects that are alternatives of or similar to quake bsp vulkan

The Forge
The Forge Cross-Platform Rendering Framework PC Windows, Linux, Ray Tracing, macOS / iOS, Android, XBOX, PS4, PS5, Switch, Quest 2
Stars: ✭ 2,710 (+3465.79%)
Mutual labels:  vulkan, vulkan-api
racket-vulkan
Racket integration with all things Vulkan 💥
Stars: ✭ 40 (-47.37%)
Mutual labels:  vulkan, vulkan-api
Vulkan Renderer
A new 3D game engine using modern C++ and Vulkan API
Stars: ✭ 205 (+169.74%)
Mutual labels:  vulkan, vulkan-api
Clvk
Experimental implementation of OpenCL on Vulkan
Stars: ✭ 158 (+107.89%)
Mutual labels:  vulkan, vulkan-api
clustered forward demo vk
Clustered forward rendering demo with Vulkan
Stars: ✭ 50 (-34.21%)
Mutual labels:  vulkan, vulkan-api
Awesome Vulkan
Awesome Vulkan ecosystem
Stars: ✭ 2,322 (+2955.26%)
Mutual labels:  vulkan, vulkan-api
Kazan
Mirror; Work-in-progress software-rendering Vulkan implementation
Stars: ✭ 226 (+197.37%)
Mutual labels:  vulkan, vulkan-api
Pasvulkan
Vulkan header generator, OOP-style API wrapper, framework and prospective Vulkan-based game engine for Object Pascal
Stars: ✭ 134 (+76.32%)
Mutual labels:  vulkan, vulkan-api
Vulkano
Safe and rich Rust wrapper around the Vulkan API
Stars: ✭ 2,950 (+3781.58%)
Mutual labels:  vulkan, vulkan-api
Wolf.engine
The Wolf is a comprehensive set of C/C++ open source libraries for realtime rendering, realtime streaming and game developing
Stars: ✭ 230 (+202.63%)
Mutual labels:  vulkan, vulkan-api
Gapid
GAPID is a collection of tools that allows you to inspect, tweak and replay calls from an application to a graphics driver.
Stars: ✭ 1,975 (+2498.68%)
Mutual labels:  vulkan, vulkan-api
RTX-Mesh-Shaders
Different mesh shading techniques using the NVIDIA RTX (Turing) technology.
Stars: ✭ 84 (+10.53%)
Mutual labels:  vulkan, vulkan-api
Simple vulkan synchronization
A single-header library with a simplified interface for Vulkan synchronization
Stars: ✭ 153 (+101.32%)
Mutual labels:  vulkan, vulkan-api
Vortice.Vulkan
Cross platform .NET bindings for Vulkan, VMA, SPIRV-Cross and shaderc
Stars: ✭ 172 (+126.32%)
Mutual labels:  vulkan, vulkan-api
Diligentsamples
Sample projects demonstrating the usage of Diligent Engine
Stars: ✭ 138 (+81.58%)
Mutual labels:  vulkan, vulkan-api
Yave
Yet Another Vulkan Engine
Stars: ✭ 211 (+177.63%)
Mutual labels:  vulkan, vulkan-api
Vulkan Samples
One stop solution for all Vulkan samples
Stars: ✭ 2,009 (+2543.42%)
Mutual labels:  vulkan, vulkan-api
Vrt
🔅 Ray tracing library for Vulkan API (indev)
Stars: ✭ 111 (+46.05%)
Mutual labels:  vulkan, vulkan-api
Lugdunum
[UNMAINTAINED] A modern cross-platform 3D engine built with Vulkan, glTF 2.0 and modern C++14.
Stars: ✭ 230 (+202.63%)
Mutual labels:  vulkan, vulkan-api
vkel
Simple Dynamic Vulkan Extension Loader
Stars: ✭ 39 (-48.68%)
Mutual labels:  vulkan, vulkan-api

Quake BSP map viewer in Vulkan

This is a multithreaded BSP tree Vulkan renderer written in C++ and a port of the same viewer written in OpenGL. It handles basic geometry and curved patch rendering but with no support for game-specific shaders, entities etc. It implement PVS and frustum culling so performance is optimal. At the moment only Quake III Arena maps are supported but an interface is provided for adding other BSP versions in the future.

Screenshot

Building

The project should work out of the box with latest Vulkan SDK (tested against SDK 1.1.82.1) and Visual Studio 2015+

Building on Linux and MacOS

Assuming that the Vulkan SDK is already downloaded and properly set up on your target platform:

  • set the VULKAN_SDK environment variable pointing to the location of downloaded Vulkan SDK
  • download and install SDL2 (libsdl2-dev 2.0.7 or higher for Linux, SDL2.framework 2.0.8 or higher for MacOS)
  • run the Makefile (Linux) or XCode project (MacOS) to build the application

MacOS uses the Vulkan loader bundled with the SDK, rather than directly linking against MoltenVK.framework. This is done so that validation layers are available for debugging.

Building for mobile: iOS and Android

Disclaimer: there are no plans to introduce mobile-specific controls in the application, since its purpose is solely to demonstrate how to pull off a Vulkan renderer that "just works". For clarity, both Android and iOS code makes use of SDL2 in the same way as the desktop version - this is a terrible idea and something you should NOT do in your own applications. The proper way is to make direct use of the native APIs for minimum overhead.

Requirements:

  • set the VULKAN_SDK environment variable pointing to the location of downloaded Vulkan SDK
  • download and extract SDL 2.0.8 source code (NOT runtime libraries!) into contrib folder

Android:

  • Android Studio 3.0 or higher with CMake and Android SDK installed
  • Android NDK with ANDROID_NDK_HOME environment variable set and pointing to its location (using latest NDK is highly recommended due to better validation layer support)

Enter the android folder and run ./gradlew assembleDebug for debug build (with validation layers enabled by default) or ./gradlew assembleRelease for release build. This application uses dedicated Vulkan loader code on Android instead of linking directly to dynamic library in the NDK, so it's possible to run it on Vulkan-capable hardware with API level 23 or lower.

iOS:

  • XCode 9.0 or higher, MoltenVK requires iOS 9+ to work

Running the project in XCode should work out of the box. The build may fail if the textures and models folders don't exist in the repo root directory - if you want to run the app regardless, simply remove them from resources and "Copy Files" build steps. Note that iOS version does not support a dedicated Vulkan loader or validation layers - this is a Vulkan SDK limitation that may be removed in the future. Simulator builds are also not available due to lack of Metal support.

Usage

Running the viewer:

QuakeBspViewer.exe <path-to-bsp-file>

Running the viewer with multithreaded renderer:

QuakeBspViewer.exe <path-to-bsp-file> -mt

Use tilde key (~) to toggle statistics menu on/off. Note that you must have Quake III Arena textures and models unpacked in the root directory if you want to see proper texturing. To move around use the WASD keys. RF keys lift you up/down and QE keys let you do the barrel roll.

OpenGL vs Vulkan

Performance comparison between OpenGL, Vulkan and Vulkan multithreaded versions (tested on Intel i5 and GTX 970). Differences become more apparent as the amount of rendered geometry increases. All measurements are average values collected when rendering the attached sample BSP with all textures present:

PVS + Frustum full BSP render
OpenGL 0.98ms (1025 FPS) 6.89ms (145 FPS)
Vulkan 0.38ms (2615 FPS) 1.01ms (983 FPS)
Vulkan MT 0.37ms (2635 FPS) 0.69ms (1450 FPS)

Sidenote: The application detects and uses maximum number of threads when launched in multithreaded mode. Because of this, as the number of available threads increases, you might notice a slight performance degradation when compared to singlethreaded version. This is expected, since the visible faces are divided between threads without taking into consideration the BSP leaves they belong to. This might lead to a situation where with large amount of threads the work is not evenly distributed if PVS and frustum culling are enabled. Since this is a "proof of concept" project, there are no plans to improve this behavior.

Dependencies

This project uses following external libraries:

Vulkan code overview

For people interested in learning Vulkan and jumping into core features, the renderer/vulkan folder contains all files related to creating buffers, instances, surfaces and command lists. Note that this is not an attempt at writing an overly abstract rendering engine and few settings are tailored for this particular project. Core BSP and overlay rendering is done in src/Q3BspMap.cpp and src/renderer/Font.cpp. Global Vulkan handles (instance, device, etc.) are stored in src/RenderContext.cpp.

Keyword list:

  • multiple pipeline rendering
  • multithreaded command buffer generation (double buffered primary presentation buffers and secondary buffers for threads)
  • pipeline dynamic state, derivatives and cache
  • uniform buffer objects and push constants
  • texture mapping (filtered and unfiltered)
  • memory allocation handled using VMA
  • validation layers enabled by default in debug builds
  • multisampling (MSAA) using maximum sample count supported by hardware
  • mipmapping

Vulkan references

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].