Home

Awesome

Toy Path Tracer Build Status

Toy path tracer I did in 2018 for my own learning purposes. Somewhat based on Peter Shirley's Ray Tracing in One Weekend minibook (highly recommended!), and on Kevin Beason's smallpt.

Screenshot

I decided to write blog posts about things I discover as I do this:

Note: it can only do spheres, no bounding volume hierachy of any sorts, a lot of stuff hardcoded.

Performance numbers in Mray/s on a scene with ~50 spheres and two light sources, running on the CPU:

LanguageApproachRyzen 5950AMD TR1950MBP 2021MBP 2018MBA 2020iPhone 11iPhone XiPhone SE
C++SIMD Intrinsics281.0187.0105.474.032.326.412.98.5
Scalar141.2100.084.835.715.9
WebAssembly (no threads, no SIMD)8.45.08.15.6
C#Unity Burst "manual" SIMD227.2133.0103.760.029.7
Unity Burst82.036.0
Unity (Editor)6.53.4
Unity (player Mono)6.73.5
Unity (player IL2CPP)39.163.817.2
.NET 6.091.553.040.9
.NET Core 2.086.153.023.6
Mono --llvm35.122.0
Mono23.63.66.1

More detailed specs of the machines above are:

Software versions:

And on the GPU, via a compute shader in D3D11 or Metal depending on the platform:

GPUPerf
D3D11
GeForce RTX 3080Ti3920
GeForce GTX 1080Ti1854
Metal
MBP 2021 (M1 Max)1065
MBP 2018 (Radeon Pro 560X)246
MBA 2020 (Iris Plus)201
iPhone 11 Pro (A13)80
iPhone X (A11)46
iPhone SE (A9)20

A lot of stuff in the implementation is totally suboptimal or using the tech in a "wrong" way. I know it's just a simple toy, ok :)

Building