My implementation of Peter Shirley's Ray Tracing in One Weekend books using Vulkan and NVIDIA's RTX extension (VK_NV_ray_tracing). This allows most scenes to be rendered at interactive speed on appropriate hardware.
The real-time ray tracer can also load full geometry from OBJ files as well as render the procedural spheres from the book. An accumulation buffer is used to increase the sample count when the camera is not moving while keeping the frame rate interactive. I have added a UI built using Dear ImGui to allow changing the renderer parameters on the fly. Unlike projects such as Q2VKPT, there is no denoising filter. So the image will get noisy when moving the camera.
This personal project follows my own attempts at CPU ray tracing following Peter Shirley's books (see here and here if you are interested).
I do intend on implementing the scenes from the second book Ray Tracing The Next Week when I get the time.
Using a GeForce RTX 2080 Ti, the rendering speed is obscenely faster than using the CPU renderer. Obviously both implementations are still quite naive in some places, but I'm really impressed by the performance. The cover scene of the first book reaches ~90fps at 1280x720 using 8 rays per pixel and up to 16 bounces.
I suspect performance could be improved further. I have created each object in the scene as a separate instance in the top level acceleration structure, which is probably not the best for data locality. The same goes for displaying multiple Lucy statues, where I have naively duplicated the geometry rather than instancing it multiple times.
Most of the third party dependencies can be built using Microsoft's vcpkg.
Windows (Visual Studio 2017 Win64 solution)
> vcpkg_windows.bat
> build_windows.bat
Linux (GCC 8 Makefile)
> sudo apt-get install curl unzip tar libxinerama-dev libxcursor-dev
> ./vcpkg_linux.sh
> ./build_linux.sh
Assuming you have installed the Vulkan SDK and CMake, the build should work out-of-the box for Visual Studio. On Linux, you may have to manually install additional dependencies for vcpkg_linux.sh
to succeed.
- Vulkan Tutorial
- Introduction to Real-Time Ray Tracing with Vulkan
- NVIDIA Vulkan Ray Tracing Tutorial
- NVIDIA Vulkan Ray Tracing Helpers: Introduction
- Fast and Fun: My First Real-Time Ray Tracing Demo
- Getting Started with RTX Ray Tracing
- D3D12 Raytracing Samples
- George Ouzounoudis's vk_exp
- NVIDIA Vulkan Forums