Skip to content

Latest commit

 

History

History
62 lines (47 loc) · 2.87 KB

README.md

File metadata and controls

62 lines (47 loc) · 2.87 KB

Ray Tracing

Overview

This is my take on Peter Shirley's Ray Tracing in One Weekend book series.

This project is using a the Vulkan Ray Tracing extension to render the scene. Using this extension over a compute shader approach has two main advantages:

  • The extension provides a thing called acceleration structure which pre-optimizes the scene geometry for ray intersection tests.
  • The extension provides a dedicated ray tracing pipeline which uses the dedicated Ray Accelerators in the new AMD RDNA 2 GPUs or the dedicated RT Cores in NVIDIA's RTX graphics cards. Using them speeds up the rendering process tremendously (see performance comparison below).

For more in-depth details visit the official Vulkan ray tracing extension guide here.

Build & Run this project

  1. Install Vulkan SDK
  2. Clone the repository
  3. Initialize git submodules (dependencies)
    git submodule update --init --recursive
  4. Build the project
    cmake -S . -B build
    cmake --build build --config Release
  5. Run the executable
    ./build/Release/RayTracingGPUVulkan.exe

My Ray Tracing series

This is the final part of my 3 project series. Before this project, I followed Peter Shirley' Ray Tracing series and wrote a multi-threaded CPU ray tracer, as well as a GPU ray tracing implementation using a compute shader. The performance differences are compared below.

Performance

The performance was measured on the same scene (see image above) with the same amount of objects, the same recursive depth, the same resolution (1920 x 1080). The measured times are averaged over multiple runs.

Reference system: AMD Ryzen 9 5900X (12 Cores / 24 Threads) | AMD Radeon RX 6800 XT

CPU Ray Tracing GPU Ray Tracing (Compute Shader) GPU Ray Tracing (Vulkan RT extension)
1 sample / pixel ~ 3,800 ms 21.5 ms 1.25 ms
10,000 samples / pixel ~ 10.5 h (extrapolated) 215 s 12.5 s