Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emredogann/software-ray-tracer
A CPU-driven Multi-Threaded Ray Tracer written in C++.
https://github.com/emredogann/software-ray-tracer
cmake cpp cpu multithreading ray-tracing raytracer raytracing raytracing-in-one-weekend
Last synced: 28 days ago
JSON representation
A CPU-driven Multi-Threaded Ray Tracer written in C++.
- Host: GitHub
- URL: https://github.com/emredogann/software-ray-tracer
- Owner: EmreDogann
- License: apache-2.0
- Created: 2022-02-14T11:08:21.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-02-16T13:47:39.000Z (almost 3 years ago)
- Last Synced: 2024-11-07T07:21:00.302Z (3 months ago)
- Topics: cmake, cpp, cpu, multithreading, ray-tracing, raytracer, raytracing, raytracing-in-one-weekend
- Language: C++
- Homepage:
- Size: 8.06 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Software Ray Tracing
My implementation of the [Ray Tracing In One Weekend](https://raytracing.github.io/books/RayTracingInOneWeekend.html) series.# Main features:
- Materials (Lambertain, Metallic, Dielectric)
- Camera Positioning
- MSAA
- Ray interactions:
- Reflection
- Refraction/Transmission
- Global-Illumination
- Multi-Threading# Multi-Threading
For Multi-Threading, I have designed the implementation as follows:
- Spawn **X** number of threads (by default will spawn the max number of threads available).
- Using atomic variables, each thread will pick a row to compute.
- Once a row has been finished, the thread will move onto the next free row.
- Once all rows have been calculated, they are reordered in an array and then written to a .ppm file.The image below has a resolution of **2560x1440**. Rendered with 100 samples per pixel with a ray depth of 50.
On a Ryzen 7 3700x, utlizing all 16 threads at 4.0GHz all-core, the entire image was rendered in 5 minutes 46 seconds. This is almost a 10x improvement on the inital single-threaded version.
![Image](./images/Image.png)