Croissant - Real-Time Vulkan Renderer
• Completed
ComputerGraphics Vulkan C++
Real-time, Physically Based Renderer Built with Vulkan and Modern C++17.
About
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.
Render Samples

s





Features
- 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.
Code Structure
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
Third Party Libraries
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 fro graphics software.
- ImGui: GUI.
- stb_image: Image encoding/decoding.
- Tracy: Frame profiler.
- Vulkan-Loader
- Vulkan-Tools: Validation Layers.
Render Graph


Usage
/* 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;
}
Controls
| Input | Action |
|---|---|
| RMB drag | Rotate Camera |
| Scroll wheel | Zoom in/out |
Dependencies
- cmake >= 3.9.1
- gcc >= 9.4.0
- vulkan-validationlayers-dev
- spirv-tools
- glslc
Building on Linux
$ 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.
Tested Toolchains
| Compiler | Operating System | Architecture |
|---|---|---|
| GCC 9.4.0 | Linux Ubuntu 20.04.4 with kernel 5.8.0-53 | x64 |
References
- 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.
Included Assets
The following assets are bundled with the project:
HDRs
- 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).
Models
- 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).