Skip to content

Implementation of Peter Shirley's Ray Tracing in One Weekend book series, using multi-threaded CPU rendering.

Notifications You must be signed in to change notification settings

TwentyFiveSoftware/ray-tracing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ray Tracing

Overview

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

The main branch contains all the topics covered in the three books. On top of the presented ray tracing code, I added some enhancements like multi-threading and a window to display the rendering process.

The benchmark branch contains an optimized version of the first book, which I use to compare the render time to my ray tracing implementations in other languages (see below).

Build & Run this project

  1. Install CMake
  2. Clone the repository
  3. Optional: Change sample and thead count in src/constants.h
  4. Build and run the project
    make

Performance

I've already implemented Peter Shirley's ray tracing in various programming languages running on CPU & GPU and compared their 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

1 sample / pixel 100 samples / pixel
Elixir 67,200 ms N/A
JavaScript - Node.js 4,870 ms 308 s
Go 1,410 ms 142 s
OCaml 795 ms 75 s
Java 770 ms 59 s
C++ 685 ms 70 s
Rust 362 ms 36 s
C 329 ms 33 s
GPU - Compute Shader 21 ms 2 s
GPU - Vulkan Ray Tracing Extension 1 ms 0.1 s

About

Implementation of Peter Shirley's Ray Tracing in One Weekend book series, using multi-threaded CPU rendering.

Topics

Resources

Stars

Watchers

Forks