This repository is the end result after following NVIDIA's Vulkan Ray Tracing Tutorial (v2), featuring a rasterization application that transforms into a fully functional ray tracing implementation. The project demonstrates practical integration of ray tracing and ray traversal using the VK_KHR_acceleration_structure, VK_KHR_ray_tracing_pipeline and VK_KHR_ray_query extensions.
- nvpro_core2: Vulkan helper classes and utilities
- See Clone instructions below
- Vulkan 1.4+: Compatible GPU and drivers
- Select Volk headers during installation for better compatibility
- Visual Studio 2019 or newer: MSVC C++ compiler
- Install the "Desktop development with C++" workload
- MSVC 2019 is the minimum compiler version for C++20 support
- CMake 3.18+
# Clone repositories
git clone https://github.com/nvpro-samples/nvpro_core2.git
git clone https://github.com/johnklucinec/vulkan_ray_tracing_final_project.git
# Navigate to the raytracing project directory
cd vulkan_ray_tracing_final_project
# Build
cmake -B build -S . # Run once
cmake --build build -j 8 # Run for each buildCompiled files will be under the _bin directory.
Note: If you prefer to use Clangd as an LSP, you can run the
clangd-config.batfile to generate acompile_commands.json. This script assumes you have Ninja installed, and it switches back to the Visual Studio compiler when it is done.
# Build
clangd-config.bat # Run once
cmake --build build -j 8 # Run for each buildThis project taught me how to convert a modern Vulkan rasterization application into a fully functional ray tracing implementation. I learned both the theoretical concepts and practical implementation details.
raytrace/foundation lets you toggle between a raster-based pipeline to a ray-traced pipline, giving you access to more realisting lighting and shadows. This version demonstrates the core concepts of ray-based rendering with acceleration structures, ray generation, closest hit, and miss shaders.
raytraced/shiny_nvvk uses nvpro-core2 helper libraries for simplified development. This version builds off of foundation, and also implements an any hit shader, temporal antialiasing by jittering camera rays over multiple frames, a dedicated shadow miss shader, and realistic reflections and refractions. This version is not a 1:1 follow along to the tutorial, as my version allows all of these features to run at the same time. Each feature can be toggled on and off using the user interface.
- Foundation: Foundational ray tracing implementation
- Ray Tracing Pipeline: Multi-stage shader pipeline for ray-based rendering
- Acceleration Structures: BLAS and TLAS for efficient ray-geometry intersection
- Shader Binding Table: Management system for ray tracing shaders
- Ray Generation: Camera ray creation and dispatch
- Closest Hit Shading: Material shading at ray intersection points
- Miss Shader: Background/sky rendering for rays that miss geometry
- Shiny Nvvk: Customizable ray tracing implementation
- Foundation+: Implements all features in foundation using nvpro-core2 helper libraries
- Any Hit Shader: For transparency and alpha testing
- Jitter Camera: For temporal anti-aliasing
- Shadow Miss Shader: For efficient shadow testing
- Added colored shadows
- Reflection: For mirror-like surfaces and global illumination
- Added refraction
Note: If you enable the jitter camera, you need to move the camera to see updates. So, if you change a setting, it will not update the scene until the camera is moved.

