Real-time, Physically based renderer built with Vulkan and modern C++17.
The aim of this project was to create a properly functioning render graph that would allow me to learn and experiment with Vulkan, as well as provide an opportunity to learn graphics techniques.
This project is under development, expect API changes, bugs and missing features.
Renderer
- Physically based rendering(Cook–Torrance BRDF)
- Image based lighting
- Forward rendering
- Multisample anti-aliasing (MSAA)
- HDRI skymap loading
- Compute shaders
- Shadow mapping
- Normal mapping
- Different light types (directional, point and spot lights)
- Texture mipmaps
- Arcball camera
- GUI
Other Features
- Multi-threaded texture asset importing
- Model loading
Croissant
|
|-- assets
| |-- models # Meshes and textures
| `-- skybox # HDR files with their generated irradiance, prefiltered env. and BRDFlut textures
|
|-- bin # Contains the executable files
|
|-- build # CMake compile
|
|-- include # Project header files
| `-- Settings # All user tweakable settings files(scene, camera, pipeline, etc)
|
|-- libs # Dependencies
| |-- ASSIMP
| |-- GLFW
| |-- GLI
| |-- GLM
| |-- Dear imgui
| |-- stb_image
| |-- tracy
| |-- Vulkan-Loader
| `-- Vulkan-Tools
|
|-- shaders
|
|-- src # C++ implementation files
| |-- Buffer
| |-- Camera
| |-- Command
| |-- Computation
| |-- Descriptor
| |-- Device
| |-- Features
| |-- Framebuffer
| |-- GUI
| |-- Image
| |-- Math
| |-- Model
| |-- Pipeline
| |-- Queue
| |-- Renderer
| |-- RenderPass
| |-- Scene
| |-- Shader
| |-- Swapchain
| |-- Texture
| |-- VkInstance
| `-- Window
|
`-- CMakeLists.txt # CMake build script
Here's the list of the libraries included in the project:
- ASSIMP: Mesh and material loading.
- GLFW: A multi-platform library for window and input.
- GLI: Image library(used to generate the BRDFlut texture).
- GLM: Mathematics library for graphics software.
- ImGui: GUI.
- stb_image: Image loading/decoding.
- Tracy: Frame profiler.
- Vulkan-Loader
- Vulkan-Tools: Validation Layers.
- The renderer currently only works with a dedicated graphics card, but I will add compatibility with integrated GPUs in the future.
- To start the renderer, you need to add one skybox, one directional light, and at least one model.
- To add a model or skybox to the render, add the folder in 'assets'.
- Modify the config.h file in 'Settings' to change a lot of parameters.
/* Commands:
*
* - addSkybox(fileName, folderName);
* - addObjectPBR(name, folderName, fileName, position, rotation, size);
* - addDirectionalLight(name, folderName, fileName, color, position, targetPosition, size);
* - addSpotLight(name, folderName, fileName, color, position, targetPosition, rotation, size);
* - addPointLight(name, folderName, fileName, color, position, size);
*
* - demo1(); // Damaged Helmet
* - demo2(); // AK 47
* - demo3(); // Collier Flintlock Revolver
* - demo4(); // Sponza day
* - demo5(); // Sponza night
* - demo6(); // Metal Rough Spheres
*/
int main()
{
Renderer app;
try
{
// Scene
{
app.addSkybox("fileName.hdr", "folderName");
app.addObjectPBR(
"name",
"folderName",
"fileName",
glm::fvec3(0.0f), // Position
glm::fvec3(0.0f), // Rotation
glm::fvec3(1.0f) // Size
);
app.addDirectionalLight(
"name",
"folderName",
"fileName",
glm::fvec3(1.0f), // Color
glm::fvec3(0.0f), // Position
glm::fvec3(1.0f), // Target Position
glm::fvec3(1.0f) // Size
);
}
app.run();
} catch (const std::exception& e)
{
std::cerr << e.what() << "\n";
return 0;
}
return 0;
}
Input | Action |
---|---|
RMB drag | Rotate camera |
Scroll wheel | Zoom in/out |
- cmake >= 3.9.1
- gcc >= 9.4.0
- vulkan-validationlayers-dev
- spirv-tools
- glslc
$ git clone --recurse-submodules https://github.com/SaferGo/CroissantVulkanRenderer.git
$ cd CroissantVulkanRenderer/build
$ bash buildReleaseMode.sh
// or buildDebugMode.sh
After a successful build, the resulting executable can be found in the bin directory.
Compiler | Operating System | Architecture |
---|---|---|
GCC 9.4.0 | Linux Ubuntu 20.04.4 with kernel 5.8.0-53 | x64 |
? | Windows 11 (will be added soon) | x64 |
- Vulkan Tutorial
- 3D Graphics Rendering Cookbook: A comprehensive guide to exploring rendering algorithms in modern OpenGL and Vulkan
- Vulkan Cookbook: Solutions to next gen 3D graphics API
- Hybrid Rendering Engine by Angelo1211
- Vulkan physically-Based Rendering by SaschaWillems
- Shadow Mapping in Vulkan by igalia
- Integrating Dear ImGui in a custom Vulkan renderer
The following assets are bundled with the project:
- Winter Forest and Apartment from ihdri.
- Country Club, Farm Field, Neon Photostudio, Peppermint Powerplant 2 and Shangai Bund from PolyHaven (distributed under CC0).
- Arches PineTree from HdrLabs (distributed under Creative Commons Attribution-Noncommercial-Share Alike 3.0 License).
- Cube from Cesium (distributed under Creative Commons Attribution 4.0 International License).
- Damaged Helmet from theblueturtle_ (distributed under Creative Commons Attribution-Noncommercial-Share Alike 3.0 License).
- Sponza from alexandre-pestana.
- Metal Rough Spheres from Analytical Graphics (distributed under CC-BY 4.0).
- AK 47 Tactical Upgrade from Mateusz Woliński (distributed under CC-BY 4.0).
- Collier Flintlock Revolver from Artem Goyko (distributed under CC-BY 4.0).