How zydak/vulkan-path-tracer works
Project type and purpose
• This is a native desktop, full-stack graphics application: an offline, physically-based path tracing renderer built on Vulkan with the Ray Tracing Pipeline extension.
• It provides an interactive editor UI (via ImGui), a scene loader (.gltf, .obj, .ptscene), a GPU-based ray tracer, and post-processing (denoiser, bloom, DOF, etc.) with output to screen and PNG files.
File structure
• Top-level:
• Gallery/ – sample renders and material-showcase images
• Vulkan-Helper/ – a submodule/library encapsulating Vulkan setup and shader compilation (Shaderc)
• PathTracer/ – the core application:
– premake5.lua, vk_layer_settings.txt, imgui.ini – build and runtime configs
– assets/ – scene geometry, HDR maps, lookup tables, .ptscene files
– src/ – C++ code (Application, Editor, PathTracer core, EnergyLossCalculator, PostProcessor, main)
– src/shaders/ – Ray Tracing and graphics shaders (.slang, .glsl)
• Build scripts: premake5.lua, setup.bat, premake5.exe
• External dependencies: Vulkan SDK, Shaderc, ImGui, OptiX, glTF/OBJ loaders
README for additional insights
• The project uses:
• Vulkan Ray Tracing (KHR_extension family)
• Energy-conserving BSSRDF with multiple lobes, anisotropy, volume scattering
• Post processing (bloom, chromatic aberration, AO, DOF)
• NVIDIA OptiX for denoising
• Editor for real-time scene tweaking and export
a. Main components
1. UI / Editor Layer
– ImGui-based scene inspector, material editor, render controls
2. Application Core
– Application.cpp: initializes Vulkan via Vulkan-Helper, handles window/input (GLFW), command loop
– Scene Manager: loads assets (.gltf/.obj/.ptscene), builds acceleration structures
3. Path Tracer Engine
– Ray Tracing Pipeline setup (rgen, rmiss, rchit, rtmiss shaders)
– EnergyLossCalculator module (BSSRDF, microfacet, volume scattering)
4. Post Processor
– Full-screen quad pass for bloom, tone mapping, chromatic aberration, DOF
– NVIDIA OptiX denoiser integration
5. Asset I/O
– Disk I/O for geometry, textures, HDR maps, lookup tables
– Scene serialization / export (PNG)
6. Vulkan-Helper Library
– Encapsulates instance/device creation, swapchain, descriptor set layouts, pipeline wrappers, shader compilation via Shaderc
7. External Systems
– Vulkan API (GPU driver)
– Shaderc (SPIR-V compiler)
– NVIDIA OptiX SDK
b. Relationships and interactions
• The Application Core calls Vulkan-Helper to initialize Vulkan, window and swapchain.
• UI Layer interacts with Scene Manager and Engine parameters at runtime.
• Scene Manager feeds Geometry + Material data to the Path Tracer Engine.
• The Path Tracer Engine dispatches ray tracing commands to the GPU via Vulkan.
• Engine outputs a raw image buffer, passed to Post Processor for effects.
• Post Processor writes to the swapchain for display and to disk for PNG export.
• OptiX denoiser is invoked after the raw path-traced buffer and before or as part of Post Processor.
c. Architectural patterns and design principles
• Modular separation: Editor, Engine, Post Processor, Helper Library
• Data-driven design: assets/lookupTables control shading behavior without code changes
• Pipeline abstraction: heavy use of Vulkan pipelines (ray tracing pipeline + graphics pipelines)
• Resource management: explicit descriptor sets and command buffers
d. Relevant technologies, frameworks, or libraries
• Vulkan SDK with KHR ray tracing extensions
• Shaderc for on-the-fly shader compilation
• ImGui for editor UI
• GLFW (or platform windowing)
• NVIDIA OptiX for denoising
• TinyGLTF / TinyOBJLoader (implied by .gltf/.obj support)
Elements
• UI → Application Core (commands/parameter changes)
• Application Core → Vulkan-Helper (init, commands)
• Application Core → Scene Manager → Path Tracer Engine
• Path Tracer Engine → Post Processor → Swapchain/PNG
• Path Tracer Engine → NVIDIA OptiX (for denoising)
• Disk → Asset I/O → Scene Manager
• CPU components (light blue)
• GPU pipelines/shaders (orange)
• External libraries/SDKs (gray)
• Labels for Vulkan extensions (e.g., VK_KHR_ray_tracing_pipeline) on the Path Tracer Engine
Final recommendations
• Shaders (.slang, .glsl) under the “GPU Shading Pipeline” sub-component
• Lookup tables directory feeding the EnergyLossCalculator
• Explicitly note the premake/build step feeding into the generated Visual Studio solution